generic: ar8216: add setup_port field to ar8xxx_chip
[openwrt.git] / target / linux / adm5120 / files / drivers / usb / host / adm5120-hcd.c
index 78b1aef..0412546 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ADM5120 HCD (Host Controller Driver) for USB
  *
- * Copyright (C) 2007,2008 Gabor Juhos <juhosg at openwrt.org>
+ * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
  *
  * This file was derived from: drivers/usb/host/ohci-hcd.c
  *   (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
@@ -35,8 +35,9 @@
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
 #include <linux/reboot.h>
+#include <linux/debugfs.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/system.h>
 #include <asm/unaligned.h>
@@ -45,8 +46,8 @@
 #include "../core/hcd.h"
 #include "../core/hub.h"
 
-#define DRIVER_VERSION "0.24.0"
-#define DRIVER_AUTHOR  "Gabor Juhos <juhosg at openwrt.org>"
+#define DRIVER_VERSION "0.27.0"
+#define DRIVER_AUTHOR  "Gabor Juhos <juhosg@openwrt.org>"
 #define DRIVER_DESC    "ADMtek USB 1.1 Host Controller Driver"
 
 /*-------------------------------------------------------------------------*/
 #define        OHCI_CONTROL_INIT       OHCI_CTRL_CBSR
 
 #define        ADMHC_INTR_INIT \
-               ( ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
-               | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI )
+               (ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
+               | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI)
 
 /*-------------------------------------------------------------------------*/
 
-static const char hcd_name [] = "admhc-hcd";
+static const char hcd_name[] = "admhc-hcd";
 
 #define        STATECHANGE_DELAY       msecs_to_jiffies(300)
 
@@ -127,7 +128,7 @@ static int admhc_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
                else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
                        && (urb->transfer_buffer_length
                                % usb_maxpacket(urb->dev, pipe,
-                                       usb_pipeout (pipe))) == 0)
+                                       usb_pipeout(pipe))) == 0)
                        td_cnt++;
                break;
        case PIPE_INTERRUPT:
@@ -301,8 +302,8 @@ sanitize:
                goto rescan;
        case ED_IDLE:           /* fully unlinked */
                if (list_empty(&ed->td_list)) {
-                       td_free (ahcd, ed->dummy);
-                       ed_free (ahcd, ed);
+                       td_free(ahcd, ed->dummy);
+                       ed_free(ahcd, ed);
                        break;
                }
                /* else FALL THROUGH */
@@ -339,7 +340,7 @@ static void admhc_usb_reset(struct admhcd *ahcd)
 #else
        /* FIXME */
        ahcd->host_control = ADMHC_BUSS_RESET;
-       admhc_writel(ahcd, ahcd->host_control ,&ahcd->regs->host_control);
+       admhc_writel(ahcd, ahcd->host_control&ahcd->regs->host_control);
 #endif
 }
 
@@ -641,7 +642,7 @@ static irqreturn_t admhc_irq(struct usb_hcd *hcd)
 {
        struct admhcd *ahcd = hcd_to_admhcd(hcd);
        struct admhcd_regs __iomem *regs = ahcd->regs;
-       u32 ints;
+       u32 ints;
 
        ints = admhc_readl(ahcd, &regs->int_status);
        if ((ints & ADMHC_INTR_INTA) == 0) {
@@ -777,7 +778,7 @@ static void admhc_stop(struct usb_hcd *hcd)
 
 /*-------------------------------------------------------------------------*/
 
-#ifdef CONFIG_MIPS_ADM5120
+#ifdef CONFIG_ADM5120
 #include "adm5120-drv.c"
 #define PLATFORM_DRIVER                usb_hcd_adm5120_driver
 #endif
@@ -797,7 +798,15 @@ static int __init admhc_hcd_mod_init(void)
 
        pr_info("%s: " DRIVER_INFO "\n", hcd_name);
        pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
-               sizeof (struct ed), sizeof (struct td));
+               sizeof(struct ed), sizeof(struct td));
+
+#ifdef DEBUG
+       admhc_debug_root = debugfs_create_dir("admhc", NULL);
+       if (!admhc_debug_root) {
+               ret = -ENOENT;
+               goto error_debug;
+       }
+#endif
 
 #ifdef PLATFORM_DRIVER
        ret = platform_driver_register(&PLATFORM_DRIVER);
@@ -810,6 +819,12 @@ static int __init admhc_hcd_mod_init(void)
 #ifdef PLATFORM_DRIVER
        platform_driver_unregister(&PLATFORM_DRIVER);
 error_platform:
+#endif
+
+#ifdef DEBUG
+       debugfs_remove(admhc_debug_root);
+       admhc_debug_root = NULL;
+error_debug:
 #endif
        return ret;
 }
@@ -818,6 +833,9 @@ module_init(admhc_hcd_mod_init);
 static void __exit admhc_hcd_mod_exit(void)
 {
        platform_driver_unregister(&PLATFORM_DRIVER);
+#ifdef DEBUG
+       debugfs_remove(admhc_debug_root);
+#endif
 }
 module_exit(admhc_hcd_mod_exit);
 
This page took 0.03226 seconds and 4 git commands to generate.