linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] musb patches for v5.2-rc1
@ 2019-04-30 14:59 Bin Liu
  2019-04-30 14:59 ` [1/7] usb: musb: Silence error about blacklisting hubs if !CONFIG_USB Bin Liu
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

Hi Greg,

Here are the musb patches for v5.2 rc1. There are all small fixes or
improvements. Please let me know if any change is needed.

There is one of the patches marked for stable. I will send it to stable
tree later after they get into v5.2 rc.

Thanks,
-Bin.
---

Kefeng Wang (1):
  usb: musb: dsps: Use dev_get_drvdata()

Paul Cercueil (4):
  usb: musb: Silence error about blacklisting hubs if !CONFIG_USB
  dt-bindings: usb: Add usb-phy property to the jz4740-musb node
  usb: musb: jz4740: Let the platform probe the PHY
  usb: musb: jz4740: obtain USB PHY from devicetree

Samuel Holland (1):
  soc: sunxi: Fix missing dependency on REGMAP_MMIO

Tony Lindgren (1):
  usb: musb: omap2430: Add support for idling phy when musb is idle

 .../bindings/usb/ingenic,jz4740-musb.txt      |  8 ++++++++
 drivers/soc/sunxi/Kconfig                     |  1 +
 drivers/usb/musb/Kconfig                      |  2 +-
 drivers/usb/musb/jz4740.c                     | 19 +++++++------------
 drivers/usb/musb/musb_core.c                  |  9 +++++----
 drivers/usb/musb/musb_dsps.c                  |  6 ++----
 drivers/usb/musb/omap2430.c                   |  6 ++++++
 7 files changed, 30 insertions(+), 21 deletions(-)

-- 
2.17.1


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

* [1/7] usb: musb: Silence error about blacklisting hubs if !CONFIG_USB
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 1/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Some drivers, like jz4740-musb, don't depend on CONFIG_USB.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/musb_core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b7d56272f9d1..9f5a4819a744 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1497,10 +1497,11 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 	} else {
 		musb->is_multipoint = 0;
 		type = "";
-#ifndef	CONFIG_USB_OTG_BLACKLIST_HUB
-		pr_err("%s: kernel must blacklist external hubs\n",
-		       musb_driver_name);
-#endif
+		if (IS_ENABLED(CONFIG_USB) &&
+		    !IS_ENABLED(CONFIG_USB_OTG_BLACKLIST_HUB)) {
+			pr_err("%s: kernel must blacklist external hubs\n",
+			       musb_driver_name);
+		}
 	}
 
 	/* log release info */

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

* [PATCH 1/7] usb: musb: Silence error about blacklisting hubs if !CONFIG_USB
  2019-04-30 14:59 ` [1/7] usb: musb: Silence error about blacklisting hubs if !CONFIG_USB Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Some drivers, like jz4740-musb, don't depend on CONFIG_USB.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/musb_core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b7d56272f9d1..9f5a4819a744 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1497,10 +1497,11 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 	} else {
 		musb->is_multipoint = 0;
 		type = "";
-#ifndef	CONFIG_USB_OTG_BLACKLIST_HUB
-		pr_err("%s: kernel must blacklist external hubs\n",
-		       musb_driver_name);
-#endif
+		if (IS_ENABLED(CONFIG_USB) &&
+		    !IS_ENABLED(CONFIG_USB_OTG_BLACKLIST_HUB)) {
+			pr_err("%s: kernel must blacklist external hubs\n",
+			       musb_driver_name);
+		}
 	}
 
 	/* log release info */
-- 
2.17.1


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

* [2/7] usb: musb: omap2430: Add support for idling phy when musb is idle
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 2/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Tony Lindgren <tony@atomide.com>

I noticed that musb is blocking core retention for omap4 unlike for
omap3. This is because for omap3 we have phy-twl4030-usb implement
it's own PM runtime to handle errata "VUSB3V1 VBUS overvoltage
debouncer not working when the PHY is powered down". That is done
in order to keep the USB PHY powered when phy-twl4030-usb is loaded.

For the other USB PHYs, we need to enable and disable the PHY based on
musb PM runtime. With the session bit based PM runtime for musb core,
we can now idle the USB PHY always when musb is idle.

Note that adding these calls will not affect the twl4030 driver
as it's phy functions will just query the PHY state without powering
the PHY on or off.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/omap2430.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index b1dd81fb5f55..a3d2fef67746 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -531,6 +531,9 @@ static int omap2430_runtime_suspend(struct device *dev)
 
 	omap2430_low_level_exit(musb);
 
