diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-n8x0.c')
-rw-r--r-- | arch/arm/mach-omap2/board-n8x0.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 4cab0522d7c..da9bcb89899 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -37,6 +37,103 @@ static int slot1_cover_open; | |||
37 | static int slot2_cover_open; | 37 | static int slot2_cover_open; |
38 | static struct device *mmc_device; | 38 | static struct device *mmc_device; |
39 | 39 | ||
40 | #define TUSB6010_ASYNC_CS 1 | ||
41 | #define TUSB6010_SYNC_CS 4 | ||
42 | #define TUSB6010_GPIO_INT 58 | ||
43 | #define TUSB6010_GPIO_ENABLE 0 | ||
44 | #define TUSB6010_DMACHAN 0x3f | ||
45 | |||
46 | #if defined(CONFIG_USB_TUSB6010) || \ | ||
47 | defined(CONFIG_USB_TUSB6010_MODULE) | ||
48 | /* | ||
49 | * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and | ||
50 | * 1.5 V voltage regulators of PM companion chip. Companion chip will then | ||
51 | * provide then PGOOD signal to TUSB6010 which will release it from reset. | ||
52 | */ | ||
53 | static int tusb_set_power(int state) | ||
54 | { | ||
55 | int i, retval = 0; | ||
56 | |||
57 | if (state) { | ||
58 | gpio_set_value(TUSB6010_GPIO_ENABLE, 1); | ||
59 | msleep(1); | ||
60 | |||
61 | /* Wait until TUSB6010 pulls INT pin down */ | ||
62 | i = 100; | ||
63 | while (i && gpio_get_value(TUSB6010_GPIO_INT)) { | ||
64 | msleep(1); | ||
65 | i--; | ||
66 | } | ||
67 | |||
68 | if (!i) { | ||
69 | printk(KERN_ERR "tusb: powerup failed\n"); | ||
70 | retval = -ENODEV; | ||
71 | } | ||
72 | } else { | ||
73 | gpio_set_value(TUSB6010_GPIO_ENABLE, 0); | ||
74 | msleep(10); | ||
75 | } | ||
76 | |||
77 | return retval; | ||
78 | } | ||
79 | |||
80 | static struct musb_hdrc_config musb_config = { | ||
81 | .multipoint = 1, | ||
82 | .dyn_fifo = 1, | ||
83 | .num_eps = 16, | ||
84 | .ram_bits = 12, | ||
85 | }; | ||
86 | |||
87 | static struct musb_hdrc_platform_data tusb_data = { | ||
88 | #if defined(CONFIG_USB_MUSB_OTG) | ||
89 | .mode = MUSB_OTG, | ||
90 | #elif defined(CONFIG_USB_MUSB_PERIPHERAL) | ||
91 | .mode = MUSB_PERIPHERAL, | ||
92 | #else /* defined(CONFIG_USB_MUSB_HOST) */ | ||
93 | .mode = MUSB_HOST, | ||
94 | #endif | ||
95 | .set_power = tusb_set_power, | ||
96 | .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */ | ||
97 | .power = 100, /* Max 100 mA VBUS for host mode */ | ||
98 | .config = &musb_config, | ||
99 | }; | ||
100 | |||
101 | static void __init n8x0_usb_init(void) | ||
102 | { | ||
103 | int ret = 0; | ||
104 | static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; | ||
105 | |||
106 | /* PM companion chip power control pin */ | ||
107 | ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); | ||
108 | if (ret != 0) { | ||
109 | printk(KERN_ERR "Could not get TUSB power GPIO%i\n", | ||
110 | TUSB6010_GPIO_ENABLE); | ||
111 | return; | ||
112 | } | ||
113 | gpio_direction_output(TUSB6010_GPIO_ENABLE, 0); | ||
114 | |||
115 | tusb_set_power(0); | ||
116 | |||
117 | ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, | ||
118 | TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS, | ||
119 | TUSB6010_GPIO_INT, TUSB6010_DMACHAN); | ||
120 | if (ret != 0) | ||
121 | goto err; | ||
122 | |||
123 | printk(announce); | ||
124 | |||
125 | return; | ||
126 | |||
127 | err: | ||
128 | gpio_free(TUSB6010_GPIO_ENABLE); | ||
129 | } | ||
130 | #else | ||
131 | |||
132 | static void __init n8x0_usb_init(void) {} | ||
133 | |||
134 | #endif /*CONFIG_USB_TUSB6010 */ | ||
135 | |||
136 | |||
40 | static struct omap2_mcspi_device_config p54spi_mcspi_config = { | 137 | static struct omap2_mcspi_device_config p54spi_mcspi_config = { |
41 | .turbo_mode = 0, | 138 | .turbo_mode = 0, |
42 | .single_channel = 1, | 139 | .single_channel = 1, |
@@ -562,6 +659,7 @@ static void __init n8x0_init_machine(void) | |||
562 | n8x0_menelaus_init(); | 659 | n8x0_menelaus_init(); |
563 | n8x0_onenand_init(); | 660 | n8x0_onenand_init(); |
564 | n8x0_mmc_init(); | 661 | n8x0_mmc_init(); |
662 | n8x0_usb_init(); | ||
565 | } | 663 | } |
566 | 664 | ||
567 | MACHINE_START(NOKIA_N800, "Nokia N800") | 665 | MACHINE_START(NOKIA_N800, "Nokia N800") |