Mike Lockwood wrote: > Hi Steve, > > Your patch looks good to me, so I just checked it in. It turns out my > full-speed changes were in the gadget driver, but I had missed this > part. >
Hi Mike, thanks for checking it in! I looked over drivers/usb/function/msm_hsusb.c, and it seems the same problem exists there. The only place where the maxpacket size is configured in h/w (ept->head->config) is in the function configure_endpoints(), but that is only called on a USB reset. So when an endpoint is enabled with a full-speed maxpacket size (64) it won't get changed in h/w from the default of 512. Steve > thanks, > Mike > > On Wed, Jun 10, 2009 at 7:50 PM, Mike Lockwood<lockw...@android.com> wrote: > >> Hi Steve, >> >> This sounds very familiar - I think I fixed this in the >> drivers/usb/function/msm_hsusb.c driver already, but the change must >> not have made it to the gadget driver yet. >> >> Thanks for that patch! I'll take a look and compare with the fixes I >> made in the function driver and make sure this gets fixed in the >> gadget driver. >> >> Mike >> >> On Wed, Jun 10, 2009 at 7:36 PM, stevel<ste...@sklembedded.com> wrote: >> >>> We've been using the G1 phone connected to a full-speed only usb host, >>> and the host is reporting babble errors. >>> >>> We investigated further and discovered the msm72k udc driver is not >>> updating the hardware maxpacket size for an endpoint from the default >>> of 512 bytes, which is valid for high-speed but not full-speed. When >>> the gadget layer issues ep->enable(), msm72k_enable() copies >>> wMaxPacketSize from the endpoint descriptor to ep->maxpacket but >>> doesn't update the maxpacket in hardware. So in hardware MPS is still >>> set to 512, but should be 64, and hence the babble errors. >>> >>> Attached is a patch that fixes this. Is this the proper way to fix, or >>> is there more that needs to be done to support USB 1.1 hosts? >>> >>> Thanks, >>> Steve >>> >>> >>> diff --git a/drivers/usb/gadget/msm72k_udc.c b/drivers/usb/gadget/ >>> msm72k_udc.c >>> index 9ae42d5..7127bee 100644 >>> --- a/drivers/usb/gadget/msm72k_udc.c >>> +++ b/drivers/usb/gadget/msm72k_udc.c >>> @@ -278,29 +278,29 @@ static void init_endpoints(struct usb_info *ui) >>> } >>> } >>> >>> -static void configure_endpoints(struct usb_info *ui) >>> +static void config_ept(struct msm_endpoint *ept) >>> { >>> - unsigned n; >>> - unsigned cfg; >>> + unsigned cfg = CONFIG_MAX_PKT(ept->ep.maxpacket) | CONFIG_ZLT; >>> >>> - for (n = 0; n < 32; n++) { >>> - struct msm_endpoint *ept = ui->ept + n; >>> + if (ept->bit == 0) >>> + /* ep0 out needs interrupt-on-setup */ >>> + cfg |= CONFIG_IOS; >>> >>> - cfg = CONFIG_MAX_PKT(ept->ep.maxpacket) | CONFIG_ZLT; >>> + ept->head->config = cfg; >>> + ept->head->next = TERMINATE; >>> >>> - if (ept->bit == 0) >>> - /* ep0 out needs interrupt-on-setup */ >>> - cfg |= CONFIG_IOS; >>> + if (ept->ep.maxpacket) >>> + INFO("ept #%d %s max:%d head:%p bit:%d\n", >>> + ept->num, (ept->flags & EPT_FLAG_IN) ? "in" : >>> "out", >>> + ept->ep.maxpacket, ept->head, ept->bit); >>> +} >>> >>> - ept->head->config = cfg; >>> - ept->head->next = TERMINATE; >>> +static void configure_endpoints(struct usb_info *ui) >>> +{ >>> + unsigned n; >>> >>> - if (ept->ep.maxpacket) >>> - INFO("ept #%d %s max:%d head:%p bit:%d\n", >>> - ept->num, >>> - (ept->flags & EPT_FLAG_IN) ? "in" : >>> "out", >>> - ept->ep.maxpacket, ept->head, ept- >>> >>>> bit); >>>> >>> - } >>> + for (n = 0; n < 32; n++) >>> + config_ept(ui->ept + n); >>> } >>> >>> struct usb_request *usb_ept_alloc_req(struct msm_endpoint *ept, >>> @@ -1298,6 +1298,7 @@ msm72k_enable(struct usb_ep *_ep, const struct >>> usb_endpoint_descriptor *desc) >>> desc->bmAttributes & >>> USB_ENDPOINT_XFERTYPE_MASK; >>> >>> _ep->maxpacket = le16_to_cpu(desc->wMaxPacketSize); >>> + config_ept(ept); >>> usb_ept_enable(ept, 1, ep_type); >>> return 0; >>> } >>> >>> >> >> -- >> Mike Lockwood >> Google android team >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel -~----------~----~----~----~------~----~------~--~---