diff options
author | Lucas Stach <dev@lynxeye.de> | 2012-09-26 00:14:34 +0200 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-10-15 11:54:00 -0700 |
commit | c7e3b2b58636704d504ac270031d87b716d8b273 (patch) | |
tree | ccbba6153c289fdb23ce766b80094b0a98d53bd2 /common | |
parent | 5527efe501c117fc86273e2d7c7b6f30884015c3 (diff) | |
download | u-boot-imx-c7e3b2b58636704d504ac270031d87b716d8b273.zip u-boot-imx-c7e3b2b58636704d504ac270031d87b716d8b273.tar.gz u-boot-imx-c7e3b2b58636704d504ac270031d87b716d8b273.tar.bz2 |
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>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb.c | 10 | ||||
-rw-r--r-- | common/usb_hub.c | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/common/usb.c b/common/usb.c index 1b40228..e58b6f4 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 32750e8..e4a1201 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; |