]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/host/ohci-hcd.c
powerpc: remove 4xx support
[u-boot] / drivers / usb / host / ohci-hcd.c
index 691ed1c900b837c7c61fa40dc2882add81942b45..fdfc870efa3e492b73ad76a04526a053b9747129 100644 (file)
@@ -41,6 +41,7 @@
 #endif
 
 #include <malloc.h>
+#include <memalign.h>
 #include <usb.h>
 
 #include "ohci.h"
 #endif
 
 #if defined(CONFIG_CPU_ARM920T) || \
-    defined(CONFIG_S3C24X0) || \
-    defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
-    defined(CONFIG_MPC5200) || \
     defined(CONFIG_SYS_OHCI_USE_NPS)
 # define OHCI_USE_NPS          /* force NoPowerSwitching mode */
 #endif
@@ -105,21 +103,13 @@ static struct pci_device_id ehci_pci_ids[] = {
 # define m32_swap(x) cpu_to_le32(x)
 #endif /* CONFIG_SYS_OHCI_BE_CONTROLLER */
 
-#ifdef CONFIG_DM_USB
-/*
- * We really should do proper cache flushing everywhere, but for now we only
- * do it for new (driver-model) usb code to avoid regressions.
- */
+/* We really should do proper cache flushing everywhere */
 #define flush_dcache_buffer(addr, size) \
        flush_dcache_range((unsigned long)(addr), \
                ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN))
 #define invalidate_dcache_buffer(addr, size) \
        invalidate_dcache_range((unsigned long)(addr), \
                ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN))
-#else
-#define flush_dcache_buffer(addr, size)
-#define invalidate_dcache_buffer(addr, size)
-#endif
 
 /* Do not use sizeof(ed / td) as our ed / td structs contain extra members */
 #define flush_dcache_ed(addr) flush_dcache_buffer(addr, 16)
@@ -689,7 +679,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
                ed->hwNextED = 0;
                flush_dcache_ed(ed);
                if (ohci->ed_controltail == NULL)
-                       ohci_writel(ed, &ohci->regs->ed_controlhead);
+                       ohci_writel((uintptr_t)ed, &ohci->regs->ed_controlhead);
                else
                        ohci->ed_controltail->hwNextED =
                                                   m32_swap((unsigned long)ed);
@@ -707,7 +697,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
                ed->hwNextED = 0;
                flush_dcache_ed(ed);
                if (ohci->ed_bulktail == NULL)
-                       ohci_writel(ed, &ohci->regs->ed_bulkhead);
+                       ohci_writel((uintptr_t)ed, &ohci->regs->ed_bulkhead);
                else
                        ohci->ed_bulktail->hwNextED =
                                                   m32_swap((unsigned long)ed);
@@ -760,18 +750,16 @@ static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed,
 
                /* ED might have been unlinked through another path */
                while (*ed_p != 0) {
-                       if (((struct ed *)
+                       if (((struct ed *)(uintptr_t)
                                        m32_swap((unsigned long)ed_p)) == ed) {
                                *ed_p = ed->hwNextED;
-#ifdef CONFIG_DM_USB
                                aligned_ed_p = (unsigned long)ed_p;
                                aligned_ed_p &= ~(ARCH_DMA_MINALIGN - 1);
                                flush_dcache_range(aligned_ed_p,
                                        aligned_ed_p + ARCH_DMA_MINALIGN);
-#endif
                                break;
                        }
-                       ed_p = &(((struct ed *)
+                       ed_p = &(((struct ed *)(uintptr_t)
                                     m32_swap((unsigned long)ed_p))->hwNextED);
                }
        }
@@ -807,7 +795,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
                if (ohci->ed_controltail == ed) {
                        ohci->ed_controltail = ed->ed_prev;
                } else {
-                       ((ed_t *)m32_swap(
+                       ((ed_t *)(uintptr_t)m32_swap(
                            *((__u32 *)&ed->hwNextED)))->ed_prev = ed->ed_prev;
                }
                break;
@@ -828,7 +816,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
                if (ohci->ed_bulktail == ed) {
                        ohci->ed_bulktail = ed->ed_prev;
                } else {
-                       ((ed_t *)m32_swap(
+                       ((ed_t *)(uintptr_t)m32_swap(
                             *((__u32 *)&ed->hwNextED)))->ed_prev = ed->ed_prev;
                }
                break;
@@ -923,12 +911,13 @@ static void td_fill(ohci_t *ohci, unsigned int info,
 
        /* fill the old dummy TD */
        td = urb_priv->td [index] =
-                            (td_t *)(m32_swap(urb_priv->ed->hwTailP) & ~0xf);
+                            (td_t *)(uintptr_t)
+                            (m32_swap(urb_priv->ed->hwTailP) & ~0xf);
 
        td->ed = urb_priv->ed;
        td->next_dl_td = NULL;
        td->index = index;
-       td->data = (__u32)data;
+       td->data = (uintptr_t)data;
 #ifdef OHCI_FILL_TRACE
        if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
                for (i = 0; i < len; i++)
@@ -972,7 +961,7 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
        flush_dcache_buffer(buffer, data_len);
 
        /* OHCI handles the DATA-toggles itself, we just use the USB-toggle
-        * bits for reseting */
+        * bits for resetting */
        if (usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe))) {
                toggle = TD_T_TOGGLE;
        } else {
@@ -1097,10 +1086,6 @@ static void check_status(td_t *td_list)
                                *phwHeadP &= m32_swap(0xfffffff2);
                        flush_dcache_ed(td_list->ed);
                }
-#ifdef CONFIG_MPC5200
-               td_list->hwNextTD = 0;
-               flush_dcache_td(td_list);
-#endif
        }
 }
 
@@ -1108,7 +1093,7 @@ static void check_status(td_t *td_list)
  * we reverse the reversed done-list */
 static td_t *dl_reverse_done_list(ohci_t *ohci)
 {
-       __u32 td_list_hc;
+       uintptr_t td_list_hc;
        td_t *td_rev = NULL;
        td_t *td_list = NULL;
 
@@ -1871,7 +1856,7 @@ static int hc_start(ohci_t *ohci)
        ohci_writel(0, &ohci->regs->ed_controlhead);
        ohci_writel(0, &ohci->regs->ed_bulkhead);
 
-       ohci_writel((__u32)ohci->hcca,
+       ohci_writel((uintptr_t)ohci->hcca,
                    &ohci->regs->hcca); /* reset clears this */
 
        fminterval = 0x2edf;
@@ -2214,6 +2199,7 @@ int ohci_register(struct udevice *dev, struct ohci_regs *regs)
        if (!ohci->hcca)
                return -ENOMEM;
        memset(ohci->hcca, 0, sizeof(struct ohci_hcca));
+       flush_dcache_hcca(ohci->hcca);
 
        if (hc_reset(ohci) < 0)
                return -EIO;