Re: [PATCH 4/4] CI13xxx: Add USB host interrupt notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 May 2012, Marek Vasut wrote:

> Dear Alan Stern,
> 
> > On Tue, 15 May 2012, Marek Vasut wrote:
> > > This comes handy on the i.MX28 CPU, where the host IRQ also signalises
> > > that the disconnection detector shall be enabled/disabled on the PHY.
> > > 
> > > Signed-off-by: Marek Vasut <marex@xxxxxxx>
> > > Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> > > Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> > > Cc: Felipe Balbi <balbi@xxxxxx>
> > > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > > Cc: Linux USB <linux-usb@xxxxxxxxxxxxxxx>
> > > ---
> > > 
> > >  drivers/usb/chipidea/host.c  |    4 ++++
> > >  include/linux/usb/chipidea.h |    1 +
> > >  2 files changed, 5 insertions(+)
> > > 
> > > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > > index 9eacd21..97bb167 100644
> > > --- a/drivers/usb/chipidea/host.c
> > > +++ b/drivers/usb/chipidea/host.c
> > > @@ -94,6 +94,10 @@ static const struct hc_driver ci_ehci_hc_driver = {
> > > 
> > >  static irqreturn_t host_irq(struct ci13xxx *ci)
> > >  {
> > > 
> > > +	if (ci->udc_driver->notify_event)
> > > +		ci->udc_driver->notify_event(ci,
> > > +			CI13XXX_CONTROLLER_HOST_IRQ_EVENT);
> > > +
> > > 
> > >  	return usb_hcd_irq(ci->irq, ci->hcd);
> > >  
> > >  }
> > 
> > This is a rather roundabout way of doing things.  Why add a new
> > notifier mechanism when you can simply register another interrupt
> > handler for the same IRQ?
> 
> You certainly can, but how would you access the EHCI registers from PHY driver? 

The same way you get informed about ci above: The information would get 
passed to the interrupt handler.

> They have separate memory resources. Because the notifier passes data figured 
> out by reading the EHCI register (USBSTS, PCD bit) and tells PHY to 
> enable/disable the disconnection detector accordingly.

I'm not sure I really understand the purpose of all this.  Why does the 
PHY driver need to know about every IRQ the host driver receives?

Also, since the code above is part of a _host_ driver, why does it call
through a pointer in ci->udc_driver -- does that even make sense in a
host-only situation?  And why can't it call the PHY driver directly?

Alan Stern

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux