summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2012-09-26 00:14:34 +0200
committerTom Rini <trini@ti.com>2012-10-15 11:54:00 -0700
commitc7e3b2b58636704d504ac270031d87b716d8b273 (patch)
treeccbba6153c289fdb23ce766b80094b0a98d53bd2
parent5527efe501c117fc86273e2d7c7b6f30884015c3 (diff)
usb: lowlevel interface change to support multiple controllers
Carry an index in the lowlevel usb functions to make specify the respective usb controller. Also pass through an controller struct from lowlevel_init to the creation of the root usb device of this controller. Signed-off-by: Lucas Stach <dev@lynxeye.de> Reviewed-by: Marek Vasut <marex@denx.de>
-rw-r--r--arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c4
-rw-r--r--arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c4
-rw-r--r--arch/powerpc/cpu/mpc5xxx/usb_ohci.c4
-rw-r--r--arch/powerpc/cpu/ppc4xx/usb_ohci.c4
-rw-r--r--arch/sparc/cpu/leon3/usb_uhci.c4
-rw-r--r--arch/sparc/lib/bootm.c2
-rw-r--r--board/mpl/common/usb_uhci.c4
-rw-r--r--common/usb.c10
-rw-r--r--common/usb_hub.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c4
-rw-r--r--drivers/usb/host/isp116x-hcd.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c4
-rw-r--r--drivers/usb/host/r8a66597-hcd.c4
-rw-r--r--drivers/usb/host/sl811-hcd.c4
-rw-r--r--drivers/usb/musb/musb_hcd.c4
-rw-r--r--include/usb.h10
-rw-r--r--include/usb/mv_udc.h2
17 files changed, 40 insertions, 34 deletions
diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index cf0335c732..944bb32f57 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -1659,7 +1659,7 @@ static void hc_release_ohci(struct ohci *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
@@ -1738,7 +1738,7 @@ int usb_lowlevel_init(void)
return 0;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
index 7647e11841..c747767e1e 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
@@ -1565,7 +1565,7 @@ static void hc_release_ohci (ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
u32 pin_func;
u32 sys_freqctrl, sys_clksrc;
@@ -1707,7 +1707,7 @@ int usb_lowlevel_init(void)
return -1;
}
-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/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index 6d915256a3..607034b7c6 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -1561,7 +1561,7 @@ static void hc_release_ohci (ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
/* Set the USB Clock */
@@ -1629,7 +1629,7 @@ int usb_lowlevel_init(void)
return 0;
}
-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/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
index 14c6a280a6..4ce2726297 100644
--- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c
+++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
@@ -1566,7 +1566,7 @@ static void hc_release_ohci (ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
memset (&gohci, 0, sizeof (ohci_t));
memset (&urb_priv, 0, sizeof (urb_priv_t));
@@ -1624,7 +1624,7 @@ int usb_lowlevel_init(void)
return 0;
}
-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/arch/sparc/cpu/leon3/usb_uhci.c b/arch/sparc/cpu/leon3/usb_uhci.c
index 62cc25dc92..b3b8a4d0bb 100644
--- a/arch/sparc/cpu/leon3/usb_uhci.c
+++ b/arch/sparc/cpu/leon3/usb_uhci.c
@@ -706,7 +706,7 @@ void handle_usb_interrupt(void)
/* init uhci
*/
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
unsigned char temp;
ambapp_ahbdev ahbdev;
@@ -745,7 +745,7 @@ int usb_lowlevel_init(void)
/* stop uhci
*/
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
if (grusb_irq == -1)
return 1;
diff --git a/arch/sparc/lib/bootm.c b/arch/sparc/lib/bootm.c
index e5b933d1d6..bcc63584bf 100644
--- a/arch/sparc/lib/bootm.c
+++ b/arch/sparc/lib/bootm.c
@@ -36,7 +36,7 @@ extern void srmmu_init_cpu(unsigned int entry);
extern void prepare_bootargs(char *bootargs);
#ifdef CONFIG_USB_UHCI
-extern int usb_lowlevel_stop(void);
+extern int usb_lowlevel_stop(int index);
#endif
/* sparc kernel argument (the ROM vector) */
diff --git a/board/mpl/common/usb_uhci.c b/board/mpl/common/usb_uhci.c
index ddca587369..254f263cab 100644
--- a/board/mpl/common/usb_uhci.c
+++ b/board/mpl/common/usb_uhci.c
@@ -602,7 +602,7 @@ void handle_usb_interrupt(void)
/* init uhci
*/
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
unsigned char temp;
int busdevfunc;
@@ -632,7 +632,7 @@ int usb_lowlevel_init(void)
/* stop uhci
*/
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
if(irqvec==-1)
return 1;
diff --git a/common/usb.c b/common/usb.c
index 1b40228b28..e58b6f498f 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -76,6 +76,7 @@ static int running;
static int asynch_allowed;
char usb_started; /* flag for the started/stopped USB status */
+void *ctrl; /* goes away in a following commit, but don't break bisect */
/**********************************************************************
* some forward declerations...
@@ -96,7 +97,7 @@ int usb_init(void)
usb_hub_reset();
/* init low_level USB */
printf("USB: ");
- result = usb_lowlevel_init();
+ result = usb_lowlevel_init(0, &ctrl);
/* if lowlevel init is OK, scan the bus for devices
* i.e. search HUBs and configure them */
if (result == 0) {
@@ -123,7 +124,7 @@ int usb_stop(void)
asynch_allowed = 1;
usb_started = 0;
usb_hub_reset();
- res = usb_lowlevel_stop();
+ res = usb_lowlevel_stop(0);
}
return res;
}
@@ -754,7 +755,7 @@ struct usb_device *usb_get_dev_index(int index)
/* returns a pointer of a new device structure or NULL, if
* no device struct is available
*/
-struct usb_device *usb_alloc_new_device(void)
+struct usb_device *usb_alloc_new_device(void *controller)
{
int i;
USB_PRINTF("New Device %d\n", dev_index);
@@ -768,6 +769,7 @@ struct usb_device *usb_alloc_new_device(void)
for (i = 0; i < USB_MAXCHILDREN; i++)
usb_dev[dev_index].children[i] = NULL;
usb_dev[dev_index].parent = NULL;
+ usb_dev[dev_index].controller = controller;
dev_index++;
return &usb_dev[dev_index - 1];
}
@@ -958,7 +960,7 @@ static void usb_scan_devices(void)
}
dev_index = 0;
/* device 0 is always present (root hub, so let it analyze) */
- dev = usb_alloc_new_device();
+ dev = usb_alloc_new_device(ctrl);
if (usb_new_device(dev))
printf("No USB Device found\n");
else
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 32750e8d05..e4a120120d 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -244,7 +244,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
mdelay(200);
/* Allocate a new device struct for it */
- usb = usb_alloc_new_device();
+ usb = usb_alloc_new_device(dev->controller);
if (portstatus & USB_PORT_STAT_HIGH_SPEED)
usb->speed = USB_SPEED_HIGH;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 392e286224..5d8714e688 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -829,12 +829,12 @@ unknown:
return -1;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
return ehci_hcd_stop();
}
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
uint32_t reg;
uint32_t cmd;
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 5ef34c30fd..19e16a4a80 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)
+int usb_lowlevel_init(int index, void **controller))
{
struct isp116x *isp116x = &isp116x_dev;
@@ -1428,7 +1428,7 @@ int usb_lowlevel_init(void)
return 0;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
struct isp116x *isp116x = &isp116x_dev;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 9f4735167a..c2106adbd3 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1865,7 +1865,7 @@ static void hc_release_ohci(ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
#ifdef CONFIG_PCI_OHCI
pci_dev_t pdev;
@@ -1971,7 +1971,7 @@ int usb_lowlevel_init(void)
return 0;
}
-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 ab1b8d0d8b..2a4e7ff4b3 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -908,7 +908,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return 0;
}
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller))
{
struct r8a66597 *r8a66597 = &gr8a66597;
@@ -931,7 +931,7 @@ int usb_lowlevel_init(void)
return 0;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
disable_controller(&gr8a66597);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index bb27dd514a..2830616046 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -210,14 +210,14 @@ static int sl811_hc_reset(void)
return 1;
}
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
root_hub_devnum = 0;
sl811_hc_reset();
return 0;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
sl811_hc_reset();
return 0;
diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 8d44c4657f..06be38d1cf 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -1092,7 +1092,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
/*
* This function initializes the usb controller module.
*/
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
u8 power;
u32 timeout;
@@ -1144,7 +1144,7 @@ int usb_lowlevel_init(void)
/*
* This function stops the operation of the davinci usb module.
*/
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
/* Reset the USB module */
musb_platform_deinit();
diff --git a/include/usb.h b/include/usb.h
index ba3d169ea8..292a0425d8 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -140,6 +140,8 @@ struct usb_device {
int portnr;
struct usb_device *parent;
struct usb_device *children[USB_MAXCHILDREN];
+
+ void *controller; /* hardware controller private data */
};
/**********************************************************************
@@ -153,8 +155,9 @@ struct usb_device {
defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
-int usb_lowlevel_init(void);
-int usb_lowlevel_stop(void);
+int usb_lowlevel_init(int index, void **controller);
+int usb_lowlevel_stop(int index);
+
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len);
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
@@ -382,7 +385,8 @@ void usb_hub_reset(void);
int hub_port_reset(struct usb_device *dev, int port,
unsigned short *portstat);
-struct usb_device *usb_alloc_new_device(void);
+struct usb_device *usb_alloc_new_device(void *controller);
+
int usb_new_device(struct usb_device *dev);
#endif /*_USB_H_ */
diff --git a/include/usb/mv_udc.h b/include/usb/mv_udc.h
index 51d36c3f34..221e626391 100644
--- a/include/usb/mv_udc.h
+++ b/include/usb/mv_udc.h
@@ -147,5 +147,5 @@ struct ept_queue_item {
#define INFO_BUFFER_ERROR (1 << 5)
#define INFO_TX_ERROR (1 << 3)
-extern int usb_lowlevel_init(void);
+extern int usb_lowlevel_init(int index, void **controller);
#endif /* __MV_UDC_H__ */