+	phy_power_off(musb->phy);
+	phy_exit(musb->phy);
+
 	return 0;
 }
 
@@ -542,6 +545,9 @@ static int omap2430_runtime_resume(struct device *dev)
 	if (!musb)
 		return 0;
 
+	phy_init(musb->phy);
+	phy_power_on(musb->phy);
+
 	omap2430_low_level_init(musb);
 	musb_writel(musb->mregs, OTG_INTERFSEL,
 		    musb->context.otg_interfsel);

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

* [PATCH 2/7] usb: musb: omap2430: Add support for idling phy when musb is idle
  2019-04-30 14:59 ` [2/7] usb: musb: omap2430: Add support for idling phy when musb is idle Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Tony Lindgren <tony@atomide.com>

I noticed that musb is blocking core retention for omap4 unlike for
omap3. This is because for omap3 we have phy-twl4030-usb implement
it's own PM runtime to handle errata "VUSB3V1 VBUS overvoltage
debouncer not working when the PHY is powered down". That is done
in order to keep the USB PHY powered when phy-twl4030-usb is loaded.

For the other USB PHYs, we need to enable and disable the PHY based on
musb PM runtime. With the session bit based PM runtime for musb core,
we can now idle the USB PHY always when musb is idle.

Note that adding these calls will not affect the twl4030 driver
as it's phy functions will just query the PHY state without powering
the PHY on or off.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/omap2430.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index b1dd81fb5f55..a3d2fef67746 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -531,6 +531,9 @@ static int omap2430_runtime_suspend(struct device *dev)
 
 	omap2430_low_level_exit(musb);
 
+	phy_power_off(musb->phy);
+	phy_exit(musb->phy);
+
 	return 0;
 }
 
@@ -542,6 +545,9 @@ static int omap2430_runtime_resume(struct device *dev)
 	if (!musb)
 		return 0;
 
+	phy_init(musb->phy);
+	phy_power_on(musb->phy);
+
 	omap2430_low_level_init(musb);
 	musb_writel(musb->mregs, OTG_INTERFSEL,
 		    musb->context.otg_interfsel);
-- 
2.17.1


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

* [3/7] soc: sunxi: Fix missing dependency on REGMAP_MMIO
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 3/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Samuel Holland <samuel@sholland.org>

When enabling ARCH_SUNXI from allnoconfig, SUNXI_SRAM is enabled, but
not REGMAP_MMIO, so the kernel fails to link with an undefined reference
to __devm_regmap_init_mmio_clk. Select REGMAP_MMIO, as suggested in
drivers/base/regmap/Kconfig.

This creates the following dependency loop:

  drivers/of/Kconfig:68:                symbol OF_IRQ depends on IRQ_DOMAIN
  kernel/irq/Kconfig:63:                symbol IRQ_DOMAIN is selected by REGMAP
  drivers/base/regmap/Kconfig:7:        symbol REGMAP default is visible depending on REGMAP_MMIO
  drivers/base/regmap/Kconfig:39:       symbol REGMAP_MMIO is selected by SUNXI_SRAM
  drivers/soc/sunxi/Kconfig:4:          symbol SUNXI_SRAM is selected by USB_MUSB_SUNXI
  drivers/usb/musb/Kconfig:63:          symbol USB_MUSB_SUNXI depends on GENERIC_PHY
  drivers/phy/Kconfig:7:                symbol GENERIC_PHY is selected by PHY_BCM_NS_USB3
  drivers/phy/broadcom/Kconfig:29:      symbol PHY_BCM_NS_USB3 depends on MDIO_BUS
  drivers/net/phy/Kconfig:12:           symbol MDIO_BUS default is visible depending on PHYLIB
  drivers/net/phy/Kconfig:181:          symbol PHYLIB is selected by ARC_EMAC_CORE
  drivers/net/ethernet/arc/Kconfig:18:  symbol ARC_EMAC_CORE is selected by ARC_EMAC
  drivers/net/ethernet/arc/Kconfig:24:  symbol ARC_EMAC depends on OF_IRQ

To fix the circular dependency, make USB_MUSB_SUNXI select GENERIC_PHY
instead of depending on it. This matches the use of GENERIC_PHY by all
but two other drivers.

Cc: <stable@vger.kernel.org> # 4.19
Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/soc/sunxi/Kconfig | 1 +
 drivers/usb/musb/Kconfig  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/sunxi/Kconfig b/drivers/soc/sunxi/Kconfig
index 353b07e40176..e84eb4e59f58 100644
--- a/drivers/soc/sunxi/Kconfig
+++ b/drivers/soc/sunxi/Kconfig
@@ -4,6 +4,7 @@
 config SUNXI_SRAM
 	bool
 	default ARCH_SUNXI
+	select REGMAP_MMIO
 	help
 	  Say y here to enable the SRAM controller support. This
 	  device is responsible on mapping the SRAM in the sunXi SoCs
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index f742fddc5e2c..52f8e2b57ad5 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -67,7 +67,7 @@ config USB_MUSB_SUNXI
 	depends on NOP_USB_XCEIV
 	depends on PHY_SUN4I_USB
 	depends on EXTCON
-	depends on GENERIC_PHY
+	select GENERIC_PHY
 	select SUNXI_SRAM
 
 config USB_MUSB_DAVINCI

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

* [PATCH 3/7] soc: sunxi: Fix missing dependency on REGMAP_MMIO
  2019-04-30 14:59 ` [3/7] soc: sunxi: Fix missing dependency on REGMAP_MMIO Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Samuel Holland <samuel@sholland.org>

