]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/r8a66597-hcd.c
USB: remove info() macro from remaining usb drivers
[linux-2.6-omap-h63xx.git] / drivers / usb / host / r8a66597-hcd.c
index d5f02dddb1203ec31c151401aab80208388d1235..2a9bec264ad31a2e721040c58080929f0a78e3d1 100644 (file)
@@ -66,7 +66,7 @@ static unsigned short endian;
 module_param(endian, ushort, 0644);
 MODULE_PARM_DESC(endian, "data endian: big=256, little=0 (default=0)");
 
-static unsigned short irq_sense = INTL;
+static unsigned short irq_sense = 0xff;
 module_param(irq_sense, ushort, 0644);
 MODULE_PARM_DESC(irq_sense, "IRQ sense: low level=32, falling edge=0 "
                "(default=32)");
@@ -760,10 +760,12 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597,
                        if ((r8a66597->dma_map & (1 << i)) != 0)
                                continue;
 
-                       info("address %d, EndpointAddress 0x%02x use DMA FIFO",
-                            usb_pipedevice(urb->pipe),
-                            info->dir_in ? USB_ENDPOINT_DIR_MASK + info->epnum
-                                           : info->epnum);
+                       dev_info(&dev->udev->dev,
+                                "address %d, EndpointAddress 0x%02x use "
+                                "DMA FIFO\n", usb_pipedevice(urb->pipe),
+                                info->dir_in ?
+                                       USB_ENDPOINT_DIR_MASK + info->epnum
+                                       : info->epnum);
 
                        r8a66597->dma_map |= 1 << i;
                        dev->dma_map |= 1 << i;
@@ -964,11 +966,34 @@ static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum)
        disable_irq_nrdy(r8a66597, pipenum);
 }
 
+static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597)
+{
+       mod_timer(&r8a66597->rh_timer,
+                       jiffies + msecs_to_jiffies(R8A66597_RH_POLL_TIME));
+}
+
+static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port,
+                                       int connect)
+{
+       struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
+
+       rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
+       rh->scount = R8A66597_MAX_SAMPLING;
+       if (connect)
+               rh->port |= 1 << USB_PORT_FEAT_CONNECTION;
+       else
+               rh->port &= ~(1 << USB_PORT_FEAT_CONNECTION);
+       rh->port |= 1 << USB_PORT_FEAT_C_CONNECTION;
+
+       r8a66597_root_hub_start_polling(r8a66597);
+}
+
 /* this function must be called with interrupt disabled */
 static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port,
                                        u16 syssts)
 {
        if (syssts == SE0) {
+               r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
                r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
                return;
        }
@@ -1002,13 +1027,10 @@ static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port)
 {
        struct r8a66597_device *dev = r8a66597->root_hub[port].dev;
 
-       r8a66597->root_hub[port].port &= ~(1 << USB_PORT_FEAT_CONNECTION);
-       r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_C_CONNECTION);
-
        disable_r8a66597_pipe_all(r8a66597, dev);
        free_usb_address(r8a66597, dev);
 
-       r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
+       start_root_hub_sampling(r8a66597, port, 0);
 }
 
 /* this function must be called with interrupt disabled */
@@ -1551,23 +1573,6 @@ static void irq_pipe_nrdy(struct r8a66597 *r8a66597)
        }
 }
 
-static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597)
-{
-       mod_timer(&r8a66597->rh_timer,
-                       jiffies + msecs_to_jiffies(R8A66597_RH_POLL_TIME));
-}
-
-static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port)
-{
-       struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
-
-       rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
-       rh->scount = R8A66597_MAX_SAMPLING;
-       r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_CONNECTION)
-                                        | (1 << USB_PORT_FEAT_C_CONNECTION);
-       r8a66597_root_hub_start_polling(r8a66597);
-}
-
 static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
 {
        struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd);
@@ -1594,7 +1599,7 @@ static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
                        r8a66597_bclr(r8a66597, ATTCHE, INTENB2);
 
                        /* start usb bus sampling */
-                       start_root_hub_sampling(r8a66597, 1);
+                       start_root_hub_sampling(r8a66597, 1, 1);
                }
                if (mask2 & DTCH) {
                        r8a66597_write(r8a66597, ~DTCH, INTSTS2);
@@ -1609,7 +1614,7 @@ static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
                        r8a66597_bclr(r8a66597, ATTCHE, INTENB1);
 
                        /* start usb bus sampling */
-                       start_root_hub_sampling(r8a66597, 0);
+                       start_root_hub_sampling(r8a66597, 0, 1);
                }
                if (mask1 & DTCH) {
                        r8a66597_write(r8a66597, ~DTCH, INTSTS1);
@@ -2260,7 +2265,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
 #define resource_len(r) (((r)->end - (r)->start) + 1)
 static int __init r8a66597_probe(struct platform_device *pdev)
 {
-       struct resource *res = NULL;
+       struct resource *res = NULL, *ires;
        int irq = -1;
        void __iomem *reg = NULL;
        struct usb_hcd *hcd = NULL;
@@ -2283,13 +2288,16 @@ static int __init r8a66597_probe(struct platform_device *pdev)
                goto clean_up;
        }
 
-       irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
+       ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!ires) {
                ret = -ENODEV;
-               err("platform_get_irq error.");
+               err("platform_get_resource IORESOURCE_IRQ error.");
                goto clean_up;
        }
 
+       irq = ires->start;
+       irq_trigger = ires->flags & IRQF_TRIGGER_MASK;
+
        reg = ioremap(res->start, resource_len(res));
        if (reg == NULL) {
                ret = -ENOMEM;
@@ -2326,10 +2334,30 @@ static int __init r8a66597_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&r8a66597->child_device);
 
        hcd->rsrc_start = res->start;
-       if (irq_sense == INTL)
-               irq_trigger = IRQF_TRIGGER_LOW;
-       else
-               irq_trigger = IRQF_TRIGGER_FALLING;
+
+       /* irq_sense setting on cmdline takes precedence over resource
+        * settings, so the introduction of irqflags in IRQ resourse
+        * won't disturb existing setups */
+       switch (irq_sense) {
+               case INTL:
+                       irq_trigger = IRQF_TRIGGER_LOW;
+                       break;
+               case 0:
+                       irq_trigger = IRQF_TRIGGER_FALLING;
+                       break;
+               case 0xff:
+                       if (irq_trigger)
+                               irq_sense = (irq_trigger & IRQF_TRIGGER_LOW) ?
+                                           INTL : 0;
+                       else {
+                               irq_sense = INTL;
+                               irq_trigger = IRQF_TRIGGER_LOW;
+                       }
+                       break;
+               default:
+                       err("Unknown irq_sense value.");
+       }
+
        ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger);
        if (ret != 0) {
                err("Failed to add hcd");
@@ -2361,7 +2389,8 @@ static int __init r8a66597_init(void)
        if (usb_disabled())
                return -ENODEV;
 
-       info("driver %s, %s", hcd_name, DRIVER_VERSION);
+       printk(KERN_INFO KBUILD_MODNAME ": driver %s, %s\n", hcd_name,
+              DRIVER_VERSION);
        return platform_driver_register(&r8a66597_driver);
 }
 module_init(r8a66597_init);