* [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
from devicetree.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Documentation/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..23213779f193 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"
+- usb-phy: 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";
+
+ usb-phy = <&usb_phy>;
};
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
from devicetree.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Documentation/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..23213779f193 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"
+- usb-phy: 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";
+
+ usb-phy = <&usb_phy>;
};
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] usb: musb: jz4740: Let the platform probe the PHY
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
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>
---
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.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [2/3] usb: musb: jz4740: Let the platform probe the PHY
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
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>
---
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] 8+ messages in thread
* [PATCH 3/3] usb: musb: jz4740: obtain USB PHY from devicetree
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
Fall back to devm_usb_get_phy() if devicetree is not available.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
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..e4dbf76548c0 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, "usb-phy", 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.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [3/3] usb: musb: jz4740: obtain USB PHY from devicetree
@ 2019-03-21 15:09 ` Paul Cercueil
0 siblings, 0 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-03-21 15:09 UTC (permalink / raw)
To: Bin Liu, Rob Herring, Mark Rutland
Cc: linux-usb, devicetree, linux-kernel, od, Paul Cercueil
Fall back to devm_usb_get_phy() if devicetree is not available.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
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..e4dbf76548c0 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, "usb-phy", 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] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
@ 2019-03-31 6:41 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2019-03-31 6:41 UTC (permalink / raw)
To: Paul Cercueil
Cc: Bin Liu, Mark Rutland, linux-usb, devicetree, linux-kernel, od
On Thu, Mar 21, 2019 at 04:09:54PM +0100, Paul Cercueil wrote:
> Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
> from devicetree.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> Documentation/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..23213779f193 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"
> +- usb-phy: phandle to the USB PHY
'phys' is the standard property name now.
>
> 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";
> +
> + usb-phy = <&usb_phy>;
> };
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node
@ 2019-03-31 6:41 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2019-03-31 6:41 UTC (permalink / raw)
To: Paul Cercueil
Cc: Bin Liu, Mark Rutland, linux-usb, devicetree, linux-kernel, od
On Thu, Mar 21, 2019 at 04:09:54PM +0100, Paul Cercueil wrote:
> Add a required 'usb-phy' property, to obtain a phandle to the USB PHY
> from devicetree.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> Documentation/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..23213779f193 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"
> +- usb-phy: phandle to the USB PHY
'phys' is the standard property name now.
>
> 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";
> +
> + usb-phy = <&usb_phy>;
> };
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-03-31 6:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 15:09 [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Paul Cercueil
2019-03-21 15:09 ` [1/3] " Paul Cercueil
2019-03-21 15:09 ` [PATCH 2/3] usb: musb: jz4740: Let the platform probe the PHY Paul Cercueil
2019-03-21 15:09 ` [2/3] " Paul Cercueil
2019-03-21 15:09 ` [PATCH 3/3] usb: musb: jz4740: obtain USB PHY from devicetree Paul Cercueil
2019-03-21 15:09 ` [3/3] " Paul Cercueil
2019-03-31 6:41 ` [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Rob Herring
2019-03-31 6:41 ` [1/3] " Rob Herring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.