From c7e3b2b58636704d504ac270031d87b716d8b273 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 26 Sep 2012 00:14:34 +0200 Subject: 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 Reviewed-by: Marek Vasut --- common/usb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'common/usb.c') 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 -- cgit v1.2.3