When enabling ARCH_SUNXI from allnoconfig, SUNXI_SRAM is enabled, but
not REGMAP_MMIO, so the kernel fails to link with an undefined reference
to __devm_regmap_init_mmio_clk. Select REGMAP_MMIO, as suggested in
drivers/base/regmap/Kconfig.

This creates the following dependency loop:

  drivers/of/Kconfig:68:                symbol OF_IRQ depends on IRQ_DOMAIN
  kernel/irq/Kconfig:63:                symbol IRQ_DOMAIN is selected by REGMAP
  drivers/base/regmap/Kconfig:7:        symbol REGMAP default is visible depending on REGMAP_MMIO
  drivers/base/regmap/Kconfig:39:       symbol REGMAP_MMIO is selected by SUNXI_SRAM
  drivers/soc/sunxi/Kconfig:4:          symbol SUNXI_SRAM is selected by USB_MUSB_SUNXI
  drivers/usb/musb/Kconfig:63:          symbol USB_MUSB_SUNXI depends on GENERIC_PHY
  drivers/phy/Kconfig:7:                symbol GENERIC_PHY is selected by PHY_BCM_NS_USB3
  drivers/phy/broadcom/Kconfig:29:      symbol PHY_BCM_NS_USB3 depends on MDIO_BUS
  drivers/net/phy/Kconfig:12:           symbol MDIO_BUS default is visible depending on PHYLIB
  drivers/net/phy/Kconfig:181:          symbol PHYLIB is selected by ARC_EMAC_CORE
  drivers/net/ethernet/arc/Kconfig:18:  symbol ARC_EMAC_CORE is selected by ARC_EMAC
  drivers/net/ethernet/arc/Kconfig:24:  symbol ARC_EMAC depends on OF_IRQ

To fix the circular dependency, make USB_MUSB_SUNXI select GENERIC_PHY
instead of depending on it. This matches the use of GENERIC_PHY by all
but two other drivers.

Cc: <stable@vger.kernel.org> # 4.19
Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/soc/sunxi/Kconfig | 1 +
 drivers/usb/musb/Kconfig  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/sunxi/Kconfig b/drivers/soc/sunxi/Kconfig
index 353b07e40176..e84eb4e59f58 100644
--- a/drivers/soc/sunxi/Kconfig
+++ b/drivers/soc/sunxi/Kconfig
@@ -4,6 +4,7 @@
 config SUNXI_SRAM
 	bool
 	default ARCH_SUNXI
+	select REGMAP_MMIO
 	help
 	  Say y here to enable the SRAM controller support. This
 	  device is responsible on mapping the SRAM in the sunXi SoCs
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index f742fddc5e2c..52f8e2b57ad5 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -67,7 +67,7 @@ config USB_MUSB_SUNXI
 	depends on NOP_USB_XCEIV
 	depends on PHY_SUN4I_USB
 	depends on EXTCON
-	depends on GENERIC_PHY
+	select GENERIC_PHY
 	select SUNXI_SRAM
 
 config USB_MUSB_DAVINCI
-- 
2.17.1


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

* [4/7] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 4/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
from devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 .../devicetree/bindings/usb/ingenic,jz4740-musb.txt       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
index 620355cee63f..16808721f3ff 100644
--- a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
+++ b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
@@ -8,9 +8,15 @@ Required properties:
 - interrupt-names: must be "mc"
 - clocks: phandle to the "udc" clock
 - clock-names: must be "udc"
