diff options
| author | Thirupathi Chippakurthy <thirupathi.chippakurthy@stericsson.com> | 2011-09-02 17:45:15 +0530 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 16:07:25 +0200 |
| commit | 4d8ddf47cf9de7f9cd60135c9eb0a61f361fc0e9 (patch) | |
| tree | 3b709e79bcdb4ad8559aa61b5c35d7ca651abdb3 | |
| parent | 2bce15e15a70d11524f9ffe78ef7dd0823440f0a (diff) | |
ux500: usb: core: USB Hub support musb host
USB Hub support musb host
ST-Ericsson ID: CR 279072
ST-Ericsson Linux next: NA
ST-Ericsson FOSS-OUT ID: NA
Signed-off-by:<thirupathi.chippakurthy@stericsson.com>
Change-Id: I22ded0d7cadc8d83996336cfe3917e345c48bd45
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30052
Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
| -rw-r--r-- | drivers/usb/core/hub.c | 31 | ||||
| -rw-r--r-- | drivers/usb/core/notify.c | 7 | ||||
| -rw-r--r-- | drivers/usb/core/usb.h | 4 | ||||
| -rw-r--r-- | include/linux/usb.h | 8 |
4 files changed, 50 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 72150c7ea3a..98801cf4c18 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -30,6 +30,12 @@ #include "usb.h" +#ifdef CONFIG_ARCH_U8500 +#define MAX_TOPO_LEVEL_U8500 2 +#define MAX_USB_DEVICE_U8500 8 +int usb_device_count; +#endif + /* if we are in debug mode, always announce new devices */ #ifdef DEBUG #ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES @@ -1292,11 +1298,20 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) if (!hub_is_superspeed(hdev) || !hdev->parent) usb_enable_autosuspend(hdev); +#ifdef CONFIG_ARCH_U8500 + if (hdev->level > MAX_TOPO_LEVEL_U8500) { + dev_err(&intf->dev, + "Unsupported bus topology: > %d " + " hub nesting\n", MAX_TOPO_LEVEL_U8500); + return -E2BIG; + } +#else if (hdev->level == MAX_TOPO_LEVEL) { dev_err(&intf->dev, "Unsupported bus topology: hub nested too deep\n"); return -E2BIG; } +#endif #ifdef CONFIG_USB_OTG_BLACKLIST_HUB if (hdev->parent) { @@ -3260,6 +3275,22 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, goto loop; } +#ifdef CONFIG_ARCH_U8500 + if (hdev->parent == NULL) + usb_device_count = 1; + + if (usb_device_count > MAX_USB_DEVICE_U8500) { + + dev_err(&udev->dev, + "device connected is more than %d\n", + MAX_USB_DEVICE_U8500); + + status = -ENOTCONN; /* Don't retry */ + goto loop; + } +#endif + + /* reset (non-USB 3.0 devices) and get descriptor */ status = hub_port_init(hub, udev, port1, i); if (status < 0) diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index 7542dce3f5a..87c5edcbdf5 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c @@ -45,11 +45,18 @@ EXPORT_SYMBOL_GPL(usb_unregister_notify); void usb_notify_add_device(struct usb_device *udev) { +#ifdef CONFIG_ARCH_U8500 + usb_device_count++; +#endif + blocking_notifier_call_chain(&usb_notifier_list, USB_DEVICE_ADD, udev); } void usb_notify_remove_device(struct usb_device *udev) { +#ifdef CONFIG_ARCH_U8500 + usb_device_count--; +#endif /* Protect against simultaneous usbfs open */ mutex_lock(&usbfs_mutex); blocking_notifier_call_chain(&usb_notifier_list, diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index d44d4b7bbf1..f9eaaa04e26 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,5 +1,9 @@ #include <linux/pm.h> +#ifdef CONFIG_ARCH_U8500 +extern int usb_device_count; +#endif + /* Functions local to drivers/usb/core/ */ extern int usb_create_sysfs_dev_files(struct usb_device *dev); diff --git a/include/linux/usb.h b/include/linux/usb.h index 73c7df48960..8c47a3bfaff 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -362,7 +362,15 @@ struct usb_bus { * limit. Because the arrays need to add a bit for hub status data, we * do 31, so plus one evens out to four bytes. */ + +#ifdef CONFIG_ARCH_U8500 +/** +* On U8500 platform we support 16 ports only +*/ +#define USB_MAXCHILDREN (16) +#else #define USB_MAXCHILDREN (31) +#endif struct usb_tt; |
