public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	Andreas Kemnade <andreas-cLv4Z9ELZ06ZuzBka8ofvg@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv2] usb: musb: Fix unbalanced platform_disable
Date: Mon, 19 Sep 2016 23:35:54 +0300	[thread overview]
Message-ID: <2377851.ZR7UYeyr7h@avalon> (raw)
In-Reply-To: <20160918151901.k7go65s4jauldxcl-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 3950 bytes --]

Hi Tony,

On Sunday 18 Sep 2016 08:19:02 Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org> [160918 05:13]:
> > FYI, while this patch allows me to boot my Panda board with NFS over
> > usbnet, it only works with cold boots. A warm reboot results in the
> > following warning, and no ethernet traffic going through. The USB device
> > is detected by the host though.
> 
> Yeah I noticed too that we still have issues. For example doing rmmod of
> omap2430 with gadget configured and connected will produce a hardirq-safe
> hardirq-unsafe lock order error. That also happens with reboot with gadget
> configured and connected.
> 
> > I'm not sure whether this is a regression introduced by commit
> > a83e17d0f73b ("usb: musb: Improve PM runtime and phy handling for 2430
> > glue layer") or an entirely different issue;
> 
> ...
> 
> > [    5.711303] [<c0872788>] (_raw_spin_unlock_irqrestore) from
> > [<c069b260>]
> > (musb_gadget_queue+0x128/0x4ac)
> > [    5.711303] [<c069b260>] (musb_gadget_queue) from [<c06a9ae4>]
> > (usb_ep_queue+0x38/0x1d4)
> > [    5.729766] [<c06a9ae4>] (usb_ep_queue) from [<c06aba40>]
> > (rx_submit+0xc8/0x19c)
> > [    5.737548] [<c06aba40>] (rx_submit) from [<c06abb90>]
> > (rx_fill+0x7c/0xa0) [    5.737548] [<c06abb90>] (rx_fill) from
> > [<c06abbdc>] (eth_start+0x28/0x48) [    5.751983] [<c06abbdc>]
> > (eth_start) from [<c06abe7c>] (eth_open+0x6c/0x7c) [    5.751983]
> > [<c06abe7c>] (eth_open) from [<c0778c2c>]
> > (__dev_open+0x9c/0x104)
> 
> This could be something else though. Care to email me your .config, maybe
> this is related to legacy g_ether being built in?

Sure, please find it attached. The legacy g_ether is indeed built-in, that's 
what I use to boot over nfsroot.

> Anyways, please also give the following patch a try.

I've tested the patch and if fixes the original problem. Warm reboots are 
still broken though.

> The reason why we
> currently have no chance of getting musb_platform_enable/disable balanced
> is because we need to try to set the musb devctl session bit in various
> places and possibly retry too. So musb_start should really be called
> musb_try_start_session() or something.
> 
> So I think the only sane thing to do at this point is to revert the changes
> trying to enable/disable USB PHY from omap2430_musb_enable/disable. The
> other fixes are OK too as they get us a bit closer to making the platform
> glue calls balanced.
> 
> Regards,
> 
> Tony
> 
> 8< ----------------------
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -337,6 +337,7 @@ static int omap2430_musb_init(struct musb *musb)
>  	}
>  	musb->isr = omap2430_musb_interrupt;
>  	phy_init(musb->phy);
> +	phy_power_on(musb->phy);
> 
>  	l = musb_readl(musb->mregs, OTG_INTERFSEL);
> 
> @@ -373,9 +374,6 @@ static void omap2430_musb_enable(struct musb *musb)
>  	struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev);
>  	struct omap_musb_board_data *data = pdata->board_data;
> 
> -	if (!WARN_ON(!musb->phy))
> -		phy_power_on(musb->phy);
> -
>  	omap2430_set_power(musb, true, glue->cable_connected);
> 
>  	switch (glue->status) {
> @@ -413,9 +411,6 @@ static void omap2430_musb_disable(struct musb *musb)
>  	struct device *dev = musb->controller;
>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
> 
> -	if (!WARN_ON(!musb->phy))
> -		phy_power_off(musb->phy);
> -
>  	if (glue->status != MUSB_UNKNOWN)
>  		omap_control_usb_set_mode(glue->control_otghs,
>  			USB_MODE_DISCONNECT);
> @@ -429,6 +424,7 @@ static int omap2430_musb_exit(struct musb *musb)
>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
> 
>  	omap2430_low_level_exit(musb);
> +	phy_power_off(musb->phy);
>  	phy_exit(musb->phy);
>  	musb->phy = NULL;
>  	cancel_work_sync(&glue->omap_musb_mailbox_work);

-- 
Regards,

Laurent Pinchart

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25879 bytes --]

  parent reply	other threads:[~2016-09-19 20:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 15:39 [PATCHv2] usb: musb: Fix unbalanced platform_disable Tony Lindgren
     [not found] ` <20160912153947.k4gnggur6usyujii-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-12 16:54   ` Bin Liu
2016-09-12 17:19     ` Tony Lindgren
     [not found]       ` <20160912171938.5fmx2qi6xtzsohpy-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-12 17:32         ` Bin Liu
2016-09-12 17:34           ` Bin Liu
2016-09-12 17:34         ` Tony Lindgren
     [not found]           ` <20160912173406.6qalsmolsylc2suq-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-12 18:05             ` Andreas Kemnade
2016-09-12 18:12               ` Tony Lindgren
     [not found]                 ` <20160912181229.nl56kapwcfok352b-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-12 18:33                   ` Tony Lindgren
2016-09-12 18:35               ` Bin Liu
2016-09-13  3:18                 ` Tony Lindgren
     [not found]                   ` <20160913031805.m5nzyqyclh4pyj6k-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-13 14:14                     ` Bin Liu
2016-09-13 14:32                       ` Laurent Pinchart
2016-09-13 14:40                         ` Bin Liu
2016-09-13 14:53                           ` Tony Lindgren
2016-09-18 12:14   ` Laurent Pinchart
2016-09-18 15:19     ` Tony Lindgren
     [not found]       ` <20160918151901.k7go65s4jauldxcl-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-19  5:59         ` Andreas Kemnade
2016-09-19 16:02           ` Tony Lindgren
     [not found]             ` <20160919160250.itstpdk2rqw3zhzi-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-20  5:04               ` Andreas Kemnade
2016-09-20 14:35                 ` Tony Lindgren
2016-09-19 20:35         ` Laurent Pinchart [this message]
2016-09-19 22:41           ` Tony Lindgren
     [not found]             ` <20160919224149.3msqxiv24ofwjz4c-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-20  6:36               ` Laurent Pinchart
2016-09-20 17:10                 ` Tony Lindgren
     [not found]                   ` <20160920171024.mnfjelzxjgv7s7dv-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-20 18:37                     ` Tony Lindgren
     [not found]                       ` <20160920183701.nxme7yxgc6jpmgio-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-28 18:42                         ` Tony Lindgren
     [not found]                           ` <20160928184234.zoleas3mvpxso36r-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-29  9:38                             ` Laurent Pinchart
2016-09-30 17:43                               ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2377851.ZR7UYeyr7h@avalon \
    --to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
    --cc=andreas-cLv4Z9ELZ06ZuzBka8ofvg@public.gmane.org \
    --cc=b-liu-l0cyMroinI0@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox