diff options
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 10 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.c | 77 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 4 |
4 files changed, 47 insertions, 46 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index f2fbdc7fe376..d008d1360a7a 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -34,8 +34,6 @@ | |||
34 | * bypassing some hardware (and driver) issues. UML could help too. | 34 | * bypassing some hardware (and driver) issues. UML could help too. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #define DEBUG | ||
38 | |||
39 | #include <linux/module.h> | 37 | #include <linux/module.h> |
40 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
41 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index be7a1bd2823b..965ad7bec7b7 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -599,7 +599,6 @@ enum fsg_buffer_state { | |||
599 | 599 | ||
600 | struct fsg_buffhd { | 600 | struct fsg_buffhd { |
601 | void *buf; | 601 | void *buf; |
602 | dma_addr_t dma; | ||
603 | enum fsg_buffer_state state; | 602 | enum fsg_buffer_state state; |
604 | struct fsg_buffhd *next; | 603 | struct fsg_buffhd *next; |
605 | 604 | ||
@@ -1295,6 +1294,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1295 | struct usb_request *req = fsg->ep0req; | 1294 | struct usb_request *req = fsg->ep0req; |
1296 | int value = -EOPNOTSUPP; | 1295 | int value = -EOPNOTSUPP; |
1297 | u16 w_index = le16_to_cpu(ctrl->wIndex); | 1296 | u16 w_index = le16_to_cpu(ctrl->wIndex); |
1297 | u16 w_value = le16_to_cpu(ctrl->wValue); | ||
1298 | u16 w_length = le16_to_cpu(ctrl->wLength); | 1298 | u16 w_length = le16_to_cpu(ctrl->wLength); |
1299 | 1299 | ||
1300 | if (!fsg->config) | 1300 | if (!fsg->config) |
@@ -1308,7 +1308,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1308 | if (ctrl->bRequestType != (USB_DIR_OUT | | 1308 | if (ctrl->bRequestType != (USB_DIR_OUT | |
1309 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 1309 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
1310 | break; | 1310 | break; |
1311 | if (w_index != 0) { | 1311 | if (w_index != 0 || w_value != 0) { |
1312 | value = -EDOM; | 1312 | value = -EDOM; |
1313 | break; | 1313 | break; |
1314 | } | 1314 | } |
@@ -1324,7 +1324,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1324 | if (ctrl->bRequestType != (USB_DIR_IN | | 1324 | if (ctrl->bRequestType != (USB_DIR_IN | |
1325 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 1325 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
1326 | break; | 1326 | break; |
1327 | if (w_index != 0) { | 1327 | if (w_index != 0 || w_value != 0) { |
1328 | value = -EDOM; | 1328 | value = -EDOM; |
1329 | break; | 1329 | break; |
1330 | } | 1330 | } |
@@ -1343,7 +1343,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1343 | if (ctrl->bRequestType != (USB_DIR_OUT | | 1343 | if (ctrl->bRequestType != (USB_DIR_OUT | |
1344 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 1344 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
1345 | break; | 1345 | break; |
1346 | if (w_index != 0) { | 1346 | if (w_index != 0 || w_value != 0) { |
1347 | value = -EDOM; | 1347 | value = -EDOM; |
1348 | break; | 1348 | break; |
1349 | } | 1349 | } |
@@ -2611,7 +2611,6 @@ static int send_status(struct fsg_dev *fsg) | |||
2611 | 2611 | ||
2612 | fsg->intr_buffhd = bh; // Point to the right buffhd | 2612 | fsg->intr_buffhd = bh; // Point to the right buffhd |
2613 | fsg->intreq->buf = bh->inreq->buf; | 2613 | fsg->intreq->buf = bh->inreq->buf; |
2614 | fsg->intreq->dma = bh->inreq->dma; | ||
2615 | fsg->intreq->context = bh; | 2614 | fsg->intreq->context = bh; |
2616 | start_transfer(fsg, fsg->intr_in, fsg->intreq, | 2615 | start_transfer(fsg, fsg->intr_in, fsg->intreq, |
2617 | &fsg->intreq_busy, &bh->state); | 2616 | &fsg->intreq_busy, &bh->state); |
@@ -3200,7 +3199,6 @@ reset: | |||
3200 | if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) | 3199 | if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) |
3201 | goto reset; | 3200 | goto reset; |
3202 | bh->inreq->buf = bh->outreq->buf = bh->buf; | 3201 | bh->inreq->buf = bh->outreq->buf = bh->buf; |
3203 | bh->inreq->dma = bh->outreq->dma = bh->dma; | ||
3204 | bh->inreq->context = bh->outreq->context = bh; | 3202 | bh->inreq->context = bh->outreq->context = bh; |
3205 | bh->inreq->complete = bulk_in_complete; | 3203 | bh->inreq->complete = bulk_in_complete; |
3206 | bh->outreq->complete = bulk_out_complete; | 3204 | bh->outreq->complete = bulk_out_complete; |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 10b2b33b8698..d57bcfbc08a5 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -1277,31 +1277,32 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1277 | 1277 | ||
1278 | udc_reset_ep_queue(udc, 0); | 1278 | udc_reset_ep_queue(udc, 0); |
1279 | 1279 | ||
1280 | /* We process some stardard setup requests here */ | ||
1280 | switch (setup->bRequest) { | 1281 | switch (setup->bRequest) { |
1281 | /* Request that need Data+Status phase from udc */ | ||
1282 | case USB_REQ_GET_STATUS: | 1282 | case USB_REQ_GET_STATUS: |
1283 | if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_STANDARD)) | 1283 | /* Data+Status phase from udc */ |
1284 | if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_MASK)) | ||
1284 | != (USB_DIR_IN | USB_TYPE_STANDARD)) | 1285 | != (USB_DIR_IN | USB_TYPE_STANDARD)) |
1285 | break; | 1286 | break; |
1286 | ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength); | 1287 | ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength); |
1287 | break; | 1288 | return; |
1288 | 1289 | ||
1289 | /* Requests that need Status phase from udc */ | ||
1290 | case USB_REQ_SET_ADDRESS: | 1290 | case USB_REQ_SET_ADDRESS: |
1291 | /* Status phase from udc */ | ||
1291 | if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | 1292 | if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD |
1292 | | USB_RECIP_DEVICE)) | 1293 | | USB_RECIP_DEVICE)) |
1293 | break; | 1294 | break; |
1294 | ch9setaddress(udc, wValue, wIndex, wLength); | 1295 | ch9setaddress(udc, wValue, wIndex, wLength); |
1295 | break; | 1296 | return; |
1296 | 1297 | ||
1297 | /* Handled by udc, no data, status by udc */ | ||
1298 | case USB_REQ_CLEAR_FEATURE: | 1298 | case USB_REQ_CLEAR_FEATURE: |
1299 | case USB_REQ_SET_FEATURE: | 1299 | case USB_REQ_SET_FEATURE: |
1300 | { /* status transaction */ | 1300 | /* Status phase from udc */ |
1301 | { | ||
1301 | int rc = -EOPNOTSUPP; | 1302 | int rc = -EOPNOTSUPP; |
1302 | 1303 | ||
1303 | if ((setup->bRequestType & USB_RECIP_MASK) | 1304 | if ((setup->bRequestType & (USB_RECIP_MASK | USB_TYPE_MASK)) |
1304 | == USB_RECIP_ENDPOINT) { | 1305 | == (USB_RECIP_ENDPOINT | USB_TYPE_STANDARD)) { |
1305 | int pipe = get_pipe_by_windex(wIndex); | 1306 | int pipe = get_pipe_by_windex(wIndex); |
1306 | struct fsl_ep *ep; | 1307 | struct fsl_ep *ep; |
1307 | 1308 | ||
@@ -1315,8 +1316,9 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1315 | ? 1 : 0); | 1316 | ? 1 : 0); |
1316 | spin_lock(&udc->lock); | 1317 | spin_lock(&udc->lock); |
1317 | 1318 | ||
1318 | } else if ((setup->bRequestType & USB_RECIP_MASK) | 1319 | } else if ((setup->bRequestType & (USB_RECIP_MASK |
1319 | == USB_RECIP_DEVICE) { | 1320 | | USB_TYPE_MASK)) == (USB_RECIP_DEVICE |
1321 | | USB_TYPE_STANDARD)) { | ||
1320 | /* Note: The driver has not include OTG support yet. | 1322 | /* Note: The driver has not include OTG support yet. |
1321 | * This will be set when OTG support is added */ | 1323 | * This will be set when OTG support is added */ |
1322 | if (!udc->gadget.is_otg) | 1324 | if (!udc->gadget.is_otg) |
@@ -1329,39 +1331,42 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1329 | USB_DEVICE_A_ALT_HNP_SUPPORT) | 1331 | USB_DEVICE_A_ALT_HNP_SUPPORT) |
1330 | udc->gadget.a_alt_hnp_support = 1; | 1332 | udc->gadget.a_alt_hnp_support = 1; |
1331 | rc = 0; | 1333 | rc = 0; |
1332 | } | 1334 | } else |
1335 | break; | ||
1336 | |||
1333 | if (rc == 0) { | 1337 | if (rc == 0) { |
1334 | if (ep0_prime_status(udc, EP_DIR_IN)) | 1338 | if (ep0_prime_status(udc, EP_DIR_IN)) |
1335 | ep0stall(udc); | 1339 | ep0stall(udc); |
1336 | } | 1340 | } |
1337 | break; | 1341 | return; |
1338 | } | 1342 | } |
1339 | /* Requests handled by gadget */ | ||
1340 | default: | ||
1341 | if (wLength) { | ||
1342 | /* Data phase from gadget, status phase from udc */ | ||
1343 | udc->ep0_dir = (setup->bRequestType & USB_DIR_IN) | ||
1344 | ? USB_DIR_IN : USB_DIR_OUT; | ||
1345 | spin_unlock(&udc->lock); | ||
1346 | if (udc->driver->setup(&udc->gadget, | ||
1347 | &udc->local_setup_buff) < 0) | ||
1348 | ep0stall(udc); | ||
1349 | spin_lock(&udc->lock); | ||
1350 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | ||
1351 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | ||
1352 | 1343 | ||
1353 | } else { | 1344 | default: |
1354 | /* No data phase, IN status from gadget */ | ||
1355 | udc->ep0_dir = USB_DIR_IN; | ||
1356 | spin_unlock(&udc->lock); | ||
1357 | if (udc->driver->setup(&udc->gadget, | ||
1358 | &udc->local_setup_buff) < 0) | ||
1359 | ep0stall(udc); | ||
1360 | spin_lock(&udc->lock); | ||
1361 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
1362 | } | ||
1363 | break; | 1345 | break; |
1364 | } | 1346 | } |
1347 | |||
1348 | /* Requests handled by gadget */ | ||
1349 | if (wLength) { | ||
1350 | /* Data phase from gadget, status phase from udc */ | ||
1351 | udc->ep0_dir = (setup->bRequestType & USB_DIR_IN) | ||
1352 | ? USB_DIR_IN : USB_DIR_OUT; | ||
1353 | spin_unlock(&udc->lock); | ||
1354 | if (udc->driver->setup(&udc->gadget, | ||
1355 | &udc->local_setup_buff) < 0) | ||
1356 | ep0stall(udc); | ||
1357 | spin_lock(&udc->lock); | ||
1358 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | ||
1359 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | ||
1360 | } else { | ||
1361 | /* No data phase, IN status from gadget */ | ||
1362 | udc->ep0_dir = USB_DIR_IN; | ||
1363 | spin_unlock(&udc->lock); | ||
1364 | if (udc->driver->setup(&udc->gadget, | ||
1365 | &udc->local_setup_buff) < 0) | ||
1366 | ep0stall(udc); | ||
1367 | spin_lock(&udc->lock); | ||
1368 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
1369 | } | ||
1365 | } | 1370 | } |
1366 | 1371 | ||
1367 | /* Process request for Data or Status phase of ep0 | 1372 | /* Process request for Data or Status phase of ep0 |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 72b4ebbf132d..1407ad1c8128 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -967,7 +967,7 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
967 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); | 967 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); |
968 | 968 | ||
969 | /* not all boards support pullup control */ | 969 | /* not all boards support pullup control */ |
970 | if (!udc->mach->udc_command) | 970 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
971 | return -EOPNOTSUPP; | 971 | return -EOPNOTSUPP; |
972 | 972 | ||
973 | is_active = (is_active != 0); | 973 | is_active = (is_active != 0); |
@@ -2309,7 +2309,7 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) | |||
2309 | { | 2309 | { |
2310 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); | 2310 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2311 | 2311 | ||
2312 | if (!udc->mach->udc_command) | 2312 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
2313 | WARN("USB host won't detect disconnect!\n"); | 2313 | WARN("USB host won't detect disconnect!\n"); |
2314 | pullup(udc, 0); | 2314 | pullup(udc, 0); |
2315 | 2315 | ||