linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver
@ 2021-05-11 22:52 Matthias Kaehlcke
  2021-05-11 22:52 ` [PATCH v10 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2021-05-11 22:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern, Rob Herring, Frank Rowand
  Cc: Michal Simek, devicetree, Douglas Anderson, linux-usb,
	Peter Chen, linux-kernel, Stephen Boyd, Ravi Chandra Sadineni,
	Krzysztof Kozlowski, Bastien Nocera, Matthias Kaehlcke,
	Al Cooper, Alexander A. Klimov, Andy Gross, Bjorn Andersson,
	Christian Lamparter, Colin Ian King, Dmitry Osipenko,
	Fabio Estevam, Masahiro Yamada, Mathias Nyman, Vinod Koul,
	linux-arm-msm

This series adds:
- the onboard_usb_hub_driver
- glue in the xhci-plat driver to create the onboard_usb_hub
  platform device if needed
- a device tree binding for the Realtek RTS5411 USB hub controller
- device tree changes that add RTS5411 entries for the QCA SC7180
  based boards trogdor and lazor
- a couple of stubs for platform device functions to avoid
  unresolved symbols with certain kernel configs

The main issue the driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Changes in v10:
- always use of_is_onboard_usb_hub() stub unless ONBOARD_USB_HUB=y/m
- keep 'regulator-boot-on' property for pp3300_hub

Changes in v9:
- added dependency on ONBOARD_USB_HUB (or !!ONBOARD_USB_HUB) to
  USB_PLATFORM_XHCI

Changes in v7:
- updated DT binding
- series rebased on qcom/arm64-for-5.13

Changes in v6:
- updated summary

Changes in v5:
- cover letter added

Matthias Kaehlcke (5):
  dt-bindings: usb: Add binding for Realtek RTS5411 hub controller
  USB: misc: Add onboard_usb_hub driver
  of/platform: Add stubs for of_platform_device_create/destroy()
  usb: host: xhci-plat: Create platform device for onboard hubs in
    probe()
  arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub

 .../sysfs-bus-platform-onboard-usb-hub        |   8 +
 .../bindings/usb/realtek,rts5411.yaml         |  62 +++
 MAINTAINERS                                   |   7 +
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  19 +-
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  11 +-
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts |  19 +-
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  |  19 +-
 drivers/usb/host/Kconfig                      |   1 +
 drivers/usb/host/xhci-plat.c                  |  16 +
 drivers/usb/misc/Kconfig                      |  17 +
 drivers/usb/misc/Makefile                     |   1 +
 drivers/usb/misc/onboard_usb_hub.c            | 415 ++++++++++++++++++
 include/linux/of_platform.h                   |  22 +-
 include/linux/usb/hcd.h                       |   2 +
 include/linux/usb/onboard_hub.h               |  15 +
 15 files changed, 600 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
 create mode 100644 drivers/usb/misc/onboard_usb_hub.c
 create mode 100644 include/linux/usb/onboard_hub.h

-- 
2.31.1.607.g51e8a6a459-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v10 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub
  2021-05-11 22:52 [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Matthias Kaehlcke
@ 2021-05-11 22:52 ` Matthias Kaehlcke
  2021-05-12  7:19 ` [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Alexander Dahl
  2021-05-21 12:30 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2021-05-11 22:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern, Rob Herring, Frank Rowand
  Cc: Michal Simek, devicetree, Douglas Anderson, linux-usb,
	Peter Chen, linux-kernel, Stephen Boyd, Ravi Chandra Sadineni,
	Krzysztof Kozlowski, Bastien Nocera, Matthias Kaehlcke,
	Andy Gross, Bjorn Andersson, linux-arm-msm

Add nodes for the onboard USB hub on trogdor devices. Remove the
'always-on' property from the hub regulator, since the regulator
is now managed by the onboard_usb_hub driver.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

Changes in v10:
- keep 'regulator-boot-on' property
- updated commit message

Changes in v9:
- none

Changes in v8:
- none

Changes in v7:
- rebased on qcom/arm64-for-5.13 (with the rest of the series)

Changes in v6:
- added 'companion-hub' entry to both USB devices
- added 'vdd-supply' also to hub@2

Changes in v5:
- patch added to the series

 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 19 ++++++++-----------
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 11 ++++-------
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts | 19 ++++++++-----------
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 19 ++++++++++++++++++-
 4 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..bae85f6b2bfa 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -23,17 +23,6 @@ &charger_thermal {
 	status = "disabled";
 };
 
-&pp3300_hub {
-	/* pp3300_l7c is used to power the USB hub */
-	/delete-property/regulator-always-on;
-	/delete-property/regulator-boot-on;
-};
-
-&pp3300_l7c {
-	regulator-always-on;
-	regulator-boot-on;
-};
-
 &sn65dsi86_out {
 	/*
 	 * Lane 0 was incorrectly mapped on the cable, but we've now decided
@@ -42,3 +31,11 @@ &sn65dsi86_out {
 	 */
 	lane-polarities = <1 0>;
 };
+
+&usb_hub_2_0 {
+	 vdd-supply = <&pp3300_l7c>;
+};
+
+&usb_hub_3_0 {
+	 vdd-supply = <&pp3300_l7c>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..45f014c3539d 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -23,13 +23,10 @@ &charger_thermal {
 	status = "disabled";
 };
 
-&pp3300_hub {
-	/* pp3300_l7c is used to power the USB hub */
-	/delete-property/regulator-always-on;
-	/delete-property/regulator-boot-on;
+&usb_hub_2_0 {
+	 vdd-supply = <&pp3300_l7c>;
 };
 
-&pp3300_l7c {
-	regulator-always-on;
-	regulator-boot-on;
+&usb_hub_3_0 {
+	 vdd-supply = <&pp3300_l7c>;
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
index 2b522f9e0d8f..2f5263e3d1b9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
@@ -42,17 +42,6 @@ &panel {
 	compatible = "auo,b116xa01";
 };
 
-&pp3300_hub {
-	/* pp3300_l7c is used to power the USB hub */
-	/delete-property/regulator-always-on;
-	/delete-property/regulator-boot-on;
-};
-
-&pp3300_l7c {
-	regulator-always-on;
-	regulator-boot-on;
-};
-
 &sdhc_2 {
 	status = "okay";
 };
@@ -61,6 +50,14 @@ &trackpad {
 	interrupts = <58 IRQ_TYPE_EDGE_FALLING>;
 };
 
+&usb_hub_2_0 {
+	 vdd-supply = <&pp3300_l7c>;
+};
+
+&usb_hub_3_0 {
+	 vdd-supply = <&pp3300_l7c>;
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 &trackpad_int_1v8_odl {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 192e2e424fde..0d6a7447dc77 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -206,7 +206,6 @@ pp3300_hub: pp3300-hub {
 		pinctrl-names = "default";
 		pinctrl-0 = <&en_pp3300_hub>;
 
-		regulator-always-on;
 		regulator-boot-on;
 
 		vin-supply = <&pp3300_a>;
@@ -848,6 +847,24 @@ &usb_1 {
 
 &usb_1_dwc3 {
 	dr_mode = "host";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/* 2.0 hub on port 1 */
+	usb_hub_2_0: hub@1 {
+		compatible = "usbbda,5411";
+		reg = <1>;
+		vdd-supply = <&pp3300_hub>;
+		companion-hub = <&usb_hub_3_0>;
+	};
+
+	/* 3.0 hub on port 2 */
+	usb_hub_3_0: hub@2 {
+		compatible = "usbbda,411";
+		reg = <2>;
+		vdd-supply = <&pp3300_hub>;
+		companion-hub = <&usb_hub_2_0>;
+	};
 };
 
 &usb_1_hsphy {
-- 
2.31.1.607.g51e8a6a459-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver
  2021-05-11 22:52 [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Matthias Kaehlcke
  2021-05-11 22:52 ` [PATCH v10 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
@ 2021-05-12  7:19 ` Alexander Dahl
  2021-05-12 16:37   ` Matthias Kaehlcke
  2021-05-21 12:30 ` Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Alexander Dahl @ 2021-05-12  7:19 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Greg Kroah-Hartman, Alan Stern, Rob Herring, Frank Rowand,
	Michal Simek, devicetree, Douglas Anderson, linux-usb,
	Peter Chen, linux-kernel, Stephen Boyd, Ravi Chandra Sadineni,
	Krzysztof Kozlowski, Bastien Nocera, Al Cooper,
	Alexander A. Klimov, Andy Gross, Bjorn Andersson,
	Christian Lamparter, Colin Ian King, Dmitry Osipenko,
	Fabio Estevam, Masahiro Yamada, Mathias Nyman, Vinod Koul,
	linux-arm-msm

Hello Matthias,

just a curious informal question, see below.

Am Tue, May 11, 2021 at 03:52:18PM -0700 schrieb Matthias Kaehlcke:
> This series adds:
> - the onboard_usb_hub_driver
> - glue in the xhci-plat driver to create the onboard_usb_hub
>   platform device if needed
> - a device tree binding for the Realtek RTS5411 USB hub controller
> - device tree changes that add RTS5411 entries for the QCA SC7180
>   based boards trogdor and lazor
> - a couple of stubs for platform device functions to avoid
>   unresolved symbols with certain kernel configs
> 
> The main issue the driver addresses is that a USB hub needs to be
> powered before it can be discovered. For discrete onboard hubs (an
> example for such a hub is the Realtek RTS5411) this is often solved
> by supplying the hub with an 'always-on' regulator, which is kind
> of a hack. Some onboard hubs may require further initialization
> steps, like changing the state of a GPIO or enabling a clock, which
> requires even more hacks. This driver creates a platform device
> representing the hub which performs the necessary initialization.
> Currently it only supports switching on a single regulator, support
> for multiple regulators or other actions can be added as needed.
> Different initialization sequences can be supported based on the
> compatible string.

This sounds like it would be useful for other hub controllers as well?
For example, would the Microchip USB3503 (former SMSC,
drivers/usb/misc/usb3503.c, [1]) fall into this category? That chip is
used on the "Cubietech Cubietruck Plus" for example.

> Besides performing the initialization the driver can be configured
> to power the hub off during system suspend. This can help to extend
> battery life on battery powered devices which have no requirements
> to keep the hub powered during suspend. The driver can also be
> configured to leave the hub powered when a wakeup capable USB device
> is connected when suspending, and power it off otherwise.

Sounds interesting.

Greets
Alex

[1] https://www.microchip.com/wwwproducts/en/USB3503

> Changes in v10:
> - always use of_is_onboard_usb_hub() stub unless ONBOARD_USB_HUB=y/m
> - keep 'regulator-boot-on' property for pp3300_hub
> 
> Changes in v9:
> - added dependency on ONBOARD_USB_HUB (or !!ONBOARD_USB_HUB) to
>   USB_PLATFORM_XHCI
> 
> Changes in v7:
> - updated DT binding
> - series rebased on qcom/arm64-for-5.13
> 
> Changes in v6:
> - updated summary
> 
> Changes in v5:
> - cover letter added
> 
> Matthias Kaehlcke (5):
>   dt-bindings: usb: Add binding for Realtek RTS5411 hub controller
>   USB: misc: Add onboard_usb_hub driver
>   of/platform: Add stubs for of_platform_device_create/destroy()
>   usb: host: xhci-plat: Create platform device for onboard hubs in
>     probe()
>   arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub
> 
>  .../sysfs-bus-platform-onboard-usb-hub        |   8 +
>  .../bindings/usb/realtek,rts5411.yaml         |  62 +++
>  MAINTAINERS                                   |   7 +
>  .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  19 +-
>  .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  11 +-
>  .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts |  19 +-
>  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  |  19 +-
>  drivers/usb/host/Kconfig                      |   1 +
>  drivers/usb/host/xhci-plat.c                  |  16 +
>  drivers/usb/misc/Kconfig                      |  17 +
>  drivers/usb/misc/Makefile                     |   1 +
>  drivers/usb/misc/onboard_usb_hub.c            | 415 ++++++++++++++++++
>  include/linux/of_platform.h                   |  22 +-
>  include/linux/usb/hcd.h                       |   2 +
>  include/linux/usb/onboard_hub.h               |  15 +
>  15 files changed, 600 insertions(+), 34 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
>  create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
>  create mode 100644 drivers/usb/misc/onboard_usb_hub.c
>  create mode 100644 include/linux/usb/onboard_hub.h
> 
> -- 
> 2.31.1.607.g51e8a6a459-goog
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver
  2021-05-12  7:19 ` [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Alexander Dahl
@ 2021-05-12 16:37   ` Matthias Kaehlcke
  0 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2021-05-12 16:37 UTC (permalink / raw)
  To: Alexander Dahl
  Cc: Greg Kroah-Hartman, Alan Stern, Rob Herring, Frank Rowand,
	Michal Simek, devicetree, Douglas Anderson, linux-usb,
	Peter Chen, linux-kernel, Stephen Boyd, Ravi Chandra Sadineni,
	Krzysztof Kozlowski, Bastien Nocera, Al Cooper,
	Alexander A. Klimov, Andy Gross, Bjorn Andersson,
	Christian Lamparter, Colin Ian King, Dmitry Osipenko,
	Fabio Estevam, Masahiro Yamada, Mathias Nyman, Vinod Koul,
	linux-arm-msm

Hi Alexander,

On Wed, May 12, 2021 at 09:19:54AM +0200, Alexander Dahl wrote:
> Hello Matthias,
> 
> just a curious informal question, see below.
> 
> Am Tue, May 11, 2021 at 03:52:18PM -0700 schrieb Matthias Kaehlcke:
> > This series adds:
> > - the onboard_usb_hub_driver
> > - glue in the xhci-plat driver to create the onboard_usb_hub
> >   platform device if needed
> > - a device tree binding for the Realtek RTS5411 USB hub controller
> > - device tree changes that add RTS5411 entries for the QCA SC7180
> >   based boards trogdor and lazor
> > - a couple of stubs for platform device functions to avoid
> >   unresolved symbols with certain kernel configs
> > 
> > The main issue the driver addresses is that a USB hub needs to be
> > powered before it can be discovered. For discrete onboard hubs (an
> > example for such a hub is the Realtek RTS5411) this is often solved
> > by supplying the hub with an 'always-on' regulator, which is kind
> > of a hack. Some onboard hubs may require further initialization
> > steps, like changing the state of a GPIO or enabling a clock, which
> > requires even more hacks. This driver creates a platform device
> > representing the hub which performs the necessary initialization.
> > Currently it only supports switching on a single regulator, support
> > for multiple regulators or other actions can be added as needed.
> > Different initialization sequences can be supported based on the
> > compatible string.
> 
> This sounds like it would be useful for other hub controllers as well?
> For example, would the Microchip USB3503 (former SMSC,
> drivers/usb/misc/usb3503.c, [1]) fall into this category? That chip is
> used on the "Cubietech Cubietruck Plus" for example.

usb3503.c provides two 'separate' USB3503 drivers (which share some
code), a i2c client driver and a platform driver. IIUC on a system with
an USB3503 only one of these drivers is used. Theoretically it should be
feasible to extend the onboard_usb_hub driver to cover the functionality
of the platform driver in usb3503.c (essentially to control GPIOs and
clocks at initialization time and suspend/resume). Another question is
whether that would be desirable, since the i2c and the platform driver
share code, which then would be duplicated in the i2c and onboard_usb_hub
driver, unless a way is found to keep sharing that code.

The i2c driver can't be completely replaced by the onboard_usb_hub
driver, due to the i2c communications. It might be possible to have the
i2c driver and the onboard_usb_hub collaborate, however I expect it
would take a certain effort to design and implement a solid solution.

Thanks

Matthias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver
  2021-05-11 22:52 [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Matthias Kaehlcke
  2021-05-11 22:52 ` [PATCH v10 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
  2021-05-12  7:19 ` [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Alexander Dahl
@ 2021-05-21 12:30 ` Greg Kroah-Hartman
  2021-05-25 17:42   ` Matthias Kaehlcke
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-21 12:30 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Alan Stern, Rob Herring, Frank Rowand, Michal Simek, devicetree,
	Douglas Anderson, linux-usb, Peter Chen, linux-kernel,
	Stephen Boyd, Ravi Chandra Sadineni, Krzysztof Kozlowski,
	Bastien Nocera, Al Cooper, Alexander A. Klimov, Andy Gross,
	Bjorn Andersson, Christian Lamparter, Colin Ian King,
	Dmitry Osipenko, Fabio Estevam, Masahiro Yamada, Mathias Nyman,
	Vinod Koul, linux-arm-msm

On Tue, May 11, 2021 at 03:52:18PM -0700, Matthias Kaehlcke wrote:
> This series adds:
> - the onboard_usb_hub_driver
> - glue in the xhci-plat driver to create the onboard_usb_hub
>   platform device if needed
> - a device tree binding for the Realtek RTS5411 USB hub controller
> - device tree changes that add RTS5411 entries for the QCA SC7180
>   based boards trogdor and lazor
> - a couple of stubs for platform device functions to avoid
>   unresolved symbols with certain kernel configs
> 
> The main issue the driver addresses is that a USB hub needs to be
> powered before it can be discovered. For discrete onboard hubs (an
> example for such a hub is the Realtek RTS5411) this is often solved
> by supplying the hub with an 'always-on' regulator, which is kind
> of a hack. Some onboard hubs may require further initialization
> steps, like changing the state of a GPIO or enabling a clock, which
> requires even more hacks. This driver creates a platform device
> representing the hub which performs the necessary initialization.
> Currently it only supports switching on a single regulator, support
> for multiple regulators or other actions can be added as needed.
> Different initialization sequences can be supported based on the
> compatible string.
> 
> Besides performing the initialization the driver can be configured
> to power the hub off during system suspend. This can help to extend
> battery life on battery powered devices which have no requirements
> to keep the hub powered during suspend. The driver can also be
> configured to leave the hub powered when a wakeup capable USB device
> is connected when suspending, and power it off otherwise.

I get a build error when I apply this series to my tree:

drivers/usb/misc/onboard_usb_hub.c:273:6: error: redefinition of ‘of_is_onboard_usb_hub’
  273 | bool of_is_onboard_usb_hub(const struct device_node *np)
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/misc/onboard_usb_hub.c:21:
./include/linux/usb/onboard_hub.h:9:20: note: previous definition of ‘of_is_onboard_usb_hub’ with type ‘bool(const struct device_node *)’ {aka ‘_Bool(const struct device_node *)’}
    9 | static inline bool of_is_onboard_usb_hub(const struct device_node *np)
      |                    ^~~~~~~~~~~~~~~~~~~~~

Any thoughts?

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver
  2021-05-21 12:30 ` Greg Kroah-Hartman
@ 2021-05-25 17:42   ` Matthias Kaehlcke
  0 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2021-05-25 17:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Stern, Rob Herring, Frank Rowand, Michal Simek, devicetree,
	Douglas Anderson, linux-usb, Peter Chen, linux-kernel,
	Stephen Boyd, Ravi Chandra Sadineni, Krzysztof Kozlowski,
	Bastien Nocera, Al Cooper, Alexander A. Klimov, Andy Gross,
	Bjorn Andersson, Christian Lamparter, Colin Ian King,
	Dmitry Osipenko, Fabio Estevam, Masahiro Yamada, Mathias Nyman,
	Vinod Koul, linux-arm-msm

On Fri, May 21, 2021 at 02:30:39PM +0200, Greg Kroah-Hartman wrote:
> On Tue, May 11, 2021 at 03:52:18PM -0700, Matthias Kaehlcke wrote:
> > This series adds:
> > - the onboard_usb_hub_driver
> > - glue in the xhci-plat driver to create the onboard_usb_hub
> >   platform device if needed
> > - a device tree binding for the Realtek RTS5411 USB hub controller
> > - device tree changes that add RTS5411 entries for the QCA SC7180
> >   based boards trogdor and lazor
> > - a couple of stubs for platform device functions to avoid
> >   unresolved symbols with certain kernel configs
> > 
> > The main issue the driver addresses is that a USB hub needs to be
> > powered before it can be discovered. For discrete onboard hubs (an
> > example for such a hub is the Realtek RTS5411) this is often solved
> > by supplying the hub with an 'always-on' regulator, which is kind
> > of a hack. Some onboard hubs may require further initialization
> > steps, like changing the state of a GPIO or enabling a clock, which
> > requires even more hacks. This driver creates a platform device
> > representing the hub which performs the necessary initialization.
> > Currently it only supports switching on a single regulator, support
> > for multiple regulators or other actions can be added as needed.
> > Different initialization sequences can be supported based on the
> > compatible string.
> > 
> > Besides performing the initialization the driver can be configured
> > to power the hub off during system suspend. This can help to extend
> > battery life on battery powered devices which have no requirements
> > to keep the hub powered during suspend. The driver can also be
> > configured to leave the hub powered when a wakeup capable USB device
> > is connected when suspending, and power it off otherwise.
> 
> I get a build error when I apply this series to my tree:
> 
> drivers/usb/misc/onboard_usb_hub.c:273:6: error: redefinition of ‘of_is_onboard_usb_hub’
>   273 | bool of_is_onboard_usb_hub(const struct device_node *np)
>       |      ^~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/usb/misc/onboard_usb_hub.c:21:
> ./include/linux/usb/onboard_hub.h:9:20: note: previous definition of ‘of_is_onboard_usb_hub’ with type ‘bool(const struct device_node *)’ {aka ‘_Bool(const struct device_node *)’}
>     9 | static inline bool of_is_onboard_usb_hub(const struct device_node *np)
>       |                    ^~~~~~~~~~~~~~~~~~~~~
> 
> Any thoughts?

That function keeps haunting me in different ways ...

I suspect this was a build with CONFIG_COMPILE_TEST=y. The driver is
compiled for such a config and has the actual implementation, however
the header defines the static inline unless CONFIG_USB_ONBOARD_HUB=y/m.

I realized earlier that the driver doesn't really need to include the
header, and planned to remove it in the next version, which might be
the most practical solution.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-25 17:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 22:52 [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Matthias Kaehlcke
2021-05-11 22:52 ` [PATCH v10 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
2021-05-12  7:19 ` [PATCH v10 0/5] USB: misc: Add onboard_usb_hub driver Alexander Dahl
2021-05-12 16:37   ` Matthias Kaehlcke
2021-05-21 12:30 ` Greg Kroah-Hartman
2021-05-25 17:42   ` Matthias Kaehlcke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).