Jean-Christophe PLAGNIOL-VILLARD wrote:
On 20:56 Mon 29 Jun , Prafulla Wadaskar wrote:
Signed-off-by: Prafulla Wadaskar <prafu...@marvell.com>
---
drivers/usb/host/ehci-hcd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Remy could you look the marvell usb patch?
I think that this one is correct but not yet tested
Best Regards,
J.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Not yet tested. Cleanup code and fix requestType calculation
Signed-off-by: Michael Trimarchi <mich...@panicking.kicks-ass.org>
---
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index bbd547b..ed36335 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -317,16 +317,21 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
uint32_t endpt, token, usbsts;
uint32_t c, toggle;
uint32_t cmd;
+ uint16_t wValue, wIndex, wLength;
int ret = 0;
+ wIndex = le16_to_cpu(req->index);
+ wValue = le16_to_cpu(req->value);
+ wLength = le16_to_cpu(req->length);
+
debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe,
buffer, length, req);
if (req != NULL)
debug("req=%u (%#x), type=%u (%#x), value=%u (%#x), index=%u\n",
req->request, req->request,
req->requesttype, req->requesttype,
- le16_to_cpu(req->value), le16_to_cpu(req->value),
- le16_to_cpu(req->index));
+ wValue, wValue,
+ wIndex);
qh = ehci_alloc(sizeof(struct QH), 32);
if (qh == NULL) {
@@ -535,26 +540,31 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
int len, srclen;
uint32_t reg;
uint32_t *status_reg;
+ uint16_t wIndex, wValue, wLength;
+
+ wIndex = le16_to_cpu(req->index);
+ wValue = le16_to_cpu(req->value);
+ wLength = le16_to_cpu(req->length);
+
- if (le16_to_cpu(req->index) >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) {
+ if (wIndex >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) {
printf("The request port(%d) is not configured\n",
- le16_to_cpu(req->index) - 1);
+ wIndex - 1);
return -1;
}
- status_reg = (uint32_t *)&hcor->or_portsc[
- le16_to_cpu(req->index) - 1];
+ status_reg = (uint32_t *)&hcor->or_portsc[wIndex - 1];
srclen = 0;
debug("req=%u (%#x), type=%u (%#x), value=%u, index=%u\n",
req->request, req->request,
req->requesttype, req->requesttype,
- le16_to_cpu(req->value), le16_to_cpu(req->index));
+ wValue, wIndex);
- typeReq = req->request << 8 | req->requesttype;
+ typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) {
+ switch (typeReq) {
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
- switch (le16_to_cpu(req->value) >> 8) {
+ switch (wValue >> 8) {
case USB_DT_DEVICE:
debug("USB_DT_DEVICE request\n");
srcptr = &descriptor.device;
@@ -567,7 +577,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
break;
case USB_DT_STRING:
debug("USB_DT_STRING config\n");
- switch (le16_to_cpu(req->value) & 0xff) {
+ switch (wValue & 0xff) {
case 0: /* Language */
srcptr = "\4\3\1\0";
srclen = 4;
@@ -584,30 +594,30 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
break;
default:
debug("unknown value DT_STRING %x\n",
- le16_to_cpu(req->value));
+ wValue);
goto unknown;
}
break;
default:
- debug("unknown value %x\n", le16_to_cpu(req->value));
+ debug("unknown value %x\n", wValue);
goto unknown;
}
break;
case USB_REQ_GET_DESCRIPTOR | ((USB_DIR_IN | USB_RT_HUB) << 8):
- switch (le16_to_cpu(req->value) >> 8) {
+ switch (wValue >> 8) {
case USB_DT_HUB:
debug("USB_DT_HUB config\n");
srcptr = &descriptor.hub;
srclen = 0x8;
break;
default:
- debug("unknown value %x\n", le16_to_cpu(req->value));
+ debug("unknown value %x\n", wValue);
goto unknown;
}
break;
case USB_REQ_SET_ADDRESS | (USB_RECIP_DEVICE << 8):
debug("USB_REQ_SET_ADDRESS\n");
- rootdev = le16_to_cpu(req->value);
+ rootdev = wValue;
break;
case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:
debug("USB_REQ_SET_CONFIGURATION\n");
@@ -631,7 +641,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
if (reg & EHCI_PS_OCA)
tmpbuf[0] |= USB_PORT_STAT_OVERCURRENT;
if (reg & EHCI_PS_PR &&
- (portreset & (1 << le16_to_cpu(req->index)))) {
+ (portreset & (1 << wIndex))) {
int ret;
/* force reset to complete */
reg = reg & ~(EHCI_PS_PR | EHCI_PS_CLEAR);
@@ -641,7 +651,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
tmpbuf[0] |= USB_PORT_STAT_RESET;
else
printf("port(%d) reset error\n",
- le16_to_cpu(req->index) - 1);
+ wIndex - 1);
}
if (reg & EHCI_PS_PP)
tmpbuf[1] |= USB_PORT_STAT_POWER >> 8;
@@ -668,7 +678,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
tmpbuf[2] |= USB_PORT_STAT_C_ENABLE;
if (reg & EHCI_PS_OCC)
tmpbuf[2] |= USB_PORT_STAT_C_OVERCURRENT;
- if (portreset & (1 << le16_to_cpu(req->index)))
+ if (portreset & (1 << wIndex))
tmpbuf[2] |= USB_PORT_STAT_C_RESET;
srcptr = tmpbuf;
@@ -677,7 +687,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
case USB_REQ_SET_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
reg = ehci_readl(status_reg);
reg &= ~EHCI_PS_CLEAR;
- switch (le16_to_cpu(req->value)) {
+ switch (wValue) {
case USB_PORT_FEAT_ENABLE:
reg |= EHCI_PS_PE;
ehci_writel(status_reg, reg);
@@ -708,11 +718,11 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
* root
*/
wait_ms(50);
- portreset |= 1 << le16_to_cpu(req->index);
+ portreset |= 1 << wIndex;
}
break;
default:
- debug("unknown feature %x\n", le16_to_cpu(req->value));
+ debug("unknown feature %x\n", wValue);
goto unknown;
}
/* unblock posted writes */
@@ -720,7 +730,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
break;
case USB_REQ_CLEAR_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
reg = ehci_readl(status_reg);
- switch (le16_to_cpu(req->value)) {
+ switch (wValue) {
case USB_PORT_FEAT_ENABLE:
reg &= ~EHCI_PS_PE;
break;
@@ -737,10 +747,10 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
reg = (reg & ~EHCI_PS_CLEAR) | EHCI_PS_OCC;
break;
case USB_PORT_FEAT_C_RESET:
- portreset &= ~(1 << le16_to_cpu(req->index));
+ portreset &= ~(1 << wIndex);
break;
default:
- debug("unknown feature %x\n", le16_to_cpu(req->value));
+ debug("unknown feature %x\n", wValue);
goto unknown;
}
ehci_writel(status_reg, reg);
@@ -753,7 +763,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
}
wait_ms(1);
- len = min3(srclen, le16_to_cpu(req->length), length);
+ len = min3(srclen, wLength, length);
if (srcptr != NULL && len > 0)
memcpy(buffer, srcptr, len);
else
@@ -765,8 +775,8 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
unknown:
debug("requesttype=%x, request=%x, value=%x, index=%x, length=%x\n",
- req->requesttype, req->request, le16_to_cpu(req->value),
- le16_to_cpu(req->index), le16_to_cpu(req->length));
+ req->requesttype, req->request, wValue,
+ wIndex, wLength);
dev->act_len = 0;
dev->status = USB_ST_STALLED;
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot