mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anoop P A <anoop.pa@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Anatolij Gustschin <agust@denx.de>,
	Anand Gadiyar <gadiyar@ti.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org,
	Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	Oliver Neukum <oneukum@suse.de>,
	Hans de Goede <hdegoede@redhat.com>,
	Paul Mortier <mortier@btinternet.com>,
	Andiry Xu <andiry.xu@amd.com>
Subject: Re: [PATCH V2 2/2] MSP onchip root hub over current quirk.
Date: Thu, 23 Dec 2010 14:59:01 +0530	[thread overview]
Message-ID: <1293096541.27661.46.camel@paanoop1-desktop> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1012222112200.26667-100000@netrider.rowland.org>

On Wed, 2010-12-22 at 21:18 -0500, Alan Stern wrote:
> On Wed, 22 Dec 2010, Anoop P.A wrote:
> 
> > From: Anoop P A <anoop.pa@gmail.com>
> > 
> > Adding chip specific code under quirk.
> 
> NAK.  See below.
> 
> > Signed-off-by: Anoop P A <anoop.pa@gmail.com>
> > ---
> >  drivers/usb/core/hub.c     |   45 ++++++++++++++++++++++++++++++++++++++-----
> >  drivers/usb/core/quirks.c  |    3 ++
> >  include/linux/usb/quirks.h |    3 ++
> >  3 files changed, 45 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index 27115b4..4bff994 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -3377,12 +3377,45 @@ static void hub_events(void)
> >  			}
> >  			
> >  			if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
> > -				dev_err (hub_dev,
> > -					"over-current change on port %d\n",
> > -					i);
> > -				clear_port_feature(hdev, i,
> > -					USB_PORT_FEAT_C_OVER_CURRENT);
> > -				hub_power_on(hub, true);
> > +				usb_detect_quirks(hdev);
> 
> This line is wrong.  usb_detect_quirks() gets called only once per 
> device, when the device is initialized.  Besides, you probably want to 
> use a hub-specific flag for this rather than a device-specific flag.

Can you point me to an example for the recommended way of doing the
hack. I don't have much exposure to USB subsystem.

> 
> > +				if (hdev->quirks & USB_QUIRK_MSP_OVERCURRENT) {
> 
> Also, it would be better to put this code in a separate subroutine 
> instead of indenting it so far.
> 
> > +					/* clear OCC bit */
> > +					clear_port_feature(hdev, i,
> > +						USB_PORT_FEAT_C_OVER_CURRENT);
> > +
> > +					/* This step is required to toggle the
> > +					* PP bit to 0 and 1 (by hub_power_on)
> > +					* in order the CSC bit to be
> > +					* transitioned properly for device
> > +					* hotplug
> > +					*/
> > +					/* clear PP bit */
> > +					clear_port_feature(hdev, i,
> > +						USB_PORT_FEAT_POWER);
> > +
> > +					/* resume power */
> > +					hub_power_on(hub, true);
> > +
> > +					/* delay 100 usec */
> > +					udelay(100);
> > +
> > +					/* read OCA bit */
> > +					if (portstatus &
> > +					(1<<USB_PORT_FEAT_OVER_CURRENT)) {
> > +						/* declare overcurrent */
> > +						dev_err(hub_dev,
> > +						"over-current change \
> > +							on port %d\n", i);
> > +					}
> > +				} else {
> > +					dev_err(hub_dev,
> > +						"over-current change \
> > +							on port %d\n", i);
> > +					clear_port_feature(hdev, i,
> > +						USB_PORT_FEAT_C_OVER_CURRENT);
> > +					hub_power_on(hub, true);
> > +				}
> > +
> >  			}
> >  
> >  			if (portchange & USB_PORT_STAT_C_RESET) {
> > diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
> > index 25719da..59843b9 100644
> > --- a/drivers/usb/core/quirks.c
> > +++ b/drivers/usb/core/quirks.c
> > @@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {
> >  	/* INTEL VALUE SSD */
> >  	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
> >  
> > +	/* PMC MSP over current quirk */
> > +	{ USB_DEVICE(0x1d6b, 0x0002), .driver_info = USB_QUIRK_MSP_OVERCURRENT },
> > +
> 
> This implementation is completely wrong.  It applies to all USB-2.0
> root hubs in Linux, not just the PMC MSP.
> 
> >  	{ }  /* terminating entry must be last */
> >  };
> >  
> > diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
> > index 3e93de7..97ab168 100644
> > --- a/include/linux/usb/quirks.h
> > +++ b/include/linux/usb/quirks.h
> > @@ -30,4 +30,7 @@
> >     descriptor */
> >  #define USB_QUIRK_DELAY_INIT		0x00000040
> >  
> > +/*MSP SoC onchip EHCI overcurrent issue */
> > +#define USB_QUIRK_MSP_OVERCURRENT	0x00000080
> > +
> >  #endif /* __LINUX_USB_QUIRKS_H */
> > 
> 
Thanks
Anoop


  reply	other threads:[~2010-12-23  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 11:06 [PATCH] EHCI support for on-chip PMC MSP USB controller Anoop P
2010-12-21 16:00 ` Alan Stern
2010-12-21 17:59   ` Greg KH
2010-12-22 14:34 ` [PATCH V2 0/2] " Anoop P.A
2010-12-22 14:36 ` [PATCH V2 1/2] " Anoop P.A
2010-12-22 14:58   ` Anoop P A
2010-12-24  9:44   ` Shane McDonald
2011-01-27 11:28     ` [PATCH v3] EHCI bus glue " Anoop P.A
2011-02-04 19:56       ` Greg KH
2011-02-09 14:12         ` Anoop P A
2011-02-09 17:20           ` Greg KH
     [not found]       ` <4D52AE7E.8000907@parrot.com>
2011-02-09 15:44         ` Anoop P A
2011-02-15 10:43       ` [PATCH v4] " Anoop P.A
2010-12-22 14:36 ` [PATCH V2 2/2] MSP onchip root hub over current quirk Anoop P.A
2010-12-23  2:18   ` Alan Stern
2010-12-23  9:29     ` Anoop P A [this message]
2010-12-23 16:08       ` Alan Stern

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=1293096541.27661.46.camel@paanoop1-desktop \
    --to=anoop.pa@gmail.com \
    --cc=agust@denx.de \
    --cc=andiry.xu@amd.com \
    --cc=gadiyar@ti.com \
    --cc=gregkh@suse.de \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mortier@btinternet.com \
    --cc=oneukum@suse.de \
    --cc=ralf@linux-mips.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®