diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-27 23:34:25 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-12-13 17:47:42 +0100 |
commit | 15fd89d0a49f015e2b6078a28cb61400f4028e39 (patch) | |
tree | 8c137e2283b0684f9cc84ca86ef28590091eb1cf /drivers/usb/host/ehci-hcd.c | |
parent | 0ccb9aebcd98d99fdc22d938240c65c7466e8146 (diff) | |
download | barebox-15fd89d0a49f015e2b6078a28cb61400f4028e39.tar.gz barebox-15fd89d0a49f015e2b6078a28cb61400f4028e39.tar.xz |
USB ehci: Allow to register independently from device
The EHCI core often is part of a otg core. Allow it to be registered
separately from another driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index d8814aa72d..d6083e08ce 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -807,32 +807,18 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, return -1; } -static int ehci_probe(struct device_d *dev) +int ehci_register(struct device_d *dev, struct ehci_data *data) { struct usb_host *host; struct ehci_priv *ehci; uint32_t reg; - struct ehci_platform_data *pdata = dev->platform_data; ehci = xzalloc(sizeof(struct ehci_priv)); host = &ehci->host; dev->priv = ehci; - - /* default to EHCI_HAS_TT to not change behaviour of boards - * without platform_data - */ - if (pdata) - ehci->flags = pdata->flags; - else - ehci->flags = EHCI_HAS_TT; - - if (dev->num_resources < 2) { - printf("echi: need 2 resources base and data"); - return -ENODEV; - } - - ehci->hccr = dev_request_mem_region(dev, 0); - ehci->hcor = dev_request_mem_region(dev, 1); + ehci->flags = data->flags; + ehci->hccr = data->hccr; + ehci->hcor = data->hcor; ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD); ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD); @@ -854,6 +840,30 @@ static int ehci_probe(struct device_d *dev) return 0; } +static int ehci_probe(struct device_d *dev) +{ + struct ehci_data data; + struct ehci_platform_data *pdata = dev->platform_data; + + /* default to EHCI_HAS_TT to not change behaviour of boards + * without platform_data + */ + if (pdata) + data.flags = pdata->flags; + else + data.flags = EHCI_HAS_TT; + + if (dev->num_resources < 2) { + printf("echi: need 2 resources base and data"); + return -ENODEV; + } + + data.hccr = dev_request_mem_region(dev, 0); + data.hcor = dev_request_mem_region(dev, 1); + + return ehci_register(dev, &data); +} + static void ehci_remove(struct device_d *dev) { struct ehci_priv *ehci = dev->priv; |