diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 19:50:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 19:50:35 -0500 |
commit | 3c0cb7c31c206aaedb967e44b98442bbeb17a6c4 (patch) | |
tree | 3ecba45d7ffae4fba4a5aafaef4af5b0b1105bde /arch/arm/mach-ux500/board-mop500.c | |
parent | f70f5b9dc74ca7d0a64c4ead3fb28da09dc1b234 (diff) | |
parent | 404a02cbd2ae8bf256a2fa1169bdfe86bb5ebb34 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (416 commits)
ARM: DMA: add support for DMA debugging
ARM: PL011: add DMA burst threshold support for ST variants
ARM: PL011: Add support for transmit DMA
ARM: PL011: Ensure IRQs are disabled in UART interrupt handler
ARM: PL011: Separate hardware FIFO size from TTY FIFO size
ARM: PL011: Allow better handling of vendor data
ARM: PL011: Ensure error flags are clear at startup
ARM: PL011: include revision number in boot-time port printk
ARM: vexpress: add sched_clock() for Versatile Express
ARM i.MX53: Make MX53 EVK bootable
ARM i.MX53: Some bug fix about MX53 MSL code
ARM: 6607/1: sa1100: Update platform device registration
ARM: 6606/1: sa1100: Fix platform device registration
ARM i.MX51: rename IPU irqs
ARM i.MX51: Add ipu clock support
ARM: imx/mx27_3ds: Add PMIC support
ARM: DMA: Replace page_to_dma()/dma_to_page() with pfn_to_dma()/dma_to_pfn()
mx51: fix usb clock support
MX51: Add support for usb host 2
arch/arm/plat-mxc/ehci.c: fix errors/typos
...
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 228 |
1 files changed, 62 insertions, 166 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index cac83a694880..a1c9ea1a66df 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -13,25 +13,26 @@ | |||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/i2c.h> | ||
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
17 | #include <linux/amba/bus.h> | 18 | #include <linux/amba/bus.h> |
18 | #include <linux/amba/pl022.h> | 19 | #include <linux/amba/pl022.h> |
19 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
20 | #include <linux/mfd/ab8500.h> | 21 | #include <linux/mfd/ab8500.h> |
21 | #include <linux/input/matrix_keypad.h> | 22 | #include <linux/mfd/tc3589x.h> |
22 | 23 | ||
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
24 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
25 | 26 | ||
26 | #include <plat/pincfg.h> | 27 | #include <plat/pincfg.h> |
27 | #include <plat/i2c.h> | 28 | #include <plat/i2c.h> |
28 | #include <plat/ske.h> | ||
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <mach/setup.h> | 31 | #include <mach/setup.h> |
32 | #include <mach/devices.h> | 32 | #include <mach/devices.h> |
33 | #include <mach/irqs.h> | 33 | #include <mach/irqs.h> |
34 | 34 | ||
35 | #include "devices-db8500.h" | ||
35 | #include "pins-db8500.h" | 36 | #include "pins-db8500.h" |
36 | #include "board-mop500.h" | 37 | #include "board-mop500.h" |
37 | 38 | ||
@@ -69,22 +70,12 @@ static pin_cfg_t mop500_pins[] = { | |||
69 | GPIO166_KP_O2, | 70 | GPIO166_KP_O2, |
70 | GPIO167_KP_O1, | 71 | GPIO167_KP_O1, |
71 | GPIO168_KP_O0, | 72 | GPIO168_KP_O0, |
72 | }; | ||
73 | 73 | ||
74 | static void ab4500_spi_cs_control(u32 command) | 74 | /* GPIO_EXP_INT */ |
75 | { | 75 | GPIO217_GPIO, |
76 | /* set the FRM signal, which is CS - TODO */ | ||
77 | } | ||
78 | 76 | ||
79 | struct pl022_config_chip ab4500_chip_info = { | 77 | /* STMPE1601 IRQ */ |
80 | .com_mode = INTERRUPT_TRANSFER, | 78 | GPIO218_GPIO | PIN_INPUT_PULLUP, |
81 | .iface = SSP_INTERFACE_MOTOROLA_SPI, | ||
82 | /* we can act as master only */ | ||
83 | .hierarchy = SSP_MASTER, | ||
84 | .slave_tx_disable = 0, | ||
85 | .rx_lev_trig = SSP_RX_1_OR_MORE_ELEM, | ||
86 | .tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC, | ||
87 | .cs_control = ab4500_spi_cs_control, | ||
88 | }; | 79 | }; |
89 | 80 | ||
90 | static struct ab8500_platform_data ab8500_platdata = { | 81 | static struct ab8500_platform_data ab8500_platdata = { |
@@ -93,9 +84,9 @@ static struct ab8500_platform_data ab8500_platdata = { | |||
93 | 84 | ||
94 | static struct resource ab8500_resources[] = { | 85 | static struct resource ab8500_resources[] = { |
95 | [0] = { | 86 | [0] = { |
96 | .start = IRQ_AB8500, | 87 | .start = IRQ_DB8500_AB8500, |
97 | .end = IRQ_AB8500, | 88 | .end = IRQ_DB8500_AB8500, |
98 | .flags = IORESOURCE_IRQ | 89 | .flags = IORESOURCE_IRQ |
99 | } | 90 | } |
100 | }; | 91 | }; |
101 | 92 | ||
@@ -109,19 +100,6 @@ struct platform_device ab8500_device = { | |||
109 | .resource = ab8500_resources, | 100 | .resource = ab8500_resources, |
110 | }; | 101 | }; |
111 | 102 | ||
112 | static struct spi_board_info ab8500_spi_devices[] = { | ||
113 | { | ||
114 | .modalias = "ab8500-spi", | ||
115 | .controller_data = &ab4500_chip_info, | ||
116 | .platform_data = &ab8500_platdata, | ||
117 | .max_speed_hz = 12000000, | ||
118 | .bus_num = 0, | ||
119 | .chip_select = 0, | ||
120 | .mode = SPI_MODE_3, | ||
121 | .irq = IRQ_DB8500_AB8500, | ||
122 | }, | ||
123 | }; | ||
124 | |||
125 | static struct pl022_ssp_controller ssp0_platform_data = { | 103 | static struct pl022_ssp_controller ssp0_platform_data = { |
126 | .bus_id = 0, | 104 | .bus_id = 0, |
127 | /* pl022 not yet supports dma */ | 105 | /* pl022 not yet supports dma */ |
@@ -132,6 +110,34 @@ static struct pl022_ssp_controller ssp0_platform_data = { | |||
132 | .num_chipselect = 5, | 110 | .num_chipselect = 5, |
133 | }; | 111 | }; |
134 | 112 | ||
113 | /* | ||
114 | * TC35892 | ||
115 | */ | ||
116 | |||
117 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) | ||
118 | { | ||
119 | mop500_sdi_tc35892_init(); | ||
120 | } | ||
121 | |||
122 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { | ||
123 | .gpio_base = MOP500_EGPIO(0), | ||
124 | .setup = mop500_tc35892_init, | ||
125 | }; | ||
126 | |||
127 | static struct tc3589x_platform_data mop500_tc35892_data = { | ||
128 | .block = TC3589x_BLOCK_GPIO, | ||
129 | .gpio = &mop500_tc35892_gpio_data, | ||
130 | .irq_base = MOP500_EGPIO_IRQ_BASE, | ||
131 | }; | ||
132 | |||
133 | static struct i2c_board_info mop500_i2c0_devices[] = { | ||
134 | { | ||
135 | I2C_BOARD_INFO("tc3589x", 0x42), | ||
136 | .irq = NOMADIK_GPIO_TO_IRQ(217), | ||
137 | .platform_data = &mop500_tc35892_data, | ||
138 | }, | ||
139 | }; | ||
140 | |||
135 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ | 141 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ |
136 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ | 142 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
137 | /* \ | 143 | /* \ |
@@ -161,159 +167,49 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | |||
161 | U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | 167 | U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); |
162 | U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | 168 | U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); |
163 | 169 | ||
164 | static struct amba_device *amba_devs[] __initdata = { | 170 | static void __init mop500_i2c_init(void) |
165 | &ux500_uart0_device, | 171 | { |
166 | &ux500_uart1_device, | 172 | db8500_add_i2c0(&u8500_i2c0_data); |
167 | &ux500_uart2_device, | 173 | db8500_add_i2c1(&u8500_i2c1_data); |
168 | &u8500_ssp0_device, | 174 | db8500_add_i2c2(&u8500_i2c2_data); |
169 | }; | 175 | db8500_add_i2c3(&u8500_i2c3_data); |
170 | 176 | } | |
171 | static const unsigned int ux500_keymap[] = { | ||
172 | KEY(2, 5, KEY_END), | ||
173 | KEY(4, 1, KEY_POWER), | ||
174 | KEY(3, 5, KEY_VOLUMEDOWN), | ||
175 | KEY(1, 3, KEY_3), | ||
176 | KEY(5, 2, KEY_RIGHT), | ||
177 | KEY(5, 0, KEY_9), | ||
178 | |||
179 | KEY(0, 5, KEY_MENU), | ||
180 | KEY(7, 6, KEY_ENTER), | ||
181 | KEY(4, 5, KEY_0), | ||
182 | KEY(6, 7, KEY_2), | ||
183 | KEY(3, 4, KEY_UP), | ||
184 | KEY(3, 3, KEY_DOWN), | ||
185 | |||
186 | KEY(6, 4, KEY_SEND), | ||
187 | KEY(6, 2, KEY_BACK), | ||
188 | KEY(4, 2, KEY_VOLUMEUP), | ||
189 | KEY(5, 5, KEY_1), | ||
190 | KEY(4, 3, KEY_LEFT), | ||
191 | KEY(3, 2, KEY_7), | ||
192 | }; | ||
193 | |||
194 | static const struct matrix_keymap_data ux500_keymap_data = { | ||
195 | .keymap = ux500_keymap, | ||
196 | .keymap_size = ARRAY_SIZE(ux500_keymap), | ||
197 | }; | ||
198 | 177 | ||
199 | /* | 178 | /* add any platform devices here - TODO */ |
200 | * Nomadik SKE keypad | 179 | static struct platform_device *platform_devs[] __initdata = { |
201 | */ | ||
202 | #define ROW_PIN_I0 164 | ||
203 | #define ROW_PIN_I1 163 | ||
204 | #define ROW_PIN_I2 162 | ||
205 | #define ROW_PIN_I3 161 | ||
206 | #define ROW_PIN_I4 156 | ||
207 | #define ROW_PIN_I5 155 | ||
208 | #define ROW_PIN_I6 154 | ||
209 | #define ROW_PIN_I7 153 | ||
210 | #define COL_PIN_O0 168 | ||
211 | #define COL_PIN_O1 167 | ||
212 | #define COL_PIN_O2 166 | ||
213 | #define COL_PIN_O3 165 | ||
214 | #define COL_PIN_O4 160 | ||
215 | #define COL_PIN_O5 159 | ||
216 | #define COL_PIN_O6 158 | ||
217 | #define COL_PIN_O7 157 | ||
218 | |||
219 | #define SKE_KPD_MAX_ROWS 8 | ||
220 | #define SKE_KPD_MAX_COLS 8 | ||
221 | |||
222 | static int ske_kp_rows[] = { | ||
223 | ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3, | ||
224 | ROW_PIN_I4, ROW_PIN_I5, ROW_PIN_I6, ROW_PIN_I7, | ||
225 | }; | 180 | }; |
226 | 181 | ||
227 | /* | 182 | static void __init mop500_spi_init(void) |
228 | * ske_set_gpio_row: request and set gpio rows | ||
229 | */ | ||
230 | static int ske_set_gpio_row(int gpio) | ||
231 | { | 183 | { |
232 | int ret; | 184 | db8500_add_ssp0(&ssp0_platform_data); |
233 | |||
234 | ret = gpio_request(gpio, "ske-kp"); | ||
235 | if (ret < 0) { | ||
236 | pr_err("ske_set_gpio_row: gpio request failed\n"); | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | ret = gpio_direction_output(gpio, 1); | ||
241 | if (ret < 0) { | ||
242 | pr_err("ske_set_gpio_row: gpio direction failed\n"); | ||
243 | gpio_free(gpio); | ||
244 | } | ||
245 | |||
246 | return ret; | ||
247 | } | 185 | } |
248 | 186 | ||
249 | /* | 187 | static void __init mop500_uart_init(void) |
250 | * ske_kp_init - enable the gpio configuration | ||
251 | */ | ||
252 | static int ske_kp_init(void) | ||
253 | { | 188 | { |
254 | int ret, i; | 189 | db8500_add_uart0(); |
255 | 190 | db8500_add_uart1(); | |
256 | for (i = 0; i < SKE_KPD_MAX_ROWS; i++) { | 191 | db8500_add_uart2(); |
257 | ret = ske_set_gpio_row(ske_kp_rows[i]); | ||
258 | if (ret < 0) { | ||
259 | pr_err("ske_kp_init: failed init\n"); | ||
260 | return ret; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | return 0; | ||
265 | } | 192 | } |
266 | 193 | ||
267 | static struct ske_keypad_platform_data ske_keypad_board = { | ||
268 | .init = ske_kp_init, | ||
269 | .keymap_data = &ux500_keymap_data, | ||
270 | .no_autorepeat = true, | ||
271 | .krow = SKE_KPD_MAX_ROWS, /* 8x8 matrix */ | ||
272 | .kcol = SKE_KPD_MAX_COLS, | ||
273 | .debounce_ms = 40, /* in millsecs */ | ||
274 | }; | ||
275 | |||
276 | |||
277 | |||
278 | /* add any platform devices here - TODO */ | ||
279 | static struct platform_device *platform_devs[] __initdata = { | ||
280 | &u8500_i2c0_device, | ||
281 | &ux500_i2c1_device, | ||
282 | &ux500_i2c2_device, | ||
283 | &ux500_i2c3_device, | ||
284 | &ux500_ske_keypad_device, | ||
285 | }; | ||
286 | |||
287 | static void __init u8500_init_machine(void) | 194 | static void __init u8500_init_machine(void) |
288 | { | 195 | { |
289 | int i; | ||
290 | |||
291 | u8500_init_devices(); | 196 | u8500_init_devices(); |
292 | 197 | ||
293 | nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins)); | 198 | nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins)); |
294 | 199 | ||
295 | u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data; | ||
296 | ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; | ||
297 | ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; | ||
298 | ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data; | ||
299 | ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board; | ||
300 | |||
301 | u8500_ssp0_device.dev.platform_data = &ssp0_platform_data; | ||
302 | |||
303 | /* Register the active AMBA devices on this board */ | ||
304 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) | ||
305 | amba_device_register(amba_devs[i], &iomem_resource); | ||
306 | |||
307 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); | 200 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); |
308 | 201 | ||
202 | mop500_i2c_init(); | ||
309 | mop500_sdi_init(); | 203 | mop500_sdi_init(); |
204 | mop500_spi_init(); | ||
205 | mop500_uart_init(); | ||
206 | |||
207 | mop500_keypad_init(); | ||
208 | |||
209 | platform_device_register(&ab8500_device); | ||
310 | 210 | ||
311 | /* If HW is early drop (ED) or V1.0 then use SPI to access AB8500 */ | 211 | i2c_register_board_info(0, mop500_i2c0_devices, |
312 | if (cpu_is_u8500ed() || cpu_is_u8500v10()) | 212 | ARRAY_SIZE(mop500_i2c0_devices)); |
313 | spi_register_board_info(ab8500_spi_devices, | ||
314 | ARRAY_SIZE(ab8500_spi_devices)); | ||
315 | else /* If HW is v.1.1 or later use I2C to access AB8500 */ | ||
316 | platform_device_register(&ab8500_device); | ||
317 | } | 213 | } |
318 | 214 | ||
319 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | 215 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |