diff options
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 18 | ||||
-rw-r--r-- | include/linux/usb/ch11.h | 19 |
2 files changed, 22 insertions, 15 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 430e88fd3f6c..35e257f79c7b 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -57,17 +57,15 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci, | |||
57 | desc->bHubContrCurrent = 0; | 57 | desc->bHubContrCurrent = 0; |
58 | 58 | ||
59 | desc->bNbrPorts = ports; | 59 | desc->bNbrPorts = ports; |
60 | /* Ugh, these should be #defines, FIXME */ | ||
61 | /* Using table 11-13 in USB 2.0 spec. */ | ||
62 | temp = 0; | 60 | temp = 0; |
63 | /* Bits 1:0 - support port power switching, or power always on */ | 61 | /* Bits 1:0 - support per-port power switching, or power always on */ |
64 | if (HCC_PPC(xhci->hcc_params)) | 62 | if (HCC_PPC(xhci->hcc_params)) |
65 | temp |= 0x0001; | 63 | temp |= HUB_CHAR_INDV_PORT_LPSM; |
66 | else | 64 | else |
67 | temp |= 0x0002; | 65 | temp |= HUB_CHAR_NO_LPSM; |
68 | /* Bit 2 - root hubs are not part of a compound device */ | 66 | /* Bit 2 - root hubs are not part of a compound device */ |
69 | /* Bits 4:3 - individual port over current protection */ | 67 | /* Bits 4:3 - individual port over current protection */ |
70 | temp |= 0x0008; | 68 | temp |= HUB_CHAR_INDV_PORT_OCPM; |
71 | /* Bits 6:5 - no TTs in root ports */ | 69 | /* Bits 6:5 - no TTs in root ports */ |
72 | /* Bit 7 - no port indicators */ | 70 | /* Bit 7 - no port indicators */ |
73 | desc->wHubCharacteristics = cpu_to_le16(temp); | 71 | desc->wHubCharacteristics = cpu_to_le16(temp); |
@@ -86,9 +84,9 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
86 | ports = xhci->num_usb2_ports; | 84 | ports = xhci->num_usb2_ports; |
87 | 85 | ||
88 | xhci_common_hub_descriptor(xhci, desc, ports); | 86 | xhci_common_hub_descriptor(xhci, desc, ports); |
89 | desc->bDescriptorType = 0x29; | 87 | desc->bDescriptorType = USB_DT_HUB; |
90 | temp = 1 + (ports / 8); | 88 | temp = 1 + (ports / 8); |
91 | desc->bDescLength = 7 + 2 * temp; | 89 | desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; |
92 | 90 | ||
93 | /* The Device Removable bits are reported on a byte granularity. | 91 | /* The Device Removable bits are reported on a byte granularity. |
94 | * If the port doesn't exist within that byte, the bit is set to 0. | 92 | * If the port doesn't exist within that byte, the bit is set to 0. |
@@ -137,8 +135,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
137 | 135 | ||
138 | ports = xhci->num_usb3_ports; | 136 | ports = xhci->num_usb3_ports; |
139 | xhci_common_hub_descriptor(xhci, desc, ports); | 137 | xhci_common_hub_descriptor(xhci, desc, ports); |
140 | desc->bDescriptorType = 0x2a; | 138 | desc->bDescriptorType = USB_DT_SS_HUB; |
141 | desc->bDescLength = 12; | 139 | desc->bDescLength = USB_DT_SS_HUB_SIZE; |
142 | 140 | ||
143 | /* header decode latency should be zero for roothubs, | 141 | /* header decode latency should be zero for roothubs, |
144 | * see section 4.23.5.2. | 142 | * see section 4.23.5.2. |
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 4ebaf0824179..55e7325926c1 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h | |||
@@ -165,11 +165,20 @@ struct usb_port_status { | |||
165 | * wHubCharacteristics (masks) | 165 | * wHubCharacteristics (masks) |
166 | * See USB 2.0 spec Table 11-13, offset 3 | 166 | * See USB 2.0 spec Table 11-13, offset 3 |
167 | */ | 167 | */ |
168 | #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ | 168 | #define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */ |
169 | #define HUB_CHAR_COMPOUND 0x0004 /* D2 */ | 169 | #define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */ |
170 | #define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ | 170 | #define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */ |
171 | #define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ | 171 | #define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */ |
172 | #define HUB_CHAR_PORTIND 0x0080 /* D7 */ | 172 | |
173 | #define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */ | ||
174 | |||
175 | #define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */ | ||
176 | #define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */ | ||
177 | #define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */ | ||
178 | #define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */ | ||
179 | |||
180 | #define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */ | ||
181 | #define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */ | ||
173 | 182 | ||
174 | struct usb_hub_status { | 183 | struct usb_hub_status { |
175 | __le16 wHubStatus; | 184 | __le16 wHubStatus; |