diff options
| author | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | 2006-08-25 22:35:29 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 14:58:55 -0400 |
| commit | 0165de09747be76b09ef769fcfed3514fe5f6509 (patch) | |
| tree | f4b3dd96715630fbaa73b7791ba08f5c170d32a1 | |
| parent | cb4c8fe57c05dbb04128503f4a7483a1163b1b47 (diff) | |
wusb: hub code recognizes wusb ports
This patch enables the USB stack to recognize WUSB devices (from a
WUSB HCD) and assigns them the proper speed setting
(USB_SPEED_VARIABLE).
1. Introduce usb_hcd->wireless to mark a host controller instance as
being wireless, and thus having wireless 'fake' ports.
[discarded previous model of using a reserved bit in the port_stat
struct to do this; thanks to Alan Stern for indicating the
proper way to do it].
2. Introduce hub.c:hub_is_wusb() that tests if a hub is a WUSB root
hub (WUSB doesn't have non-root hubs).
New code being pushed to linuxuwb.org requires this patch to connect WUSB
devices.
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/usb/core/hcd.h | 1 | ||||
| -rw-r--r-- | drivers/usb/core/hub.c | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 58c7767bc904..fc71a08a1af4 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
| @@ -85,6 +85,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ | |||
| 85 | unsigned uses_new_polling:1; | 85 | unsigned uses_new_polling:1; |
| 86 | unsigned poll_rh:1; /* poll for rh status? */ | 86 | unsigned poll_rh:1; /* poll for rh status? */ |
| 87 | unsigned poll_pending:1; /* status has changed? */ | 87 | unsigned poll_pending:1; /* status has changed? */ |
| 88 | unsigned wireless:1; /* Wireless USB HCD */ | ||
| 88 | 89 | ||
| 89 | int irq; /* irq allocated */ | 90 | int irq; /* irq allocated */ |
| 90 | void __iomem *regs; /* device memory/io */ | 91 | void __iomem *regs; /* device memory/io */ |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index bdf5be099650..db4a9be1cb8a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -1331,6 +1331,18 @@ static int hub_port_status(struct usb_hub *hub, int port1, | |||
| 1331 | return ret; | 1331 | return ret; |
| 1332 | } | 1332 | } |
| 1333 | 1333 | ||
| 1334 | |||
| 1335 | /* Returns 1 if @hub is a WUSB root hub, 0 otherwise */ | ||
| 1336 | static unsigned hub_is_wusb(struct usb_hub *hub) | ||
| 1337 | { | ||
| 1338 | struct usb_hcd *hcd; | ||
| 1339 | if (hub->hdev->parent != NULL) /* not a root hub? */ | ||
| 1340 | return 0; | ||
| 1341 | hcd = container_of(hub->hdev->bus, struct usb_hcd, self); | ||
| 1342 | return hcd->wireless; | ||
| 1343 | } | ||
| 1344 | |||
| 1345 | |||
| 1334 | #define PORT_RESET_TRIES 5 | 1346 | #define PORT_RESET_TRIES 5 |
| 1335 | #define SET_ADDRESS_TRIES 2 | 1347 | #define SET_ADDRESS_TRIES 2 |
| 1336 | #define GET_DESCRIPTOR_TRIES 2 | 1348 | #define GET_DESCRIPTOR_TRIES 2 |
| @@ -1371,7 +1383,9 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
| 1371 | /* if we`ve finished resetting, then break out of the loop */ | 1383 | /* if we`ve finished resetting, then break out of the loop */ |
| 1372 | if (!(portstatus & USB_PORT_STAT_RESET) && | 1384 | if (!(portstatus & USB_PORT_STAT_RESET) && |
| 1373 | (portstatus & USB_PORT_STAT_ENABLE)) { | 1385 | (portstatus & USB_PORT_STAT_ENABLE)) { |
| 1374 | if (portstatus & USB_PORT_STAT_HIGH_SPEED) | 1386 | if (hub_is_wusb(hub)) |
| 1387 | udev->speed = USB_SPEED_VARIABLE; | ||
| 1388 | else if (portstatus & USB_PORT_STAT_HIGH_SPEED) | ||
| 1375 | udev->speed = USB_SPEED_HIGH; | 1389 | udev->speed = USB_SPEED_HIGH; |
| 1376 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) | 1390 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) |
| 1377 | udev->speed = USB_SPEED_LOW; | 1391 | udev->speed = USB_SPEED_LOW; |
