All of lore.kernel.org
 help / color / mirror / Atom feed
* [1/3] USB: musb: dsps: drop duplicate phy initialisation
  2018-04-13 15:15 [PATCH 0/3] USB: musb: dsps: phy fix and DT-topology support Johan Hovold
@ 2018-04-13 15:15 ` Johan Hovold
  2018-04-18 19:18 ` Martin Blumenstingl
  1 sibling, 0 replies; 19+ messages in thread
From: Johan Hovold @ 2018-04-13 15:15 UTC (permalink / raw)
  To: Bin Liu
  Cc: Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel, Johan Hovold, Uwe Kleine-König

Since commit 39cee200c23e ("usb: musb: core: call init and shutdown for
the usb phy") the musb USB phy is initialised by musb_core, but the
original initialisation in the dsps-glue init callback was left in
place resulting in two calls to phy init during probe (and similarly,
two shutdowns on remove).

Drop the duplicate phy init and shutdown calls from the dsps glue in
favour of the ones in musb core, which other glue drivers rely on.

Note however that any generic phy is still initialised in the glue init
callback (just as for the other drivers).

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/musb/musb_dsps.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 05a679d5e3a2..6a60bc0490c5 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -451,7 +451,6 @@ static int dsps_musb_init(struct musb *musb)
 	if (!rev)
 		return -ENODEV;
 
-	usb_phy_init(musb->xceiv);
 	if (IS_ERR(musb->phy))  {
 		musb->phy = NULL;
 	} else {
@@ -501,7 +500,6 @@ static int dsps_musb_exit(struct musb *musb)
 	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 
 	del_timer_sync(&musb->dev_timer);
-	usb_phy_shutdown(musb->xceiv);
 	phy_power_off(musb->phy);
 	phy_exit(musb->phy);
 	debugfs_remove_recursive(glue->dbgfs_root);

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [3/3] USB: musb: dsps: propagate device-tree node
  2018-04-16 20:03 ` [PATCH 3/3] " Bin Liu
@ 2018-04-17  7:07 ` Johan Hovold
  -1 siblings, 0 replies; 19+ messages in thread
From: Johan Hovold @ 2018-04-17  7:07 UTC (permalink / raw)
  To: Bin Liu
  Cc: Johan Hovold, Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel

On Mon, Apr 16, 2018 at 03:03:12PM -0500, Bin Liu wrote:
> Johan,
> 
> On Fri, Apr 13, 2018 at 05:15:05PM +0200, Johan Hovold wrote:
> > To be able to use DSPS-based controllers with device-tree descriptions
> > of the USB topology, we need to associate the glue device's device-tree
> > node with the child controller device.
> > 
> > Note that this can also be used to eventually let USB core manage
> > generic phys.
> > 
> > Also note that the other glue drivers will require similar changes to be
> > able to describe their buses in DT.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> 
> I will take other two patches for v4.17 rc cycles, but is there any
> problem if I take this patch for v4.18-rc1?

None at all. That sounds good to me.

Thanks,
Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [3/3] USB: musb: dsps: propagate device-tree node
  2018-04-13 15:15 ` [PATCH 3/3] " Johan Hovold
@ 2018-04-16 20:03 ` Bin Liu
  -1 siblings, 0 replies; 19+ messages in thread
From: Bin Liu @ 2018-04-16 20:03 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel

Johan,

On Fri, Apr 13, 2018 at 05:15:05PM +0200, Johan Hovold wrote:
> To be able to use DSPS-based controllers with device-tree descriptions
> of the USB topology, we need to associate the glue device's device-tree
> node with the child controller device.
> 
> Note that this can also be used to eventually let USB core manage
> generic phys.
> 
> Also note that the other glue drivers will require similar changes to be
> able to describe their buses in DT.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

I will take other two patches for v4.17 rc cycles, but is there any
problem if I take this patch for v4.18-rc1?

Regards,
-Bin.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [1/3] USB: musb: dsps: drop duplicate phy initialisation
  2018-04-13 15:15 ` [PATCH 1/3] " Johan Hovold
@ 2018-04-13 18:45 ` Uwe Kleine-König
  -1 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2018-04-13 18:45 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Bin Liu, Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel, kernel

On Fri, Apr 13, 2018 at 05:15:03PM +0200, Johan Hovold wrote:
> Since commit 39cee200c23e ("usb: musb: core: call init and shutdown for
> the usb phy") the musb USB phy is initialised by musb_core, but the
> original initialisation in the dsps-glue init callback was left in
> place resulting in two calls to phy init during probe (and similarly,
> two shutdowns on remove).
> 
> Drop the duplicate phy init and shutdown calls from the dsps glue in
> favour of the ones in musb core, which other glue drivers rely on.

Hmm, I don't remember the details of my debug session that led to
39cee200c23e, and I don't have access to the hardware in question any
more.

But your commit logs makes sense, so

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Given that it took 2+ years to find this, backporting to stable and a
Fixes: line are probably not necessary.

Best regards
Uwe

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [3/3] USB: musb: dsps: propagate device-tree node
  2018-04-13 15:15 [PATCH 0/3] USB: musb: dsps: phy fix and DT-topology support Johan Hovold
@ 2018-04-13 15:15 ` Johan Hovold
  2018-04-18 19:18 ` Martin Blumenstingl
  1 sibling, 0 replies; 19+ messages in thread
From: Johan Hovold @ 2018-04-13 15:15 UTC (permalink / raw)
  To: Bin Liu
  Cc: Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel, Johan Hovold

To be able to use DSPS-based controllers with device-tree descriptions
of the USB topology, we need to associate the glue device's device-tree
node with the child controller device.

Note that this can also be used to eventually let USB core manage
generic phys.

Also note that the other glue drivers will require similar changes to be
able to describe their buses in DT.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/musb/musb_dsps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 6a60bc0490c5..23dba59045a7 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -786,6 +786,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	musb->dev.parent		= dev;
 	musb->dev.dma_mask		= &musb_dmamask;
 	musb->dev.coherent_dma_mask	= musb_dmamask;
+	device_set_of_node_from_dev(&musb->dev, &parent->dev);
 
 	glue->musb = musb;
 

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [2/3] USB: musb: host: prevent core phy initialisation
  2018-04-13 15:15 [PATCH 0/3] USB: musb: dsps: phy fix and DT-topology support Johan Hovold
@ 2018-04-13 15:15 ` Johan Hovold
  2018-04-18 19:18 ` Martin Blumenstingl
  1 sibling, 0 replies; 19+ messages in thread
From: Johan Hovold @ 2018-04-13 15:15 UTC (permalink / raw)
  To: Bin Liu
  Cc: Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel, Johan Hovold

Set the new HCD flag which prevents USB core from trying to manage our
phys.

This is needed to be able to associate the controller platform device
with the glue device device-tree node on the BBB which uses legacy USB
phys. Otherwise, the generic phy lookup in usb_phy_roothub_init() and
thus HCD registration fails repeatedly with -EPROBE_DEFER (see commit
178a0bce05cb ("usb: core: hcd: integrate the PHY wrapper into the HCD
core")).

Note that a related phy-lookup issue was recently worked around in the
phy core by commit b7563e2796f8 ("phy: work around 'phys' references to
usb-nop-xceiv devices"). Something similar may now be needed for other
USB phys, and in particular if we eventually want to let USB core manage
musb generic phys.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/musb/musb_host.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 3a8451a15f7f..4fa372c845e1 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2754,6 +2754,7 @@ int musb_host_setup(struct musb *musb, int power_budget)
 	hcd->self.otg_port = 1;
 	musb->xceiv->otg->host = &hcd->self;
 	hcd->power_budget = 2 * (power_budget ? : 250);
+	hcd->skip_phy_initialization = 1;
 
 	ret = usb_add_hcd(hcd, 0, 0);
 	if (ret < 0)

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [PATCH 0/3] USB: musb: dsps: phy fix and DT-topology support
@ 2018-04-13 15:15 Johan Hovold
  2018-04-18 16:20 ` Bin Liu
  2018-04-18 19:18 ` Martin Blumenstingl
  0 siblings, 2 replies; 19+ messages in thread
From: Johan Hovold @ 2018-04-13 15:15 UTC (permalink / raw)
  To: Bin Liu
  Cc: Greg Kroah-Hartman, Alan Stern, Arnd Bergmann,
	Kishon Vijay Abraham I, Martin Blumenstingl, linux-usb,
	linux-kernel, Johan Hovold

I've been carrying a patch out-of-tree since my work on improving the
USB device-tree support which is needed to be able to describe USB
topologies for musb based controllers.

This patch, which associates the platform controller device with the
glue device device-tree node, did not play well with the recent changes
which added generic phy support to USB core however.

Like the recent dwc2 regression fixed by Arnd after the device-tree
#phy-cell changes, the generic phy code in USB core can now also fail
indefinitly with -EPROBE_DEFER when the controller uses a legacy USB
phy.

The second patch addresses this for musb, which handles its own (legacy
and generic) phys, but something more may possibly now be needed for
other platforms with legacy phys.

In the process of debugging this, I stumbled over another issue which
caused the dsps legacy phy init two be called twice on every probe and
which is fixed by the first patch.

Johan


Johan Hovold (3):
  USB: musb: dsps: drop duplicate phy initialisation
  USB: musb: host: prevent core phy initialisation
  USB: musb: dsps: propagate device-tree node

 drivers/usb/musb/musb_dsps.c | 3 +--
 drivers/usb/musb/musb_host.c | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.17.0


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

end of thread, other threads:[~2018-04-19 21:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-13 15:15 [1/3] USB: musb: dsps: drop duplicate phy initialisation Johan Hovold
2018-04-13 15:15 ` [PATCH 1/3] " Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2018-04-17  7:07 [3/3] USB: musb: dsps: propagate device-tree node Johan Hovold
2018-04-17  7:07 ` [PATCH 3/3] " Johan Hovold
2018-04-16 20:03 [3/3] " Bin Liu
2018-04-16 20:03 ` [PATCH 3/3] " Bin Liu
2018-04-13 18:45 [1/3] USB: musb: dsps: drop duplicate phy initialisation Uwe Kleine-König
2018-04-13 18:45 ` [PATCH 1/3] " Uwe Kleine-König
2018-04-13 15:15 [3/3] USB: musb: dsps: propagate device-tree node Johan Hovold
2018-04-13 15:15 ` [PATCH 3/3] " Johan Hovold
2018-04-13 15:15 [2/3] USB: musb: host: prevent core phy initialisation Johan Hovold
2018-04-13 15:15 ` [PATCH 2/3] " Johan Hovold
2018-04-13 15:15 [PATCH 0/3] USB: musb: dsps: phy fix and DT-topology support Johan Hovold
2018-04-18 16:20 ` Bin Liu
2018-04-18 18:46   ` Johan Hovold
2018-04-18 18:56     ` Bin Liu
2018-04-18 19:18 ` Martin Blumenstingl
2018-04-19  7:43   ` Johan Hovold
2018-04-19 21:54     ` Martin Blumenstingl

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.