+- phys: phandle to the USB PHY
 
 Example:
 
+usb_phy: usb-phy@0 {
+	compatible = "usb-nop-xceiv";
+	#phy-cells = <0>;
+};
+
 udc: usb@13040000 {
 	compatible = "ingenic,jz4740-musb";
 	reg = <0x13040000 0x10000>;
@@ -21,4 +27,6 @@ udc: usb@13040000 {
 
 	clocks = <&cgu JZ4740_CLK_UDC>;
 	clock-names = "udc";
+
+	phys = <&usb_phy>;
 };

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

* [PATCH 4/7] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
  2019-04-30 14:59 ` [4/7] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
from devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 .../devicetree/bindings/usb/ingenic,jz4740-musb.txt       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
index 620355cee63f..16808721f3ff 100644
--- a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
+++ b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
@@ -8,9 +8,15 @@ Required properties:
 - interrupt-names: must be "mc"
 - clocks: phandle to the "udc" clock
 - clock-names: must be "udc"
+- phys: phandle to the USB PHY
 
 Example:
 
+usb_phy: usb-phy@0 {
+	compatible = "usb-nop-xceiv";
+	#phy-cells = <0>;
+};
+
 udc: usb@13040000 {
 	compatible = "ingenic,jz4740-musb";
 	reg = <0x13040000 0x10000>;
@@ -21,4 +27,6 @@ udc: usb@13040000 {
 
 	clocks = <&cgu JZ4740_CLK_UDC>;
 	clock-names = "udc";
+
+	phys = <&usb_phy>;
 };
-- 
2.17.1


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

* [5/7] usb: musb: jz4740: Let the platform probe the PHY
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 5/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

By registering a generic USB PHY from within the driver, we may shadow
the USB PHY registered by the platform, which might be different.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/jz4740.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index a60627bf7be3..ad35e09f90bd 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -74,7 +74,6 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
 
 static int jz4740_musb_init(struct musb *musb)
 {
-	usb_phy_generic_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR(musb->xceiv)) {
 		pr_err("HS UDC: no transceiver configured\n");
@@ -183,7 +182,6 @@ static int jz4740_remove(struct platform_device *pdev)
 	struct jz4740_glue	*glue = platform_get_drvdata(pdev);
 
 	platform_device_unregister(glue->musb);
-	usb_phy_generic_unregister(pdev);
 	clk_disable_unprepare(glue->clk);
 
 	return 0;

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

* [PATCH 5/7] usb: musb: jz4740: Let the platform probe the PHY
  2019-04-30 14:59 ` [5/7] usb: musb: jz4740: Let the platform probe the PHY Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

By registering a generic USB PHY from within the driver, we may shadow
the USB PHY registered by the platform, which might be different.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/jz4740.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index a60627bf7be3..ad35e09f90bd 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -74,7 +74,6 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
 
 static int jz4740_musb_init(struct musb *musb)
 {
-	usb_phy_generic_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR(musb->xceiv)) {
 		pr_err("HS UDC: no transceiver configured\n");
@@ -183,7 +182,6 @@ static int jz4740_remove(struct platform_device *pdev)
 	struct jz4740_glue	*glue = platform_get_drvdata(pdev);
 
 	platform_device_unregister(glue->musb);
-	usb_phy_generic_unregister(pdev);
 	clk_disable_unprepare(glue->clk);
 
 	return 0;
-- 
2.17.1


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

* [6/7] usb: musb: jz4740: obtain USB PHY from devicetree
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 6/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Fall back to devm_usb_get_phy() if devicetree is not available.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/jz4740.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index ad35e09f90bd..5261f8dfedec 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -74,9 +74,14 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
 
 static int jz4740_musb_init(struct musb *musb)
 {
-	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+	struct device *dev = musb->controller->parent;
+
+	if (dev->of_node)
+		musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0);
+	else
+		musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(musb->xceiv)) {
-		pr_err("HS UDC: no transceiver configured\n");
+		dev_err(dev, "No transceiver configured\n");
 		return PTR_ERR(musb->xceiv);
 	}
 
@@ -90,13 +95,6 @@ static int jz4740_musb_init(struct musb *musb)
 	return 0;
 }
 
