usb: bcma: control VBUS via a regulator
Subsystems (3)
v2 cover usb: bcma: control VBUS via a regulator
bcma-hcd currently drives the USB power line by grabbing the undocumented "vcc-gpio" property from the controller node and poking it through gpiolib. Besides relying on a non-standard binding, this cannot work on boards such as the NETGEAR R7000 and R8000 where one chipcommon GPIO powers both the USB2 and USB3 cores: the two controllers each request that GPIO exclusively, so the second one fails with -EBUSY and its port stays dead.
Instead, switch the driver to the standard regulator interface and express the power rails as regulator-fixed nodes bound to the chipcommon GPIOs. The regulator core reference-counts enable/disable requests, letting both controllers share one GPIO without conflicts.
v2: fixup dts and keep GPIO working.
Rosen Penev (2):
usb: bcma: add regulator support
ARM: dts: broadcom: model USB VBUS power with regulator-fixed
.../broadcom/bcm4708-buffalo-wxr-1750dhp.dts | 12 ++++- .../bcm4708-buffalo-wzr-1166dhp-common.dtsi | 23 +++++++- .../broadcom/bcm4708-buffalo-wzr-1750dhp.dts | 23 +++++++- .../broadcom/bcm4708-linksys-ea6300-v1.dts | 12 ++++- .../broadcom/bcm4708-linksys-ea6500-v2.dts | 12 ++++- .../dts/broadcom/bcm4708-netgear-r6250.dts | 12 ++++- .../dts/broadcom/bcm4708-netgear-r6300-v2.dts | 12 ++++- .../dts/broadcom/bcm47081-luxul-xwr-1200.dts | 12 ++++- .../broadcom/bcm47081-tplink-archer-c5-v2.dts | 12 ++++- .../dts/broadcom/bcm4709-asus-rt-ac3200.dts | 12 ++++- .../broadcom/bcm4709-buffalo-wxr-1900dhp.dts | 13 ++++- .../dts/broadcom/bcm4709-linksys-ea9200.dts | 24 ++++++++- .../dts/broadcom/bcm4709-netgear-r7000.dts | 14 ++++- .../dts/broadcom/bcm4709-netgear-r8000.dts | 14 ++++- .../broadcom/bcm4709-tplink-archer-c9-v1.dts | 24 ++++++++- .../dts/broadcom/bcm47094-asus-rt-ac3100.dtsi | 12 ++++- .../dts/broadcom/bcm47094-asus-rt-ac5300.dts | 12 ++++- .../dts/broadcom/bcm47094-dlink-dir-885l.dts | 12 ++++- .../dts/broadcom/bcm47094-dlink-dir-890l.dts | 24 ++++++++- .../broadcom/bcm47094-linksys-panamera.dts | 24 ++++++++- .../dts/broadcom/bcm47094-luxul-abr-4500.dts | 12 ++++- .../dts/broadcom/bcm47094-luxul-xbr-4500.dts | 12 ++++- .../dts/broadcom/bcm47094-luxul-xwr-3100.dts | 12 ++++- .../broadcom/bcm47094-luxul-xwr-3150-v1.dts | 12 ++++- .../arm/boot/dts/broadcom/bcm947189acdbmr.dts | 12 ++++- drivers/usb/host/bcma-hcd.c | 54 +++++++++++++++---- 26 files changed, 384 insertions(+), 45 deletions(-)
Signature · 1 line
2.55.0
PATCH v2 1/2 usb: bcma: add regulator support
bcma-hcd drives the USB power line by grabbing the undocumented "vcc-gpio" from the controller node and poking it through gpiolib. Besides relying on a non-standard binding, this cannot work on boards such as the NETGEAR R7000 and R8000 where one chipcommon GPIO powers both the USB2 and USB3 cores: the two controllers each request that GPIO exclusively, so the second one fails with -EBUSY and its port stays dead.
Add support for the standard regulator interface. Each core obtains its (shared) VBUS supply through devm_regulator_get() and the regulator core reference-counts the enable/disable requests, allowing both controllers to drive one GPIO without conflicts.
--- drivers/usb/host/bcma-hcd.c | 54 +++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 11 deletions(-)
drivers/usb/host/bcma-hcd.c +43 -11
@@ -26,6 +26,7 @@#include <linux/slab.h> #include <linux/of.h> #include <linux/of_platform.h> +#include <linux/regulator/consumer.h> #include <linux/usb/ehci_pdriver.h> #include <linux/usb/ohci_pdriver.h>
@@ -41,6 +42,7 @@ struct bcma_hcd_device {struct platform_device *ehci_dev;struct platform_device *ohci_dev;struct gpio_desc *gpio_desc; +struct regulator *regulator; };/* Wait for bitmask in a register to get set or cleared.
@@ -280,14 +282,23 @@ static int bcma_hcd_usb20_ns_init(struct bcma_hcd_device *bcma_hcd)return 0 ; } -static void bcma_hci_platform_power_gpio (struct bcma_device *dev,bool val) +static int bcma_hci_platform_power (struct bcma_device *dev,bool on) {struct bcma_hcd_device *usb_dev =bcma_get_drvdata (dev); +int err; + +if (usb_dev->gpio_desc) +return gpiod_set_value (usb_dev->gpio_desc, on); -if (!usb_dev->gpio_desc) -return ; +if (!usb_dev->regulator) +return 0 ; -gpiod_set_value (usb_dev->gpio_desc, val); +if (on) + err =regulator_enable (usb_dev->regulator); +else + err =regulator_disable (usb_dev->regulator); + +return err; }static const struct usb_ehci_pdata ehci_pdata = {
@@ -395,12 +406,12 @@ static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd)static int bcma_hcd_probe (struct bcma_device *core) {int err; +struct device *dev = &core->dev;struct bcma_hcd_device *usb_dev;/* TODO: Probably need checks here; is the core connected? */ - usb_dev =devm_kzalloc (&core->dev,sizeof (struct bcma_hcd_device ), -GFP_KERNEL ); + usb_dev =devm_kzalloc (dev,sizeof (*usb_dev),GFP_KERNEL );if (!usb_dev)return -ENOMEM ; usb_dev->core = core;
@@ -411,6 +422,14 @@ static int bcma_hcd_probe(struct bcma_device *core)return dev_err_probe (&core->dev,PTR_ERR (usb_dev->gpio_desc),"error obtaining VCC GPIO" ); + usb_dev->regulator =devm_regulator_get (dev,"vbus" ); +if (IS_ERR (usb_dev->regulator)) +return dev_err_probe (dev,PTR_ERR (usb_dev->regulator),"error obtaining VBUS regulator" ); + + err =regulator_enable (usb_dev->regulator); +if (err) +return dev_err_probe (dev, err,"error enabling VCC regulator" ); +switch (core->id.id) {case BCMA_CORE_USB20_HOST :if (IS_ENABLED (CONFIG_ARM ))
@@ -427,13 +446,16 @@ static int bcma_hcd_probe(struct bcma_device *core) err =bcma_hcd_usb30_init (usb_dev);break ;default : -return -ENODEV ; + err = -ENODEV ; }if (err) -return err; + goto error;bcma_set_drvdata (core, usb_dev);return 0 ; +error: +regulator_disable (usb_dev->regulator); +return err; }static void bcma_hcd_remove (struct bcma_device *dev)
@@ -442,6 +464,8 @@ static void bcma_hcd_remove(struct bcma_device *dev)struct platform_device *ohci_dev = usb_dev->ohci_dev;struct platform_device *ehci_dev = usb_dev->ehci_dev; +regulator_disable (usb_dev->regulator); +if (ohci_dev)platform_device_unregister (ohci_dev);if (ehci_dev)
@@ -452,7 +476,7 @@ static void bcma_hcd_remove(struct bcma_device *dev)static void bcma_hcd_shutdown (struct bcma_device *dev) { -bcma_hci_platform_power_gpio (dev, false); +bcma_hci_platform_power (dev, false);bcma_core_disable (dev,0 ); }
@@ -460,7 +484,11 @@ static void bcma_hcd_shutdown(struct bcma_device *dev)static int bcma_hcd_suspend (struct bcma_device *dev) { -bcma_hci_platform_power_gpio (dev, false); +int err; + + err =bcma_hci_platform_power (dev, false); +if (err) +return err;bcma_core_disable (dev,0 );return 0 ;
@@ -468,7 +496,11 @@ static int bcma_hcd_suspend(struct bcma_device *dev)static int bcma_hcd_resume (struct bcma_device *dev) { -bcma_hci_platform_power_gpio (dev, true); +int err; + + err =bcma_hci_platform_power (dev, true); +if (err) +return err;bcma_core_enable (dev,0 );return 0 ;
Signature · 1 line
2.55.0
PATCH v2 2/2 ARM: dts: broadcom: model USB VBUS power with regulator-fixed
In reply to Rosen PenevReplace the undocumented "vcc-gpio" property on the usb2/usb3 controller nodes with the standard vbus-supply/regulator-fixed model. Boards now declare a regulator bound to the chipcommon GPIO that bcma-hcd used to poke directly, one per power rail.
Polarity is preserved: rails that used a GPIO_ACTIVE_HIGH are marked enable-active-high, while the Buffalo usb3 rails keep GPIO_ACTIVE_LOW and rely on the binding's active-low default. regulator-boot-on mirrors the rail being left enabled by CFE so the power line is never toggled during probe.
--- .../broadcom/bcm4708-buffalo-wxr-1750dhp.dts | 12 +++++++++- .../bcm4708-buffalo-wzr-1166dhp-common.dtsi | 23 ++++++++++++++++-- .../broadcom/bcm4708-buffalo-wzr-1750dhp.dts | 23 ++++++++++++++++-- .../broadcom/bcm4708-linksys-ea6300-v1.dts | 12 +++++++++- .../broadcom/bcm4708-linksys-ea6500-v2.dts | 12 +++++++++- .../dts/broadcom/bcm4708-netgear-r6250.dts | 12 +++++++++- .../dts/broadcom/bcm4708-netgear-r6300-v2.dts | 12 +++++++++- .../dts/broadcom/bcm47081-luxul-xwr-1200.dts | 12 +++++++++- .../broadcom/bcm47081-tplink-archer-c5-v2.dts | 12 +++++++++- .../dts/broadcom/bcm4709-asus-rt-ac3200.dts | 12 +++++++++- .../broadcom/bcm4709-buffalo-wxr-1900dhp.dts | 13 ++++++++-- .../dts/broadcom/bcm4709-linksys-ea9200.dts | 24 +++++++++++++++++-- .../dts/broadcom/bcm4709-netgear-r7000.dts | 14 +++++++++-- .../dts/broadcom/bcm4709-netgear-r8000.dts | 14 +++++++++-- .../broadcom/bcm4709-tplink-archer-c9-v1.dts | 24 +++++++++++++++++-- .../dts/broadcom/bcm47094-asus-rt-ac3100.dtsi | 12 +++++++++- .../dts/broadcom/bcm47094-asus-rt-ac5300.dts | 12 +++++++++- .../dts/broadcom/bcm47094-dlink-dir-885l.dts | 12 +++++++++- .../dts/broadcom/bcm47094-dlink-dir-890l.dts | 24 +++++++++++++++++-- .../broadcom/bcm47094-linksys-panamera.dts | 24 +++++++++++++++++-- .../dts/broadcom/bcm47094-luxul-abr-4500.dts | 12 +++++++++- .../dts/broadcom/bcm47094-luxul-xbr-4500.dts | 12 +++++++++- .../dts/broadcom/bcm47094-luxul-xwr-3100.dts | 12 +++++++++- .../broadcom/bcm47094-luxul-xwr-3150-v1.dts | 12 +++++++++- .../arm/boot/dts/broadcom/bcm947189acdbmr.dts | 12 +++++++++- 25 files changed, 341 insertions(+), 34 deletions(-)
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts +11 -1
@@ -101,6 +101,16 @@ led-usb { trigger-sources = <&xhci_port1 &ehci_port1 &ohci_port1>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &srab {
@@ -130,7 +140,7 @@ port@4 { }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1166dhp-common.dtsi +21 -2
@@ -136,14 +136,33 @@ button-eject { gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + }; }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_LOW>; + vbus-supply = <&usb3_power>; }; &spi_nor {
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1750dhp.dts +21 -2
@@ -132,14 +132,33 @@ button-eject { gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + }; }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_LOW>; + vbus-supply = <&usb3_power>; }; &spi_nor {
arch/arm/boot/dts/broadcom/bcm4708-linksys-ea6300-v1.dts +11 -1
@@ -41,6 +41,16 @@ button-restart { gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3_phy {
@@ -48,5 +58,5 @@ &usb3_phy { }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
arch/arm/boot/dts/broadcom/bcm4708-linksys-ea6500-v2.dts +11 -1
@@ -38,6 +38,16 @@ button-restart { gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3_phy {
@@ -45,5 +55,5 @@ &usb3_phy { }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
arch/arm/boot/dts/broadcom/bcm4708-netgear-r6250.dts +11 -1
@@ -81,10 +81,20 @@ button-restart { gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &spi_nor {
arch/arm/boot/dts/broadcom/bcm4708-netgear-r6300-v2.dts +11 -1
@@ -77,6 +77,16 @@ button-restart { gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &spi_nor {
@@ -88,5 +98,5 @@ &usb3_phy { }; &usb3 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
arch/arm/boot/dts/broadcom/bcm47081-luxul-xwr-1200.dts +11 -1
@@ -104,10 +104,20 @@ button-restart { gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &gmac0 {
arch/arm/boot/dts/broadcom/bcm47081-tplink-archer-c5-v2.dts +11 -1
@@ -89,6 +89,16 @@ button-restart { gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &spi_nor {
@@ -109,5 +119,5 @@ partition-file-system { }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
arch/arm/boot/dts/broadcom/bcm4709-asus-rt-ac3200.dts +11 -1
@@ -73,6 +73,16 @@ led-wps { gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &gmac0 {
@@ -142,7 +152,7 @@ port@4 { }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm4709-buffalo-wxr-1900dhp.dts +11 -2
@@ -116,11 +116,20 @@ button-eject { gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; }; }; -}; + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; &usb2 { - vcc-gpio = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &spi_nor {
arch/arm/boot/dts/broadcom/bcm4709-linksys-ea9200.dts +22 -2
@@ -91,6 +91,26 @@ led-3 { linux,default-trigger = "default-on"; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &pcie_bridge0 {
@@ -155,11 +175,11 @@ &usb3_phy { }; &usb2 { - vcc-gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb3_power>; }; &gmac2 {
arch/arm/boot/dts/broadcom/bcm4709-netgear-r7000.dts +12 -2
@@ -91,14 +91,24 @@ button-restart { gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb2 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts +12 -2
@@ -184,14 +184,24 @@ wifi@0,0 { }; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb2 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3 { - vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm4709-tplink-archer-c9-v1.dts +22 -2
@@ -90,14 +90,34 @@ button-restart { gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb2 { - vcc-gpio = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpio = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb3_power>; }; &spi_nor {
arch/arm/boot/dts/broadcom/bcm47094-asus-rt-ac3100.dtsi +11 -1
@@ -98,6 +98,16 @@ led-wps { gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &nandcs {
@@ -167,7 +177,7 @@ port@8 { }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm47094-asus-rt-ac5300.dts +11 -1
@@ -79,6 +79,16 @@ led-wps { gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &gmac0 {
@@ -151,7 +161,7 @@ port@4 { }; &usb2 { - vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-885l.dts +11 -1
@@ -115,10 +115,20 @@ button-restart { gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3 { - vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &gmac0 {
arch/arm/boot/dts/broadcom/bcm47094-dlink-dir-890l.dts +22 -2
@@ -117,6 +117,26 @@ et0macaddr: et0macaddr { #nvmem-cell-cells = <1>; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 21 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &gmac2 {
@@ -158,11 +178,11 @@ firmware@0 { }; &usb2 { - vcc-gpios = <&chipcommon 21 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb3_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm47094-linksys-panamera.dts +22 -2
@@ -195,14 +195,34 @@ fixed-link { }; }; }; + + usb2_power: regulator-usb2 { + compatible = "regulator-fixed"; + regulator-name = "usb2-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_power: regulator-usb3 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb2 { - vcc-gpio = <&chipcommon 13 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb2_power>; }; &usb3 { - vcc-gpio = <&chipcommon 14 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb3_power>; }; &srab {
arch/arm/boot/dts/broadcom/bcm47094-luxul-abr-4500.dts +11 -1
@@ -59,10 +59,20 @@ button-restart { gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3 { - vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &gmac0 {
arch/arm/boot/dts/broadcom/bcm47094-luxul-xbr-4500.dts +11 -1
@@ -59,10 +59,20 @@ button-restart { gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3 { - vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &gmac0 {
arch/arm/boot/dts/broadcom/bcm47094-luxul-xwr-3100.dts +11 -1
@@ -99,10 +99,20 @@ button-restart { gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb3 { - vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &gmac0 {
arch/arm/boot/dts/broadcom/bcm47094-luxul-xwr-3150-v1.dts +11 -1
@@ -74,6 +74,16 @@ button-restart { gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; }; }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &gmac0 {
@@ -98,7 +108,7 @@ wifi@0,0 { }; &usb3 { - vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; }; &usb3_phy {
arch/arm/boot/dts/broadcom/bcm947189acdbmr.dts +11 -1
@@ -69,6 +69,16 @@ spi { /* External BCM6802 MoCA chip is connected */ }; + + usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &pcie0 {
@@ -92,5 +102,5 @@ wifi@0,1,0 { }; &usb2 { - vcc-gpio = <&chipcommon 8 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCHv2 1/2] usb: bcma: add regulator support
In reply to Rosen PenevThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] usb: bcma: teardown ordering violation in bcma_hcd_remove() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: bcma: teardown ordering violation in bcma_hcd_remove()
--
commit cdbc43989b0d2d3446fd86aaaa77bbc9306cb391
Author: Rosen Penev <[email protected]>
usb: bcma: add regulator support
This patch adds support for the standard regulator interface to provide VBUS supply to the USB cores. It reference-counts the enable/disable requests, allowing both controllers to drive one GPIO without conflicts.
Quoted 4 lines
drivers/usb/host/bcma-hcd.c +0
-0
[ ... ]
drivers/usb/host/bcma-hcd.c static void bcma_hcd_remove(struct bcma_device *dev) · line 468
Quoted 6 lines
drivers/usb/host/bcma-hcd.c +2
-0@@ -442,6 +464,8 @@ static void bcma_hcd_remove(struct bcma_device *dev)struct platform_device *ohci_dev = usb_dev->ohci_dev;struct platform_device *ehci_dev = usb_dev->ehci_dev; +regulator_disable (usb_dev->regulator); +
[Severity: High]
Does disabling the regulator before unregistering the platform devices cause a teardown ordering violation?
In bcma_hcd_probe(), the initialization order is followed: the regulator is enabled first, and then the child platform devices (ohci_dev and ehci_dev) are registered.
During driver teardown in bcma_hcd_remove(), this order must be reversed to ensure that dependent drivers are unbound while the hardware remains powered.
When platform_device_unregister() runs, it invokes the child drivers' remove routines (e.g., ehci_platform_remove()), which perform register accesses to cleanly halt the controllers. Since the regulator (which may power the PHY or controller logic) has already been disabled here, will these register accesses target unpowered hardware and trigger synchronous bus errors?
Should the regulator be disabled after the child devices are unregistered?
Quoted 4 lines
drivers/usb/host/bcma-hcd.c +0
-0if (ohci_dev)platform_device_unregister (ohci_dev);if (ehci_dev)
platform_device_unregister(ehci_dev);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCHv2 2/2] ARM: dts: broadcom: model USB VBUS power with regulator-fixed
In reply to Rosen PenevThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] usb: bcma: silent power down of USB ports due to unmanaged vbus-supply - [Medium] usb: bcma…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] usb: bcma: silent power down of USB ports due to unmanaged vbus-supply
- [Medium] usb: bcma: suspend and shutdown power savings broken by missing GPIO --
commit c18abcaaf29836cfc87135468c83037df7b8de36
Author: Rosen Penev <[email protected]>
ARM: dts: broadcom: model USB VBUS power with regulator-fixed
Replace the undocumented "vcc-gpio" property on the usb2/usb3 controller nodes with the standard vbus-supply/regulator-fixed model. Boards now declare a regulator bound to the chipcommon GPIO that bcma-hcd used to poke directly, one per power rail.
Quoted 9 lines
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts +1
-0@@ -101,6 +101,16 @@ led-usb { trigger-sources = <&xhci_port1 &ehci_port1 &ohci_port1>; }; }; +
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts led-usb { · line 114
Quoted 10 lines
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts +9
-0+ usb_power: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vcc"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + gpios = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; };
[Severity: High]
Since this regulator lacks the regulator-always-on property, and no driver claims it, will the regulator core forcibly disable it shortly after boot?
Looking at bcma_hcd_probe() in drivers/usb/host/bcma-hcd.c, the driver still expects a vcc-gpio property and lacks the logic to request or consume a vbus-supply regulator:
drivers/usb/host/bcma-hcd.c:bcma_hcd_probe() {
...
usb_dev->gpio_desc = devm_gpiod_get_optional(&core->dev, "vcc",
GPIOD_OUT_HIGH);
...
}Because the regulator is never claimed, it will be automatically disabled by the regulator core via regulator_late_cleanup(), which would cut off power to all USB ports and break attached devices.
[ ... ]
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts port@4 { · line 144
Quoted 7 lines
arch/arm/boot/dts/broadcom/bcm4708-buffalo-wxr-1750dhp.dts +1
-1@@ -130,7 +140,7 @@ port@4 { }; &usb3 { - vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_HIGH>; + vbus-supply = <&usb_power>; };
[Severity: Medium]
Since the bcma-hcd driver was not updated to handle vbus-supply and still looks for vcc-gpio, does this break USB power toggling during system suspend and shutdown?
Because usb_dev->gpio_desc now evaluates to NULL, the power-toggling function silently returns without asserting the hardware state:
drivers/usb/host/bcma-hcd.c:bcma_hci_platform_power_gpio() {
...
if (!usb_dev->gpio_desc)
return;
gpiod_set_value(usb_dev->gpio_desc, val);
...
}This means when system suspend calls bcma_hcd_suspend(), which subsequently calls bcma_hci_platform_power_gpio(dev, false), VBUS power won't actually be turned off, resulting in a loss of power savings.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Rafał Miłecki
maintainerRe: [PATCHv2 1/2] usb: bcma: add regulator support
In reply to Rosen PenevW dniu 21.09.2026 o 23:41, Rosen Penev pisze:
drivers/usb/host/bcma-hcd.c static int bcma_hcd_probe(struct bcma_device *core) · line 427
Quoted 7 lines
drivers/usb/host/bcma-hcd.c +3
-0@@ -411,6 +422,14 @@ static int bcma_hcd_probe(struct bcma_device *core)return dev_err_probe (&core->dev,PTR_ERR (usb_dev->gpio_desc),"error obtaining VCC GPIO" ); + usb_dev->regulator =devm_regulator_get (dev,"vbus" ); +if (IS_ERR (usb_dev->regulator)) +return dev_err_probe (dev,PTR_ERR (usb_dev->regulator),"error obtaining VBUS regulator" );
Did you test this for DT without VBUS? You seem to *require* regulator. Shouldn't you make it optional?
drivers/usb/host/bcma-hcd.c static int bcma_hcd_probe(struct bcma_device *core) · line 432
Quoted 4 lines
drivers/usb/host/bcma-hcd.c +4
-0+ err =regulator_enable (usb_dev->regulator); +if (err) +return dev_err_probe (dev, err,"error enabling VCC regulator" ); +
Can't you use one of devm helpers that get and enable regulator for you?
Re: [PATCHv2 1/2] usb: bcma: add regulator support
Quoted 11 lines · Rafał Miłecki
W dniu 21.09.2026 o 23:41, Rosen Penev pisze:
drivers/usb/host/bcma-hcd.c static int bcma_hcd_probe(struct bcma_device *core) · line 427
Quoted 7 lines
drivers/usb/host/bcma-hcd.c +3
-0@@ -411,6 +422,14 @@ static int bcma_hcd_probe(struct bcma_device *core)return dev_err_probe (&core->dev,PTR_ERR (usb_dev->gpio_desc),"error obtaining VCC GPIO" ); + usb_dev->regulator =devm_regulator_get (dev,"vbus" ); +if (IS_ERR (usb_dev->regulator)) +return dev_err_probe (dev,PTR_ERR (usb_dev->regulator),"error obtaining VBUS regulator" );Did you test this for DT without VBUS? You seem to *require* regulator. Shouldn't you make it optional?
Nope. Confusingly, devm_regulator_get_optional returns -ENODEV if a regulator is missing, which means probe will fail.
I could remove the return but then I would need to guard all regulator_en/disable calls with IS_ERR. Much cleaner to have a dummy regulator.
Quoted 8 lines
drivers/usb/host/bcma-hcd.c static int bcma_hcd_probe(struct bcma_device *core) · line 432
Quoted 6 lines
drivers/usb/host/bcma-hcd.c +4
-0+ err =regulator_enable (usb_dev->regulator); +if (err) +return dev_err_probe (dev, err,"error enabling VCC regulator" ); +Can't you use one of devm helpers that get and enable regulator for you?
nope. devm_regulator_get_enable_optional returns an int, not a pointer. This driver requires management of the regulator in suspend and resume paths.