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;
 }

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
-~----------~----~----~----~------~----~------~--~---

Reply via email to