aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-mem.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index b7487a10d7bc..6072f1166de9 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1055,6 +1055,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1055 struct xhci_ep_ctx *ep0_ctx; 1055 struct xhci_ep_ctx *ep0_ctx;
1056 struct xhci_slot_ctx *slot_ctx; 1056 struct xhci_slot_ctx *slot_ctx;
1057 u32 port_num; 1057 u32 port_num;
1058 u32 max_packets;
1058 struct usb_device *top_dev; 1059 struct usb_device *top_dev;
1059 1060
1060 dev = xhci->devs[udev->slot_id]; 1061 dev = xhci->devs[udev->slot_id];
@@ -1072,15 +1073,20 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1072 switch (udev->speed) { 1073 switch (udev->speed) {
1073 case USB_SPEED_SUPER: 1074 case USB_SPEED_SUPER:
1074 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_SS); 1075 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_SS);
1076 max_packets = MAX_PACKET(512);
1075 break; 1077 break;
1076 case USB_SPEED_HIGH: 1078 case USB_SPEED_HIGH:
1077 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_HS); 1079 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_HS);
1080 max_packets = MAX_PACKET(64);
1078 break; 1081 break;
1082 /* USB core guesses at a 64-byte max packet first for FS devices */
1079 case USB_SPEED_FULL: 1083 case USB_SPEED_FULL:
1080 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_FS); 1084 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_FS);
1085 max_packets = MAX_PACKET(64);
1081 break; 1086 break;
1082 case USB_SPEED_LOW: 1087 case USB_SPEED_LOW:
1083 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_LS); 1088 slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_LS);
1089 max_packets = MAX_PACKET(8);
1084 break; 1090 break;
1085 case USB_SPEED_WIRELESS: 1091 case USB_SPEED_WIRELESS:
1086 xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n"); 1092 xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n");
@@ -1088,7 +1094,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1088 break; 1094 break;
1089 default: 1095 default:
1090 /* Speed was set earlier, this shouldn't happen. */ 1096 /* Speed was set earlier, this shouldn't happen. */
1091 BUG(); 1097 return -EINVAL;
1092 } 1098 }
1093 /* Find the root hub port this device is under */ 1099 /* Find the root hub port this device is under */
1094 port_num = xhci_find_real_port_number(xhci, udev); 1100 port_num = xhci_find_real_port_number(xhci, udev);
@@ -1147,31 +1153,10 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1147 /* Step 4 - ring already allocated */ 1153 /* Step 4 - ring already allocated */
1148 /* Step 5 */ 1154 /* Step 5 */
1149 ep0_ctx->ep_info2 = cpu_to_le32(EP_TYPE(CTRL_EP)); 1155 ep0_ctx->ep_info2 = cpu_to_le32(EP_TYPE(CTRL_EP));
1150 /* 1156
1151 * XXX: Not sure about wireless USB devices.
1152 */
1153 switch (udev->speed) {
1154 case USB_SPEED_SUPER:
1155 ep0_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(512));
1156 break;
1157 case USB_SPEED_HIGH:
1158 /* USB core guesses at a 64-byte max packet first for FS devices */
1159 case USB_SPEED_FULL:
1160 ep0_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(64));
1161 break;
1162 case USB_SPEED_LOW:
1163 ep0_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(8));
1164 break;
1165 case USB_SPEED_WIRELESS:
1166 xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n");
1167 return -EINVAL;
1168 break;
1169 default:
1170 /* New speed? */
1171 BUG();
1172 }
1173 /* EP 0 can handle "burst" sizes of 1, so Max Burst Size field is 0 */ 1157 /* EP 0 can handle "burst" sizes of 1, so Max Burst Size field is 0 */
1174 ep0_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(0) | ERROR_COUNT(3)); 1158 ep0_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(0) | ERROR_COUNT(3) |
1159 max_packets);
1175 1160
1176 ep0_ctx->deq = cpu_to_le64(dev->eps[0].ring->first_seg->dma | 1161 ep0_ctx->deq = cpu_to_le64(dev->eps[0].ring->first_seg->dma |
1177 dev->eps[0].ring->cycle_state); 1162 dev->eps[0].ring->cycle_state);