]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/arm920t/s3c24x0/usb_ohci.c
imported Freescale specific U-Boot additions for i.MX28,... release L2.6.31_10.08.01
[karo-tx-uboot.git] / cpu / arm920t / s3c24x0 / usb_ohci.c
index 869ca79d032dcbf97e6561836306d483662d0f2e..7838014bd4fc636473e6b12ef941c6b2c3990a5b 100755 (executable)
@@ -2,7 +2,7 @@
  * URB OHCI HCD (Host Controller Driver) for USB on the S3C2400.
  *
  * (C) Copyright 2003
- * Gary Jennejohn, DENX Software Engineering <gj@denx.de>
+ * Gary Jennejohn, DENX Software Engineering <garyj@denx.de>
  *
  * Note: Much of this code has been derived from Linux 2.4
  * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
@@ -29,9 +29,7 @@
  */
 /*
  * IMPORTANT NOTES
- * 1 - you MUST define LITTLEENDIAN in the configuration file for the
- *     board or this driver will NOT work!
- * 2 - this driver is intended for use with USB Mass Storage Devices
+ * 1 - this driver is intended for use with USB Mass Storage Devices
  *     (BBB) ONLY. There is NO support for Interrupt or Isochronous pipes!
  */
 
@@ -58,8 +56,8 @@
 #define        OHCI_CONTROL_INIT \
        (OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
 
-#define readl(a) (*((vu_long *)(a)))
-#define writel(a, b) (*((vu_long *)(b)) = ((vu_long)a))
+#define readl(a) (*((volatile u32 *)(a)))
+#define writel(a, b) (*((volatile u32 *)(b)) = ((volatile u32)a))
 
 #define min_t(type,x,y) ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
 
@@ -498,7 +496,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
                if (ohci->ed_controltail == NULL) {
                        writel (ed, &ohci->regs->ed_controlhead);
                } else {
-                       ohci->ed_controltail->hwNextED = m32_swap (ed);
+                       ohci->ed_controltail->hwNextED = (__u32)m32_swap (ed);
                }
                ed->ed_prev = ohci->ed_controltail;
                if (!ohci->ed_controltail && !ohci->ed_rm_list[0] &&
@@ -514,7 +512,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
                if (ohci->ed_bulktail == NULL) {
                        writel (ed, &ohci->regs->ed_bulkhead);
                } else {
-                       ohci->ed_bulktail->hwNextED = m32_swap (ed);
+                       ohci->ed_bulktail->hwNextED = (__u32)m32_swap (ed);
                }
                ed->ed_prev = ohci->ed_bulktail;
                if (!ohci->ed_bulktail && !ohci->ed_rm_list[0] &&
@@ -606,7 +604,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe)
                ed->hwINFO = m32_swap (OHCI_ED_SKIP); /* skip ed */
                /* dummy td; end of td list for ed */
                td = td_alloc (usb_dev);
-               ed->hwTailP = m32_swap (td);
+               ed->hwTailP = (__u32)m32_swap (td);
                ed->hwHeadP = ed->hwTailP;
                ed->state = ED_UNLINK;
                ed->type = usb_pipetype (pipe);
@@ -654,7 +652,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        td->index = index;
        td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
-       if ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && usb_pipeout(urb_priv->pipe)) {
+       if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
                for (i = 0; i < len; i++)
                printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
                printf("\n");
@@ -663,13 +661,13 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        if (!len)
                data = 0;
 
-       td->hwINFO = m32_swap (info);
-       td->hwCBP = m32_swap (data);
+       td->hwINFO = (__u32)m32_swap (info);
+       td->hwCBP = (__u32)m32_swap (data);
        if (data)
-               td->hwBE = m32_swap (data + len - 1);
+               td->hwBE = (__u32)m32_swap (data + len - 1);
        else
                td->hwBE = 0;
-       td->hwNextTD = m32_swap (td_pt);
+       td->hwNextTD = (__u32)m32_swap (td_pt);
 
        /* append to queue */
        td->ed->hwTailP = td->hwNextTD;
@@ -756,7 +754,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = m32_swap (td->hwCBP);
 
 
-       if (!(usb_pipetype (lurb_priv->pipe) == PIPE_CONTROL &&
+       if (!(usb_pipecontrol(lurb_priv->pipe) &&
            ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
                if (tdBE != 0) {
                        if (td->hwCBP == 0)
@@ -971,13 +969,13 @@ static unsigned char root_hub_str_index1[] =
 
 /*-------------------------------------------------------------------------*/
 
-#define OK(x)                  len = (x); break
+#define OK(x)                  len = (x); break
 #ifdef DEBUG
-#define WR_RH_STAT(x)          {info("WR:status %#8x", (x));writel((x), &gohci.regs->roothub.status);}
-#define WR_RH_PORTSTAT(x)      {info("WR:portstatus[%d] %#8x", wIndex-1, (x));writel((x), &gohci.regs->roothub.portstatus[wIndex-1]);}
+#define WR_RH_STAT(x)          {info("WR:status %#8x", (x));writel((x), &gohci.regs->roothub.status);}
+#define WR_RH_PORTSTAT(x)      {info("WR:portstatus[%d] %#8x", wIndex-1, (x));writel((x), &gohci.regs->roothub.portstatus[wIndex-1]);}
 #else
-#define WR_RH_STAT(x)          writel((x), &gohci.regs->roothub.status)
-#define WR_RH_PORTSTAT(x)      writel((x), &gohci.regs->roothub.portstatus[wIndex-1])
+#define WR_RH_STAT(x)          writel((x), &gohci.regs->roothub.status)
+#define WR_RH_PORTSTAT(x)      writel((x), &gohci.regs->roothub.portstatus[wIndex-1])
 #endif
 #define RD_RH_STAT             roothub_status(&gohci)
 #define RD_RH_PORTSTAT         roothub_portstatus(&gohci,wIndex-1)
@@ -1025,7 +1023,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #else
        wait_ms(1);
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1163,7 +1161,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
                    data_buf [1] = 0x29;
                    data_buf [2] = temp & RH_A_NDP;
                    data_buf [3] = 0;
-                   if (temp & RH_A_PSM)        /* per-port power switching? */
+                   if (temp & RH_A_PSM)        /* per-port power switching? */
                        data_buf [3] |= 0x1;
                    if (temp & RH_A_NOCP)       /* no overcurrent reporting? */
                        data_buf [3] |= 0x10;
@@ -1188,9 +1186,9 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
                    OK (len);
                }
 
-       case RH_GET_CONFIGURATION:      *(__u8 *) data_buf = 0x01; OK (1);
+       case RH_GET_CONFIGURATION:      *(__u8 *) data_buf = 0x01; OK (1);
 
-       case RH_SET_CONFIGURATION:      WR_RH_STAT (0x10000); OK (0);
+       case RH_SET_CONFIGURATION:      WR_RH_STAT (0x10000); OK (0);
 
        default:
                dbg ("unsupported root hub command");
@@ -1259,7 +1257,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
        /* allow more time for a BULK device to react - some are slow */
 #define BULK_TO         5000   /* timeout in milliseconds */
-       if (usb_pipetype (pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = BULK_TO;
        else
                timeout = 100;