Closed
Conversation
66de4df to
b71302b
Compare
The nand subtarget device gl-ar300 requires regulator-fixed support to power USB port. All other subtargets enable this kconfig, so move it to the target kconfig instead. Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Allow the kernel CONFIG_POWER_SUPPLY (bool, built-in only) to be selected by a feature flag. This allows us to depend @POWER_SUPPLY_SUPPORT for packages where modules require this Kconfig. Used later in the kmod-usb-conn-gpio package. Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Build CONFIG_USB_CONN_GPIO as a module, depending on the power-supply feature flag From drivers/usb/common/Kconfig The driver supports USB role switch between host and device via GPIO based USB cable detection, used typically if an input GPIO is used to detect USB ID pin, and another input GPIO may be also used to detect Vbus pin at the same time, it also can be used to enable/disable device if an input GPIO is only used to detect Vbus pin. While built for USB role selection (otg / host / device), this driver can be used to enable/disable a regulator with bind/unbind, and allows a USB port on a USB controller to be linked to a physical USB connector type Binding documentation: [0] [0]: https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/connector/usb-connector.yaml Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
With commit 6e9c814 ("ath79: add USB power control for GL-AR300M series"), a fixed regulator was added to DTS, and referenced from the "generic-ehci" USB controller node. ehci-platform.c is not a regulator consumer, so no kernel devlinks were built between the supplier node reg_usb_vbus, and the consumer usb0. This meant that the regulator was never enabled. Add the DTS settings for a usb-conn-gpio driven device to enable control of the regulator through bind/unbind of this driver. This can be used to reset a USB device. This does require: - a fake id-gpios, which is always LOW, to force usb-conn-gpio to set USB role as HOST mode. Alternativerly, patch usb-conn-gpio to allow probe without id and vbus gpios, then allow forcing HOST mode through a DTS property. - the additional Kconfig of POWER_SUPPLY, which is set through the power-supply target feature - usb-conn-gpio module (through kmod-usb-conn-gpio package) Alternative approaches were investigated in - forget regulator control, and add the DTS property to reg_usb_vbus: regulator-always-on - patch ehci-platform.c to be a regulator consumer. attempt here: [0] - backport the 6.2 regulator-output series [1] Example usage: root@OpenWrt:~# cat /sys/kernel/debug/regulator/regulator_summary regulator use open bypass opmode voltage current min max --------------------------------------------------------------------------------------- regulator-dummy 1 0 0 unknown 0mV 0mA 0mV 0mV usb_vbus 1 1 0 unknown 5000mV 0mA 5000mV 5000mV connector_usb-vbus 1 0mA 0mV 0mV root@OpenWrt:~# ls -l /sys/class/regulator/regulator.1/ lrwxrwxrwx 1 root root 0 Nov 13 04:05 consumer:platform:connector_usb -> ../../../../virtual/devlink/regulator:regulator.1--platform:connector_usb lrwxrwxrwx 1 root root 0 Nov 13 04:05 device -> ../../../reg_usb_vbus -r--r--r-- 1 root root 4096 Nov 13 04:05 microvolts -r--r--r-- 1 root root 4096 Nov 13 04:05 name -r--r--r-- 1 root root 4096 Nov 13 04:05 num_users lrwxrwxrwx 1 root root 0 Nov 13 04:05 of_node -> ../../../../../firmware/devicetree/base/reg_usb_vbus -r--r--r-- 1 root root 4096 Nov 13 04:05 requested_microamps -r--r--r-- 1 root root 4096 Nov 13 04:05 state lrwxrwxrwx 1 root root 0 Nov 13 04:05 subsystem -> ../../../../../class/regulator -r--r--r-- 1 root root 4096 Nov 13 04:05 suspend_disk_state -r--r--r-- 1 root root 4096 Nov 13 04:05 suspend_mem_state -r--r--r-- 1 root root 4096 Nov 13 04:05 suspend_standby_state -r--r--r-- 1 root root 4096 Nov 13 04:05 type -rw-r--r-- 1 root root 4096 Nov 13 04:05 uevent lrwxrwxrwx 1 root root 0 Nov 13 04:05 connector_usb-vbus -> ../../../connector_usb root@OpenWrt:~# echo connector_usb>/sys/bus/platform/drivers/usb-conn-gpio/unbind root@OpenWrt:~# cat /sys/kernel/debug/regulator/regulator_summary regulator use open bypass opmode voltage current min max --------------------------------------------------------------------------------------- regulator-dummy 1 0 0 unknown 0mV 0mA 0mV 0mV usb_vbus 0 0 0 unknown 5000mV 0mA 5000mV 5000mV root@OpenWrt:~# echo connector_usb>/sys/bus/platform/drivers/usb-conn-gpio/bind root@OpenWrt:~# cat /sys/class/regulator/regulator.1/state enabled root@OpenWrt:~# cat /sys/kernel/debug/usb/devices T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1 B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1d6b ProdID=0002 Rev= 5.15 S: Manufacturer=Linux 5.15.78 ehci_hcd S: Product=EHCI Host Controller S: SerialNumber=1b000000.usb C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=12d1 ProdID=1c05 Rev= 1.02 S: Manufacturer=HUAWEI_MOBILE S: Product=HUAWEI_MOBILE C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr= 2mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms root@OpenWrt:~# echo connector_usb>/sys/bus/platform/drivers/usb-conn-gpio/unbind root@OpenWrt:~# cat /sys/kernel/debug/usb/devices T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1 B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1d6b ProdID=0002 Rev= 5.15 S: Manufacturer=Linux 5.15.78 ehci_hcd S: Product=EHCI Host Controller S: SerialNumber=1b000000.usb C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms root@OpenWrt:~# echo connector_usb>/sys/bus/platform/drivers/usb-conn-gpio/unbind [0]: https://lore.kernel.org/lkml/1519897899-8577-1-git-send-email-amelie.delaunay@st.com/t/#u [1]: https://lore.kernel.org/all/20221031233704.22575-1-zev@bewilderbeest.net/t/#u Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
b71302b to
1aba978
Compare
john-tho
pushed a commit
that referenced
this pull request
May 26, 2023
Iomega Storcenter ix4-200d is a four-bay SATA NAS powered by a Marvell Kirkwood SoC clocked at 1.2GHz. It has 512MB of RAM and 32MB of flash memory, 3x USB 2.0 and 2x 1Gbit/s NIC Specification: - SoC: Marvell Kirkwood 88F6281 - CPU/Speed: 1200Mhz - Flash size: 32 MiB - RAM: 512MB - LAN: 2x 1Gbit/s - 3x USB 2.0 Notes: - The blue drive LED is triggered by HDD activity, it can not be controlled via GPIO. - The LCD screen requires proprietary code and does not function at this time. - Due to a kernel-related issue with the Marvell 88SE6121 SATA controller, currently only trays numbered #3 and #4 work, #1 and #2 do not. [1] Serial pinout: CN4 -------------- | 10 8 6 4 2 | | 9 7 5 3 1 | -------------- PIN 1 Mark (fat line) 1 = RXD 4 = TXD 6 = GND 9 = 3.3V (not necessary to connect) Installation instructions: 1. download initramfs-uImage and copy into tftp server 2. connect the tftp server to network port #1 3. access uboot environment with serial cable and run setenv mainlineLinux yes setenv arcNumber 1682 setenv console 'console=ttyS0,115200n8' setenv mtdparts 'mtdparts=orion_nand:0x100000@0x000000(u-boot)ro,0x20000@0xA0000(u-boot environment)ro,0x300000@0x100000(kernel),0x1C00000@0x400000(ubi)' setenv bootargs_root 'root=' setenv bootcmd 'setenv bootargs ${console} ${mtdparts} ${bootargs_root}; nand read.e 0x800000 0x100000 0x300000; bootm 0x00800000' saveenv setenv serverip 192.168.1.1 setenv ipaddr 192.168.1.2 tftpboot 0x00800000 [initramfs-uImage filename] bootm 0x00800000 4. connect to LAN on network port #2, log into openwrt and sysupgrade to install into flash [1] https://bugzilla.kernel.org/show_bug.cgi?id=216094 Signed-off-by: Sander van Deijck <sander@vandeijck.com> (aligned FROM from signed-off. LED+key rename, whitespace removal) Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test PR