]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-n800-usb.c
ARM: OMAP: Partial revert for EAC IO address changes
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800-usb.c
index 7599f64775c508565c9d957fb627de9bf886123e..8250014bee6bdab7af34e23124e2896ed66010c2 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/gpio.h>
 #include <linux/usb/musb.h>
-#include <asm/arch/gpmc.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/pm.h>
+#include <mach/gpmc.h>
+#include <mach/pm.h>
 
 #define TUSB_ASYNC_CS          1
 #define TUSB_SYNC_CS           4
@@ -35,14 +35,58 @@ static int tusb_set_clock(struct clk *osc_ck, int state);
 #      define BOARD_MODE       MUSB_HOST
 #endif
 
+static struct musb_hdrc_eps_bits musb_eps[] = {
+       {       "ep1_tx", 5,    },
+       {       "ep1_rx", 5,    },
+       {       "ep2_tx", 5,    },
+       {       "ep2_rx", 5,    },
+       {       "ep3_tx", 3,    },
+       {       "ep3_rx", 3,    },
+       {       "ep4_tx", 3,    },
+       {       "ep4_rx", 3,    },
+       {       "ep5_tx", 2,    },
+       {       "ep5_rx", 2,    },
+       {       "ep6_tx", 2,    },
+       {       "ep6_rx", 2,    },
+       {       "ep7_tx", 2,    },
+       {       "ep7_rx", 2,    },
+       {       "ep8_tx", 2,    },
+       {       "ep8_rx", 2,    },
+       {       "ep9_tx", 2,    },
+       {       "ep9_rx", 2,    },
+       {       "ep10_tx", 2,   },
+       {       "ep10_rx", 2,   },
+       {       "ep11_tx", 2,   },
+       {       "ep11_rx", 2,   },
+       {       "ep12_tx", 2,   },
+       {       "ep12_rx", 2,   },
+       {       "ep13_tx", 2,   },
+       {       "ep13_rx", 2,   },
+       {       "ep14_tx", 2,   },
+       {       "ep14_rx", 2,   },
+       {       "ep15_tx", 2,   },
+       {       "ep15_rx", 2,   },
+};
+
+static struct musb_hdrc_config musb_config = {
+       .multipoint     = 1,
+       .dyn_fifo       = 1,
+       .soft_con       = 1,
+       .dma            = 1,
+       .num_eps        = 16,
+       .dma_channels   = 7,
+       .ram_bits       = 12,
+       .eps_bits       = musb_eps,
+};
+
 static struct musb_hdrc_platform_data tusb_data = {
        .mode           = BOARD_MODE,
-       .multipoint     = 1,
        .set_power      = tusb_set_power,
        .set_clock      = tusb_set_clock,
        .min_power      = 25,   /* x2 = 50 mA drawn from VBUS as peripheral */
        .power          = 100,  /* Max 100 mA VBUS for host mode */
        .clock          = "osc_ck",
+       .config         = &musb_config,
 };
 
 /*
@@ -55,12 +99,12 @@ static int tusb_set_power(int state)
        int i, retval = 0;
 
        if (state) {
-               omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 1);
+               gpio_set_value(GPIO_TUSB_ENABLE, 1);
                msleep(1);
 
                /* Wait until TUSB6010 pulls INT pin down */
                i = 100;
-               while (i && omap_get_gpio_datain(GPIO_TUSB_INT)) {
+               while (i && gpio_get_value(GPIO_TUSB_INT)) {
                        msleep(1);
                        i--;
                }
@@ -70,7 +114,7 @@ static int tusb_set_power(int state)
                        retval = -ENODEV;
                }
        } else {
-               omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 0);
+               gpio_set_value(GPIO_TUSB_ENABLE, 0);
                msleep(10);
        }
 
@@ -85,7 +129,7 @@ static int tusb_set_clock(struct clk *osc_ck, int state)
                if (osc_ck_on > 0)
                        return -ENODEV;
 
-               omap2_block_sleep();
+               //omap2_block_sleep();
                clk_enable(osc_ck);
                osc_ck_on = 1;
        } else {
@@ -94,7 +138,7 @@ static int tusb_set_clock(struct clk *osc_ck, int state)
 
                clk_disable(osc_ck);
                osc_ck_on = 0;
-               omap2_allow_sleep();
+               //omap2_allow_sleep();
        }
 
        return 0;
@@ -106,13 +150,13 @@ void __init n800_usb_init(void)
        static char     announce[] __initdata = KERN_INFO "TUSB 6010\n";
 
        /* PM companion chip power control pin */
-       ret = omap_request_gpio(GPIO_TUSB_ENABLE);
+       ret = gpio_request(GPIO_TUSB_ENABLE, "TUSB6010 enable");
        if (ret != 0) {
                printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
                       GPIO_TUSB_ENABLE);
                return;
        }
-       omap_set_gpio_direction(GPIO_TUSB_ENABLE, 0);
+       gpio_direction_output(GPIO_TUSB_ENABLE, 0);
 
        tusb_set_power(0);
 
@@ -127,5 +171,5 @@ void __init n800_usb_init(void)
        return;
 
 err:
-       omap_free_gpio(GPIO_TUSB_ENABLE);
+       gpio_free(GPIO_TUSB_ENABLE);
 }