Merge git://git.denx.de/u-boot into x1
[platform/kernel/u-boot.git] / drivers / usb / usb_ohci.c
index 76c6390..e03371c 100644 (file)
@@ -73,7 +73,7 @@
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \
-    defined(CFG_OHCI_USE_NPS)
+    defined(CONFIG_SYS_OHCI_USE_NPS)
 # define OHCI_USE_NPS          /* force NoPowerSwitching mode */
 #endif
 
 /*
  * e.g. PCI controllers need this
  */
-#ifdef CFG_OHCI_SWAP_REG_ACCESS
+#ifdef CONFIG_SYS_OHCI_SWAP_REG_ACCESS
 # define readl(a) __swap_32(*((volatile u32 *)(a)))
 # define writel(a, b) (*((volatile u32 *)(b)) = __swap_32((volatile u32)a))
 #else
 # define readl(a) (*((volatile u32 *)(a)))
 # define writel(a, b) (*((volatile u32 *)(b)) = ((volatile u32)a))
-#endif /* CFG_OHCI_SWAP_REG_ACCESS */
+#endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */
 
 #define min_t(type, x, y) \
                    ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
@@ -130,13 +130,13 @@ static struct pci_device_id ehci_pci_ids[] = {
 #define info(format, arg...) do {} while (0)
 #endif
 
-#ifdef CFG_OHCI_BE_CONTROLLER
+#ifdef CONFIG_SYS_OHCI_BE_CONTROLLER
 # define m16_swap(x) cpu_to_be16(x)
 # define m32_swap(x) cpu_to_be32(x)
 #else
 # define m16_swap(x) cpu_to_le16(x)
 # define m32_swap(x) cpu_to_le32(x)
-#endif /* CFG_OHCI_BE_CONTROLLER */
+#endif /* CONFIG_SYS_OHCI_BE_CONTROLLER */
 
 /* global ohci_t */
 static ohci_t gohci;
@@ -856,8 +856,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");
@@ -983,7 +982,7 @@ static void dl_transfer_length(td_t *td)
        tdBE   = m32_swap(td->hwBE);
        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)
@@ -1096,8 +1095,7 @@ static int takeback_td(ohci_t *ohci, td_t *td_list)
        dbg("dl_done_list: processing TD %x, len %x\n",
                lurb_priv->td_cnt, lurb_priv->length);
 
-       if (ed->state != ED_NEW &&
-               (usb_pipetype(lurb_priv->pipe) != PIPE_INTERRUPT)) {
+       if (ed->state != ED_NEW && (!usb_pipeint(lurb_priv->pipe))) {
                edHeadP = m32_swap(ed->hwHeadP) & 0xfffffff0;
                edTailP = m32_swap(ed->hwTailP);
 
@@ -1287,7 +1285,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 #else
        wait_ms(1);
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1538,7 +1536,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;
@@ -1591,7 +1589,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 #endif
 
        /* free TDs in urb_priv */
-       if (usb_pipetype(pipe) != PIPE_INTERRUPT)
+       if (!usb_pipeint(pipe))
                urb_free_priv(urb);
        return 0;
 }
@@ -1892,13 +1890,13 @@ int usb_lowlevel_init(void)
        pci_dev_t pdev;
 #endif
 
-#ifdef CFG_USB_OHCI_CPU_INIT
+#ifdef CONFIG_SYS_USB_OHCI_CPU_INIT
        /* cpu dependant init */
        if (usb_cpu_init())
                return -1;
 #endif
 
-#ifdef CFG_USB_OHCI_BOARD_INIT
+#ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT
        /*  board dependant init */
        if (usb_board_init())
                return -1;
@@ -1946,21 +1944,21 @@ int usb_lowlevel_init(void)
        } else
                return -1;
 #else
-       gohci.regs = (struct ohci_regs *)CFG_USB_OHCI_REGS_BASE;
+       gohci.regs = (struct ohci_regs *)CONFIG_SYS_USB_OHCI_REGS_BASE;
 #endif
 
        gohci.flags = 0;
-       gohci.slot_name = CFG_USB_OHCI_SLOT_NAME;
+       gohci.slot_name = CONFIG_SYS_USB_OHCI_SLOT_NAME;
 
-       if (hc_reset(&gohci) < 0) {
-               hc_release_ohci(&gohci);
-               err("can't reset usb-%s", gohci.slot_name);
-#ifdef CFG_USB_OHCI_BOARD_INIT
+       if (hc_reset (&gohci) < 0) {
+               hc_release_ohci (&gohci);
+               err ("can't reset usb-%s", gohci.slot_name);
+#ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT
                /* board dependant cleanup */
                usb_board_init_fail();
 #endif
 
-#ifdef CFG_USB_OHCI_CPU_INIT
+#ifdef CONFIG_SYS_USB_OHCI_CPU_INIT
                /* cpu dependant cleanup */
                usb_cpu_init_fail();
 #endif
@@ -1971,12 +1969,12 @@ int usb_lowlevel_init(void)
                err("can't start usb-%s", gohci.slot_name);
                hc_release_ohci(&gohci);
                /* Initialization failed */
-#ifdef CFG_USB_OHCI_BOARD_INIT
+#ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT
                /* board dependant cleanup */
                usb_board_stop();
 #endif
 
-#ifdef CFG_USB_OHCI_CPU_INIT
+#ifdef CONFIG_SYS_USB_OHCI_CPU_INIT
                /* cpu dependant cleanup */
                usb_cpu_stop();
 #endif
@@ -2002,13 +2000,13 @@ int usb_lowlevel_stop(void)
        /* call hc_release_ohci() here ? */
        hc_reset(&gohci);
 
-#ifdef CFG_USB_OHCI_BOARD_INIT
+#ifdef CONFIG_SYS_USB_OHCI_BOARD_INIT
        /* board dependant cleanup */
        if (usb_board_stop())
                return -1;
 #endif
 
-#ifdef CFG_USB_OHCI_CPU_INIT
+#ifdef CONFIG_SYS_USB_OHCI_CPU_INIT
        /* cpu dependant cleanup */
        if (usb_cpu_stop())
                return -1;