Disable USB HOST Port

Started by dlombardo, April 03, 2024, 02:50:55 PM

Previous topic - Next topic

dlombardo

Hi,

In Jessie (Kernel 3.4) Image USB ports can be easily controlled using GPIO port for controlling its SY6280.

Example:
# USB port 1 (higher) - max 1000 mA
# Init
echo 66 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio66_ph6/direction
# Turn ON
echo 1 > /sys/class/gpio/gpio66_ph6/value
# Turn OFF
echo 0 > /sys/class/gpio/gpio66_ph6/value

# USB port 2 (lower) - max. 523 mA
# Init
echo 67 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio67_ph3/direction
# Turn ON
echo 1 > /sys/class/gpio/gpio67_ph3/value
# Turn OFF
echo 1 > /sys/class/gpio/gpio67_ph3/value


In current Debian 11 Bullseye image the USB ports are no longer easy to control.

The GPIO ports are taken by USB (vbus) driver
# cat /sys/kernel/debug/gpio | grep -i usb
 gpio-41  (                    |usb0-vbus           ) out lo
 gpio-227 (                    |usb2-vbus           ) out hi
 gpio-228 (                    |usb0_id_det         ) in  hi IRQ
 gpio-229 (                    |usb0_vbus_det       ) in  lo IRQ
 gpio-230 (                    |usb1-vbus           ) out hi

and I can only temporary disable USB port by using unbind example for USB port 2
echo "4-1" > /sys/bus/usb/drivers/usb/unbind

The problem is this can allow USB device to 'wakeup' and gets auto bind again e.g. USB screen upon touching.

I would like the device to be disabled until I make manual bind
echo "4-1" > /sys/bus/usb/drivers/usb/bind

This might not happen with initial setup I had done with image in 2021 (Ubuntu), when I discovered and tested unbind/bind with USB Touch device but I have upgraded the system and now I can confirm the USB Touch device gets auto bind upon touch and unbind is no longer usefull, except maybe for device reset request.

I have this behaviour with latest Debian Bullseye image and one I have from 2022.

Can I get control over USB Host GPIO control again in Mainline linux Image?

I do not find any setup for USB in the Olimex Device Tree overlays - https://github.com/OLIMEX/olinuxino-overlays.git



toutgoing

I can confirm that the USB Touch device now automatically binds upon touch and that unbinding is no longer useful—perhaps with the exception of device reset requests. This may not have happened with the initial setup I completed with the image in 2021 (Ubuntu), when I discovered and tested unbind/bind with USB Touch device.