Commit 0165de09 authored by Inaky Perez-Gonzalez's avatar Inaky Perez-Gonzalez Committed by Greg Kroah-Hartman

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: default avatarInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cb4c8fe5
...@@ -85,6 +85,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ ...@@ -85,6 +85,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
unsigned uses_new_polling:1; unsigned uses_new_polling:1;
unsigned poll_rh:1; /* poll for rh status? */ unsigned poll_rh:1; /* poll for rh status? */
unsigned poll_pending:1; /* status has changed? */ unsigned poll_pending:1; /* status has changed? */
unsigned wireless:1; /* Wireless USB HCD */
int irq; /* irq allocated */ int irq; /* irq allocated */
void __iomem *regs; /* device memory/io */ void __iomem *regs; /* device memory/io */
......
...@@ -1331,6 +1331,18 @@ static int hub_port_status(struct usb_hub *hub, int port1, ...@@ -1331,6 +1331,18 @@ static int hub_port_status(struct usb_hub *hub, int port1,
return ret; return ret;
} }
/* Returns 1 if @hub is a WUSB root hub, 0 otherwise */
static unsigned hub_is_wusb(struct usb_hub *hub)
{
struct usb_hcd *hcd;
if (hub->hdev->parent != NULL) /* not a root hub? */
return 0;
hcd = container_of(hub->hdev->bus, struct usb_hcd, self);
return hcd->wireless;
}
#define PORT_RESET_TRIES 5 #define PORT_RESET_TRIES 5
#define SET_ADDRESS_TRIES 2 #define SET_ADDRESS_TRIES 2
#define GET_DESCRIPTOR_TRIES 2 #define GET_DESCRIPTOR_TRIES 2
...@@ -1371,7 +1383,9 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, ...@@ -1371,7 +1383,9 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
/* if we`ve finished resetting, then break out of the loop */ /* if we`ve finished resetting, then break out of the loop */
if (!(portstatus & USB_PORT_STAT_RESET) && if (!(portstatus & USB_PORT_STAT_RESET) &&
(portstatus & USB_PORT_STAT_ENABLE)) { (portstatus & USB_PORT_STAT_ENABLE)) {
if (portstatus & USB_PORT_STAT_HIGH_SPEED) if (hub_is_wusb(hub))
udev->speed = USB_SPEED_VARIABLE;
else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
udev->speed = USB_SPEED_HIGH; udev->speed = USB_SPEED_HIGH;
else if (portstatus & USB_PORT_STAT_LOW_SPEED) else if (portstatus & USB_PORT_STAT_LOW_SPEED)
udev->speed = USB_SPEED_LOW; udev->speed = USB_SPEED_LOW;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment