Quoting Greg KH <greg@xxxxxxxxx>: > On Tue, Feb 15, 2011 at 06:49:07PM +0100, castet.matthieu@xxxxxxx wrote: > > This could help to clean platform driver and unify them. > > > > I Wonder if we should include in the generic setup : > > - ehci->sbrn = 0x20; > > - set of ehci_port_power. What strange is that some driver do > > ehci_port_power(ehci, 0) and other ehci_port_power(ehci, 1) > > > > Matthieu > > > > > > --- > > drivers/usb/host/ehci-atmel.c | 20 ++------------------ > > drivers/usb/host/ehci-fsl.c | 23 ++--------------------- > > drivers/usb/host/ehci-hcd.c | 29 +++++++++++++++++++++++++++++ > > drivers/usb/host/ehci-msm.c | 18 +----------------- > > 4 files changed, 34 insertions(+), 56 deletions(-) > > > > diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c > > index d6a69d5..559f1a3 100644 > > --- a/drivers/usb/host/ehci-atmel.c > > +++ b/drivers/usb/host/ehci-atmel.c > > @@ -53,28 +53,12 @@ static int ehci_atmel_setup(struct usb_hcd *hcd) > > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > > int retval = 0; > > > > - /* registers start at offset 0x0 */ > > - ehci->caps = hcd->regs; > > - ehci->regs = hcd->regs + > > - HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); > > - dbg_hcs_params(ehci, "reset"); > > - dbg_hcc_params(ehci, "reset"); > > - > > - /* cache this readonly data; minimize chip reads */ > > - ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); > > - > > - retval = ehci_halt(ehci); > > - if (retval) > > - return retval; > > + ehci->sbrn = 0x20; > > > > - /* data structure init */ > > - retval = ehci_init(hcd); > > + retval = ehci_setup(hcd); > > Why not pass in ehci instead of hcd, causing you to back-cast again? Because I need hcd pointer to invoke ehci_init. > +static int ehci_setup (struct usb_hcd *hcd) > +{ > + struct ehci_hcd *ehci = hcd_to_ehci(hcd); > + int retval; > + > + /* EHCI registers start at offset 0x100 */ > + ehci->caps = hcd->regs + 0x100; note that ehci->caps shouldn't be set here but by platform driver. > + ehci->regs = hcd->regs + 0x100 + > + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); and ehci->regs should be + ehci->regs = ehci->caps + + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); Matthieu -- 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