USB: musb: make HAVE_CLK support optional
[safe/jmp/linux-2.6] / drivers / usb / musb / blackfin.c
index eed35c9..fcec87e 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/list.h>
-#include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
 
@@ -41,9 +40,11 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
        dump_fifo_data(src, len);
 
        if (unlikely((unsigned long)src & 0x01))
-               outsw_8(fifo, src, len & 0x01 ? (len >> 1) + 1 : len >> 1);
+               outsw_8((unsigned long)fifo, src,
+                       len & 0x01 ? (len >> 1) + 1 : len >> 1);
        else
-               outsw(fifo, src, len & 0x01 ? (len >> 1) + 1 : len >> 1);
+               outsw((unsigned long)fifo, src,
+                       len & 0x01 ? (len >> 1) + 1 : len >> 1);
 }
 
 /*
@@ -54,8 +55,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
        void __iomem *fifo = hw_ep->fifo;
        u8 epnum = hw_ep->epnum;
        u16 dma_reg = 0;
-       int i;
-       u16 *data;
 
        DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
                        'R', hw_ep->epnum, fifo, len, dst);
@@ -96,9 +95,11 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
        SSYNC();
 #else
        if (unlikely((unsigned long)dst & 0x01))
-               insw_8(fifo, dst, len & 0x01 ? (len >> 1) + 1 : len >> 1);
+               insw_8((unsigned long)fifo, dst,
+                       len & 0x01 ? (len >> 1) + 1 : len >> 1);
        else
-               insw(fifo, dst, len & 0x01 ? (len >> 1) + 1 : len >> 1);
+               insw((unsigned long)fifo, dst,
+                       len & 0x01 ? (len >> 1) + 1 : len >> 1);
 #endif
 
        dump_fifo_data(dst, len);
@@ -141,7 +142,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
        u16 val;
 
        spin_lock_irqsave(&musb->lock, flags);
-       switch (musb->xceiv.state) {
+       switch (musb->xceiv->state) {
        case OTG_STATE_A_IDLE:
        case OTG_STATE_A_WAIT_BCON:
                /* Start a new session */
@@ -152,7 +153,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
                val = musb_readw(musb->mregs, MUSB_DEVCTL);
                if (!(val & MUSB_DEVCTL_BDEVICE)) {
                        gpio_set_value(musb->config->gpio_vrsel, 1);
-                       musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+                       musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
                } else {
                        gpio_set_value(musb->config->gpio_vrsel, 0);
 
@@ -245,6 +246,11 @@ int __init musb_platform_init(struct musb *musb)
        }
        gpio_direction_output(musb->config->gpio_vrsel, 0);
 
+       usb_nop_xceiv_register();
+       musb->xceiv = otg_get_transceiver();
+       if (!musb->xceiv)
+               return -ENODEV;
+
        if (ANOMALY_05000346) {
                bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
                SSYNC();
@@ -289,7 +295,7 @@ int __init musb_platform_init(struct musb *musb)
                        musb_conn_timer_handler, (unsigned long) musb);
        }
        if (is_peripheral_enabled(musb))
-               musb->xceiv.set_power = bfin_set_power;
+               musb->xceiv->set_power = bfin_set_power;
 
        musb->isr = blackfin_interrupt;