On Tue, 17 Jan 2012, Kelvin Cheung wrote: > The Loongson1x SoCs have a built-in EHCI controller. > This patch adds the necessary glue code to make the generic EHCI > driver usable for them. > --- /dev/null > +++ b/drivers/usb/host/ehci-ls1x.c > @@ -0,0 +1,170 @@ > +/* > + * Bus Glue for Loongson LS1X built-in EHCI controller. > + * > + * Copyright (c) 2012 Zhang, Keguang <keguang.zhang@xxxxxxxxx> > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License version 2 as published > + * by the Free Software Foundation. > + */ > + > + > +#include <linux/platform_device.h> > + > +static int ehci_ls1x_setup(struct usb_hcd *hcd) > +{ > + struct ehci_hcd *ehci = hcd_to_ehci(hcd); > + int ret; > + > + ehci->caps = hcd->regs; > + ehci->regs = hcd->regs + > + HC_LENGTH(ehci, 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); > + ehci->sbrn = 0x20; > + > + ehci_reset(ehci); > + > + /* data structure init */ > + ret = ehci_init(hcd); > + if (ret) > + return ret; > + > + ehci_port_power(ehci, 0); > + > + return 0; > +} Most of this routine should be replaced with a call to ehci_setup(). Alan Stern