mpc5xxx: Remove all references to MGT5100
[platform/kernel/u-boot.git] / cpu / mpc5xxx / usb_ohci.c
index c774da3..7976e4d 100644 (file)
@@ -2,7 +2,7 @@
  * URB OHCI HCD (Host Controller Driver) for USB on the MPC5200.
  *
  * (C) Copyright 2003-2004
- * Gary Jennejohn, DENX Software Engineering <gj@denx.de>
+ * Gary Jennejohn, DENX Software Engineering <garyj@denx.de>
  *
  * (C) Copyright 2004
  * Pierre Aubert, Staubli Faverges <p.aubert@staubli.com>
@@ -56,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; })
 
 #define m16_swap(x) swap_16(x)
 #define m32_swap(x) swap_32(x)
 
-#ifdef CONFIG_MPC5200
 #define ohci_cpu_to_le16(x) (x)
 #define ohci_cpu_to_le32(x) (x)
-#else
-#define ohci_cpu_to_le16(x) swap_16(x)
-#define ohci_cpu_to_le32(x) swap_32(x)
-#endif
 
 /* global ohci_t */
 static ohci_t gohci;
@@ -660,7 +655,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");
@@ -761,7 +756,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = ohci_cpu_to_le32 (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)
@@ -803,9 +798,7 @@ static td_t * dl_reverse_done_list (ohci_t *ohci)
                                } else
                                        td_list->ed->hwHeadP &= ohci_cpu_to_le32 (0xfffffff2);
                        }
-#ifdef CONFIG_MPC5200
                        td_list->hwNextTD = 0;
-#endif
                }
 
                td_list->next_dl_td = td_rev;
@@ -1023,7 +1016,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 urb_priv.actual_length = 0;
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1248,7 +1241,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;
@@ -1576,9 +1569,13 @@ int usb_lowlevel_init(void)
        /* Set the USB Clock                                                 */
        *(vu_long *)MPC5XXX_CDM_48_FDC = CONFIG_USB_CLOCK;
 
+#ifdef CONFIG_PSC3_USB /* USB is using the alternate configuration */
+       /* remove all PSC3 USB bits first before ORing in ours */
+       *(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00804f00;
+#else
        /* remove all USB bits first before ORing in ours */
        *(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00807000;
-
+#endif
        /* Activate USB port                                                 */
        *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= CONFIG_USB_CONFIG;