summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2011-08-01 11:41:42 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:24 -0700
commit94e9eb775fce848a47b2e5d0b40f7f0b8c3e8f3f (patch)
tree6aa843a76a17415b659e66f87e7786c4dc0251d0 /drivers/usb
parent2ea85c0681a7e2bda2b4e357ac3cd5f30c2f55fc (diff)
usb: update API for multiple controllers
Add the ability to have USB devices enumerated on several controllers BUG=chrome-os-partner:5043 TEST=Compile U-Boot Change-Id: If43d32d4dc90c15ba570e5b9f86641cbf60ce064 Reviewed-on: http://gerrit.chromium.org/gerrit/4951 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-hcd.c14
-rw-r--r--drivers/usb/host/isp116x-hcd.c10
-rw-r--r--drivers/usb/host/ohci-hcd.c22
-rw-r--r--drivers/usb/host/r8a66597-hcd.c8
-rw-r--r--drivers/usb/host/sl811-hcd.c7
-rw-r--r--drivers/usb/musb/musb_hcd.c11
6 files changed, 33 insertions, 39 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 4051923f83..c6d72c50f8 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -829,26 +829,26 @@ unknown:
return -1;
}
-int usb_lowlevel_stop(void)
+void usb_lowlevel_stop(int index)
{
- return ehci_hcd_stop();
+ ehci_hcd_stop();
}
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
uint32_t reg;
uint32_t cmd;
if (ehci_hcd_init() != 0)
- return -1;
+ return NULL;
/* EHCI spec section 4.1 */
if (ehci_reset() != 0)
- return -1;
+ return NULL;
#if defined(CONFIG_EHCI_HCD_INIT_AFTER_RESET)
if (ehci_hcd_init() != 0)
- return -1;
+ return NULL;
#endif
/* Set the high address word (aka segment) for 64-bit controller */
if (ehci_readl(&hccr->cr_hccparams) & 1) /* 64-bit Addressing */
@@ -898,7 +898,7 @@ int usb_lowlevel_init(void)
rootdev = 0;
- return 0;
+ return hccr;
}
int
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index abdcbb4b22..70a3760b99 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1391,7 +1391,7 @@ int isp116x_check_id(struct isp116x *isp116x)
return 0;
}
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
struct isp116x *isp116x = &isp116x_dev;
@@ -1417,7 +1417,7 @@ int usb_lowlevel_init(void)
/* Try to get ISP116x silicon chip ID */
if (isp116x_check_id(isp116x) < 0)
- return -1;
+ return NULL;
isp116x->disabled = 1;
isp116x->sleeping = 0;
@@ -1425,10 +1425,10 @@ int usb_lowlevel_init(void)
isp116x_reset(isp116x);
isp116x_start(isp116x);
- return 0;
+ return isp116x;
}
-int usb_lowlevel_stop(void)
+void usb_lowlevel_stop(int index)
{
struct isp116x *isp116x = &isp116x_dev;
@@ -1436,6 +1436,4 @@ int usb_lowlevel_stop(void)
if (!isp116x->disabled)
isp116x_stop(isp116x);
-
- return 0;
}
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index bc8bb2061b..fc8ae21be5 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1870,7 +1870,7 @@ static void hc_release_ohci(ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
#ifdef CONFIG_PCI_OHCI
pci_dev_t pdev;
@@ -1879,32 +1879,32 @@ int usb_lowlevel_init(void)
#ifdef CONFIG_SYS_USB_OHCI_CPU_INIT
/* cpu dependant init */
if (usb_cpu_init())
- return -1;
+ return NULL;
#endif
#ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT
/* board dependant init */
if (usb_board_init())
- return -1;
+ return NULL;
#endif
memset(&gohci, 0, sizeof(ohci_t));
/* align the storage */
if ((__u32)&ghcca[0] & 0xff) {
err("HCCA not aligned!!");
- return -1;
+ return NULL;
}
phcca = &ghcca[0];
info("aligned ghcca %p", phcca);
memset(&ohci_dev, 0, sizeof(struct ohci_device));
if ((__u32)&ohci_dev.ed[0] & 0x7) {
err("EDs not aligned!!");
- return -1;
+ return NULL;
}
memset(gtd, 0, sizeof(td_t) * (NUM_TD + 1));
if ((__u32)gtd & 0x7) {
err("TDs not aligned!!");
- return -1;
+ return NULL;
}
ptd = gtd;
gohci.hcca = phcca;
@@ -1928,7 +1928,7 @@ int usb_lowlevel_init(void)
printf("OHCI regs address 0x%08x\n", base);
gohci.regs = (struct ohci_regs *)base;
} else
- return -1;
+ return NULL;
#else
gohci.regs = (struct ohci_regs *)CONFIG_SYS_USB_OHCI_REGS_BASE;
#endif
@@ -1948,7 +1948,7 @@ int usb_lowlevel_init(void)
/* cpu dependant cleanup */
usb_cpu_init_fail();
#endif
- return -1;
+ return NULL;
}
if (hc_start(&gohci) < 0) {
@@ -1964,7 +1964,7 @@ int usb_lowlevel_init(void)
/* cpu dependant cleanup */
usb_cpu_stop();
#endif
- return -1;
+ return NULL;
}
#ifdef DEBUG
@@ -1973,10 +1973,10 @@ int usb_lowlevel_init(void)
wait_ms(1);
#endif
ohci_inited = 1;
- return 0;
+ return &gohci;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
/* this gets called really early - before the controller has */
/* even been initialized! */
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index db611b641f..ab69c9f191 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -914,7 +914,7 @@ void usb_event_poll(void)
R8A66597_DPRINT("%s\n", __func__);
}
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
struct r8a66597 *r8a66597 = &gr8a66597;
@@ -934,12 +934,10 @@ int usb_lowlevel_init(void)
wait_ms(50);
- return 0;
+ return r8a66597;
}
-int usb_lowlevel_stop(void)
+void usb_lowlevel_stop(int index)
{
disable_controller(&gr8a66597);
-
- return 0;
}
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 82a8b365f4..05219da058 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -212,17 +212,16 @@ static int sl811_hc_reset(void)
return 1;
}
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
root_hub_devnum = 0;
sl811_hc_reset();
- return 0;
+ return (void *)SL811_ADR;
}
-int usb_lowlevel_stop(void)
+void usb_lowlevel_stop(int index)
{
sl811_hc_reset();
- return 0;
}
static int calc_needed_buswidth(int bytes, int need_preamble)
diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 974bb311cc..1b06fbf7f3 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -1093,7 +1093,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
/*
* This function initializes the usb controller module.
*/
-int usb_lowlevel_init(void)
+void *usb_lowlevel_init(int index)
{
u8 power;
u32 timeout;
@@ -1101,7 +1101,7 @@ int usb_lowlevel_init(void)
musb_rh_init();
if (musb_platform_init() == -1)
- return -1;
+ return NULL;
/* Configure all the endpoint FIFO's and start usb controller */
musbr = musb_cfg.regs;
@@ -1120,7 +1120,7 @@ int usb_lowlevel_init(void)
/* if musb core is not in host mode, then return */
if (!timeout)
- return -1;
+ return NULL;
/* start usb bus reset */
power = readb(&musbr->power);
@@ -1139,18 +1139,17 @@ int usb_lowlevel_init(void)
MUSB_TYPE_SPEED_HIGH :
((readb(&musbr->devctl) & MUSB_DEVCTL_FSDEV) ?
MUSB_TYPE_SPEED_FULL : MUSB_TYPE_SPEED_LOW);
- return 0;
+ return &musb_cfg;
}
/*
* This function stops the operation of the davinci usb module.
*/
-int usb_lowlevel_stop(void)
+void usb_lowlevel_stop(int index)
{
/* Reset the USB module */
musb_platform_deinit();
writeb(0, &musbr->devctl);
- return 0;
}
/*