gadget: struct device - replace bus_id with dev_name(), dev_set_name()
[safe/jmp/linux-2.6] / drivers / usb / gadget / s3c2410_udc.c
index 5acadda..c7e2556 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/list.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <linux/version.h>
 #include <linux/clk.h>
 
 #include <linux/debugfs.h>
 #include <asm/irq.h>
 #include <asm/system.h>
 #include <asm/unaligned.h>
-#include <asm/arch/irqs.h>
+#include <mach/irqs.h>
 
-#include <asm/arch/hardware.h>
-#include <asm/arch/regs-gpio.h>
+#include <mach/hardware.h>
+#include <mach/regs-gpio.h>
 
-#include <asm/plat-s3c24xx/regs-udc.h>
-#include <asm/plat-s3c24xx/udc.h>
+#include <plat/regs-udc.h>
+#include <plat/udc.h>
 
-#include <asm/mach-types.h>
 
 #include "s3c2410_udc.h"
 
@@ -888,12 +886,12 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep)
        }
 }
 
-#include <asm/arch/regs-irq.h>
+#include <mach/regs-irq.h>
 
 /*
  *     s3c2410_udc_irq - interrupt handler
  */
-static irqreturn_t s3c2410_udc_irq(int irq, void *_dev)
+static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev)
 {
        struct s3c2410_udc *dev = _dev;
        int usb_status;
@@ -1016,7 +1014,7 @@ static irqreturn_t s3c2410_udc_irq(int irq, void *_dev)
                }
        }
 
-       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq);
+       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD);
 
        /* Restore old index */
        udc_write(idx, S3C2410_UDC_INDEX_REG);
@@ -1511,7 +1509,11 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev)
        unsigned int            value;
 
        dprintk(DEBUG_NORMAL, "%s()\n", __func__);
+
+       /* some cpus cannot read from an line configured to IRQ! */
+       s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT);
        value = s3c2410_gpio_getpin(udc_info->vbus_pin);
+       s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2);
 
        if (udc_info->vbus_pin_inverted)
                value = !value;
@@ -1649,7 +1651,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
                return -EBUSY;
 
        if (!driver->bind || !driver->setup
-                       || driver->speed != USB_SPEED_FULL) {
+                       || driver->speed < USB_SPEED_FULL) {
                printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
                        driver->bind, driver->setup, driver->speed);
                return -EINVAL;
@@ -1725,7 +1727,7 @@ static struct s3c2410_udc memory = {
                .ep0            = &memory.ep[0].ep,
                .name           = gadget_name,
                .dev = {
-                       .bus_id         = "gadget",
+                       .init_name      = "gadget",
                },
        },
 
@@ -1892,11 +1894,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
                udc->regs_info = debugfs_create_file("registers", S_IRUGO,
                                s3c2410_udc_debugfs_root,
                                udc, &s3c2410_udc_debugfs_fops);
-               if (IS_ERR(udc->regs_info)) {
-                       dev_warn(dev, "debugfs file creation failed %ld\n",
-                                PTR_ERR(udc->regs_info));
-                       udc->regs_info = NULL;
-               }
+               if (!udc->regs_info)
+                       dev_warn(dev, "debugfs file creation failed\n");
        }
 
        dev_dbg(dev, "probe ok\n");
@@ -2043,3 +2042,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_VERSION(DRIVER_VERSION);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:s3c2410-usbgadget");
+MODULE_ALIAS("platform:s3c2440-usbgadget");