-static int jz4740_musb_exit(struct musb *musb)
-{
-	usb_put_phy(musb->xceiv);
-
-	return 0;
-}
-
 /*
  * DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA,
  * so let's not set up the dma function pointers yet.
@@ -105,7 +103,6 @@ static const struct musb_platform_ops jz4740_musb_ops = {
 	.quirks		= MUSB_DMA_INVENTRA | MUSB_INDEXED_EP,
 	.fifo_mode	= 2,
 	.init		= jz4740_musb_init,
-	.exit		= jz4740_musb_exit,
 };
 
 static int jz4740_probe(struct platform_device *pdev)

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

* [PATCH 6/7] usb: musb: jz4740: obtain USB PHY from devicetree
  2019-04-30 14:59 ` [6/7] usb: musb: jz4740: obtain USB PHY from devicetree Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Paul Cercueil <paul@crapouillou.net>

Fall back to devm_usb_get_phy() if devicetree is not available.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/jz4740.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index ad35e09f90bd..5261f8dfedec 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -74,9 +74,14 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
 
 static int jz4740_musb_init(struct musb *musb)
 {
-	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+	struct device *dev = musb->controller->parent;
+
+	if (dev->of_node)
+		musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0);
+	else
+		musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(musb->xceiv)) {
-		pr_err("HS UDC: no transceiver configured\n");
+		dev_err(dev, "No transceiver configured\n");
 		return PTR_ERR(musb->xceiv);
 	}
 
@@ -90,13 +95,6 @@ static int jz4740_musb_init(struct musb *musb)
 	return 0;
 }
 
-static int jz4740_musb_exit(struct musb *musb)
-{
-	usb_put_phy(musb->xceiv);
-
-	return 0;
-}
-
 /*
  * DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA,
  * so let's not set up the dma function pointers yet.
@@ -105,7 +103,6 @@ static const struct musb_platform_ops jz4740_musb_ops = {
 	.quirks		= MUSB_DMA_INVENTRA | MUSB_INDEXED_EP,
 	.fifo_mode	= 2,
 	.init		= jz4740_musb_init,
-	.exit		= jz4740_musb_exit,
 };
 
 static int jz4740_probe(struct platform_device *pdev)
-- 
2.17.1


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

* [7/7] usb: musb: dsps: Use dev_get_drvdata()
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 14:59   ` [PATCH 7/7] " Bin Liu
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Kefeng Wang <wangkefeng.wang@huawei.com>

Using dev_get_drvdata directly.

Cc: Bin Liu <b-liu@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/musb_dsps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 403eb97915f8..327d4f7baaf7 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -168,8 +168,7 @@ static void dsps_mod_timer_optional(struct dsps_glue *glue)
 static void dsps_musb_enable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 	u32 epmask, coremask;
@@ -195,8 +194,7 @@ static void dsps_musb_enable(struct musb *musb)
 static void dsps_musb_disable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 

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

* [PATCH 7/7] usb: musb: dsps: Use dev_get_drvdata()
  2019-04-30 14:59 ` [7/7] usb: musb: dsps: Use dev_get_drvdata() Bin Liu
@ 2019-04-30 14:59   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

From: Kefeng Wang <wangkefeng.wang@huawei.com>

Using dev_get_drvdata directly.

Cc: Bin Liu <b-liu@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/musb_dsps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 403eb97915f8..327d4f7baaf7 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -168,8 +168,7 @@ static void dsps_mod_timer_optional(struct dsps_glue *glue)
 static void dsps_musb_enable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 	u32 epmask, coremask;
@@ -195,8 +194,7 @@ static void dsps_musb_enable(struct musb *musb)
 static void dsps_musb_disable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 
-- 
2.17.1


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

* [PATCH 0/6] musb patches for v5.2-rc1
  2019-04-30 14:59 [PATCH 0/7] musb patches for v5.2-rc1 Bin Liu
                   ` (6 preceding siblings ...)
  2019-04-30 14:59 ` [7/7] usb: musb: dsps: Use dev_get_drvdata() Bin Liu
@ 2019-04-30 14:59 ` Bin Liu
  2019-04-30 15:02   ` Bin Liu
  7 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2019-04-30 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu

Hi Greg,

Here are the musb patches for v5.2 rc1. There are all small fixes or
improvements. Please let me know if any change is needed.

There is one of the patches marked for stable. I will send it to stable
tree later after they get into v5.2 rc.

Thanks,
-Bin.
---

Kefeng Wang (1):
  usb: musb: dsps: Use dev_get_drvdata()

Paul Cercueil (3):
  dt-bindings: usb: Add usb-phy property to the jz4740-musb node
  usb: musb: jz4740: Let the platform probe the PHY
  usb: musb: jz4740: obtain USB PHY from devicetree

Samuel Holland (1):
  soc: sunxi: Fix missing dependency on REGMAP_MMIO

Tony Lindgren (1):
  usb: musb: omap2430: Add support for idling phy when musb is idle

 .../bindings/usb/ingenic,jz4740-musb.txt      |  8 ++++++++
 drivers/soc/sunxi/Kconfig                     |  1 +
 drivers/usb/musb/Kconfig                      |  2 +-
 drivers/usb/musb/jz4740.c                     | 19 +++++++------------
 drivers/usb/musb/musb_dsps.c                  |  6 ++----
 drivers/usb/musb/omap2430.c                   |  6 ++++++
 6 files changed, 25 insertions(+), 17 deletions(-)

-- 
2.17.1


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

* Re: [PATCH 0/6] musb patches for v5.2-rc1
  2019-04-30 14:59 ` [PATCH 0/6] musb patches for v5.2-rc1 Bin Liu
@ 2019-04-30 15:02   ` Bin Liu
  0 siblings, 0 replies; 17+ messages in thread
From: Bin Liu @ 2019-04-30 15:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb

Please ignore this specific email. Sorry for the noise.

-Bin.

On Tue, Apr 30, 2019 at 09:59:42AM -0500, Bin Liu wrote:
> Hi Greg,
> 
> Here are the musb patches for v5.2 rc1. There are all small fixes or
> improvements. Please let me know if any change is needed.
> 
> There is one of the patches marked for stable. I will send it to stable
> tree later after they get into v5.2 rc.
> 
> Thanks,
> -Bin.
> ---
> 
> Kefeng Wang (1):
>   usb: musb: dsps: Use dev_get_drvdata()
> 
> Paul Cercueil (3):
>   dt-bindings: usb: Add usb-phy property to the jz4740-musb node
>   usb: musb: jz4740: Let the platform probe the PHY
>   usb: musb: jz4740: obtain USB PHY from devicetree
> 
> Samuel Holland (1):
>   soc: sunxi: Fix missing dependency on REGMAP_MMIO
> 
> Tony Lindgren (1):
>   usb: musb: omap2430: Add support for idling phy when musb is idle
> 
>  .../bindings/usb/ingenic,jz4740-musb.txt      |  8 ++++++++
>  drivers/soc/sunxi/Kconfig                     |  1 +
>  drivers/usb/musb/Kconfig                      |  2 +-
>  drivers/usb/musb/jz4740.c                     | 19 +++++++------------
>  drivers/usb/musb/musb_dsps.c                  |  6 ++----
>  drivers/usb/musb/omap2430.c                   |  6 ++++++
>  6 files changed, 25 insertions(+), 17 deletions(-)
> 
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2019-04-30 15:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 14:59 [PATCH 0/7] musb patches for v5.2-rc1 Bin Liu
2019-04-30 14:59 ` [1/7] usb: musb: Silence error about blacklisting hubs if !CONFIG_USB Bin Liu
2019-04-30 14:59   ` [PATCH 1/7] " Bin Liu
2019-04-30 14:59 ` [2/7] usb: musb: omap2430: Add support for idling phy when musb is idle Bin Liu
2019-04-30 14:59   ` [PATCH 2/7] " Bin Liu
2019-04-30 14:59 ` [3/7] soc: sunxi: Fix missing dependency on REGMAP_MMIO Bin Liu
2019-04-30 14:59   ` [PATCH 3/7] " Bin Liu
2019-04-30 14:59 ` [4/7] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Bin Liu
2019-04-30 14:59   ` [PATCH 4/7] " Bin Liu
2019-04-30 14:59 ` [5/7] usb: musb: jz4740: Let the platform probe the PHY Bin Liu
2019-04-30 14:59   ` [PATCH 5/7] " Bin Liu
2019-04-30 14:59 ` [6/7] usb: musb: jz4740: obtain USB PHY from devicetree Bin Liu
2019-04-30 14:59   ` [PATCH 6/7] " Bin Liu
2019-04-30 14:59 ` [7/7] usb: musb: dsps: Use dev_get_drvdata() Bin Liu
2019-04-30 14:59   ` [PATCH 7/7] " Bin Liu
2019-04-30 14:59 ` [PATCH 0/6] musb patches for v5.2-rc1 Bin Liu
2019-04-30 15:02   ` Bin Liu

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).