summaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-08-27 13:07:21 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-08-27 13:07:21 -0600
commit36a28654f1bb665c631e888b3917963d4d4388ca (patch)
tree80a289d2143f32638f1655c077a666e86ac1ddff /nuttx/drivers
parente84937a34489eab1669338bf8e3bb6c07e9d7295 (diff)
downloadpx4-nuttx-36a28654f1bb665c631e888b3917963d4d4388ca.tar.gz
px4-nuttx-36a28654f1bb665c631e888b3917963d4d4388ca.tar.bz2
px4-nuttx-36a28654f1bb665c631e888b3917963d4d4388ca.zip
SAMA5 OHCI+EHCI: Using cp15_clean instead of cp15_coherent; EHCI: Need to set alt pointer in order to handle short transfers.
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/usbhost/usbhost_enumerate.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_enumerate.c b/nuttx/drivers/usbhost/usbhost_enumerate.c
index 44e1439cd..bddff4d94 100644
--- a/nuttx/drivers/usbhost/usbhost_enumerate.c
+++ b/nuttx/drivers/usbhost/usbhost_enumerate.c
@@ -314,6 +314,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
size_t maxlen;
unsigned int cfglen;
uint8_t maxpacketsize;
+ uint8_t descsize;
uint8_t *buffer;
int ret;
@@ -364,25 +365,27 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
/* For high-speed, we must use 64 bytes */
maxpacketsize = 64;
+ descsize = USB_SIZEOF_DEVDESC;
}
else
{
/* Eight will work for both low- and full-speed */
maxpacketsize = 8;
+ descsize = 8;
}
/* Set the initial maximum packet size */
DRVR_EP0CONFIGURE(drvr, 0, maxpacketsize);
- /* Read first 'maxpacketsize' bytes of the device descriptor */
+ /* Read first 8 bytes of the device descriptor */
ctrlreq->type = USB_REQ_DIR_IN|USB_REQ_RECIPIENT_DEVICE;
ctrlreq->req = USB_REQ_GETDESCRIPTOR;
usbhost_putle16(ctrlreq->value, (USB_DESC_TYPE_DEVICE << 8));
usbhost_putle16(ctrlreq->index, 0);
- usbhost_putle16(ctrlreq->len, maxpacketsize);
+ usbhost_putle16(ctrlreq->len, descsize);
ret = DRVR_CTRLIN(drvr, ctrlreq, buffer);
if (ret != OK)
@@ -400,19 +403,23 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
DRVR_EP0CONFIGURE(drvr, 0, maxpacketsize);
- /* Now read the full device descriptor */
+ /* Now read the full device descriptor (if we have not already done so) */
- ctrlreq->type = USB_REQ_DIR_IN|USB_REQ_RECIPIENT_DEVICE;
- ctrlreq->req = USB_REQ_GETDESCRIPTOR;
- usbhost_putle16(ctrlreq->value, (USB_DESC_TYPE_DEVICE << 8));
- usbhost_putle16(ctrlreq->index, 0);
- usbhost_putle16(ctrlreq->len, USB_SIZEOF_DEVDESC);
-
- ret = DRVR_CTRLIN(drvr, ctrlreq, buffer);
- if (ret != OK)
+ if (descsize < USB_SIZEOF_DEVDESC)
{
- udbg("ERROR: GETDESCRIPTOR/DEVICE, DRVR_CTRLIN returned %d\n", ret);
- goto errout;
+ ctrlreq->type = USB_REQ_DIR_IN|USB_REQ_RECIPIENT_DEVICE;
+ ctrlreq->req = USB_REQ_GETDESCRIPTOR;
+ usbhost_putle16(ctrlreq->value, (USB_DESC_TYPE_DEVICE << 8));
+ usbhost_putle16(ctrlreq->index, 0);
+ usbhost_putle16(ctrlreq->len, USB_SIZEOF_DEVDESC);
+
+ ret = DRVR_CTRLIN(drvr, ctrlreq, buffer);
+ if (ret != OK)
+ {
+ udbg("ERROR: GETDESCRIPTOR/DEVICE, DRVR_CTRLIN returned %d\n",
+ ret);
+ goto errout;
+ }
}
/* Get class identification information from the device descriptor. Most