2 * Copyright (C) 2008-2009 ST-Ericsson
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <linux/platform_device.h>
16 #include <linux/i2c.h>
17 #include <linux/gpio.h>
18 #include <linux/amba/bus.h>
19 #include <linux/amba/pl022.h>
20 #include <linux/spi/spi.h>
21 #include <linux/mfd/ab8500.h>
22 #include <linux/mfd/tc3589x.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
27 #include <plat/pincfg.h>
31 #include <mach/hardware.h>
32 #include <mach/setup.h>
33 #include <mach/devices.h>
34 #include <mach/irqs.h>
36 #include "devices-db8500.h"
37 #include "pins-db8500.h"
38 #include "board-mop500.h"
40 static pin_cfg_t mop500_pins
[] = {
75 GPIO217_GPIO
, /* GPIO_EXP_INT */
78 static struct ab8500_platform_data ab8500_platdata
= {
79 .irq_base
= MOP500_AB8500_IRQ_BASE
,
82 static struct resource ab8500_resources
[] = {
84 .start
= IRQ_DB8500_AB8500
,
85 .end
= IRQ_DB8500_AB8500
,
86 .flags
= IORESOURCE_IRQ
90 struct platform_device ab8500_device
= {
94 .platform_data
= &ab8500_platdata
,
97 .resource
= ab8500_resources
,
100 static struct pl022_ssp_controller ssp0_platform_data
= {
102 /* pl022 not yet supports dma */
104 /* on this platform, gpio 31,142,144,214 &
105 * 224 are connected as chip selects
114 static void mop500_tc35892_init(struct tc3589x
*tc3589x
, unsigned int base
)
116 mop500_sdi_tc35892_init();
119 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data
= {
120 .gpio_base
= MOP500_EGPIO(0),
121 .setup
= mop500_tc35892_init
,
124 static struct tc3589x_platform_data mop500_tc35892_data
= {
125 .gpio
= &mop500_tc35892_gpio_data
,
126 .irq_base
= MOP500_EGPIO_IRQ_BASE
,
129 static struct i2c_board_info mop500_i2c0_devices
[] = {
131 I2C_BOARD_INFO("tc3589x", 0x42),
132 .irq
= NOMADIK_GPIO_TO_IRQ(217),
133 .platform_data
= &mop500_tc35892_data
,
137 #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
138 static struct nmk_i2c_controller u8500_i2c##id##_data = { \
140 * slave data setup time, which is \
141 * 250 ns,100ns,10ns which is 14,6,2 \
142 * respectively for a 48 Mhz \
146 /* Tx FIFO threshold */ \
148 /* Rx FIFO threshold */ \
150 /* std. mode operation */ \
156 * The board uses 4 i2c controllers, initialize all of
157 * them with slave data setup time of 250 ns,
158 * Tx & Rx FIFO threshold values as 1 and standard
161 U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
162 U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
163 U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
164 U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
166 static void __init
mop500_i2c_init(void)
168 db8500_add_i2c0(&u8500_i2c0_data
);
169 db8500_add_i2c1(&u8500_i2c1_data
);
170 db8500_add_i2c2(&u8500_i2c2_data
);
171 db8500_add_i2c3(&u8500_i2c3_data
);
174 static const unsigned int ux500_keymap
[] = {
176 KEY(4, 1, KEY_POWER
),
177 KEY(3, 5, KEY_VOLUMEDOWN
),
179 KEY(5, 2, KEY_RIGHT
),
183 KEY(7, 6, KEY_ENTER
),
191 KEY(4, 2, KEY_VOLUMEUP
),
197 static const struct matrix_keymap_data ux500_keymap_data
= {
198 .keymap
= ux500_keymap
,
199 .keymap_size
= ARRAY_SIZE(ux500_keymap
),
205 #define ROW_PIN_I0 164
206 #define ROW_PIN_I1 163
207 #define ROW_PIN_I2 162
208 #define ROW_PIN_I3 161
209 #define ROW_PIN_I4 156
210 #define ROW_PIN_I5 155
211 #define ROW_PIN_I6 154
212 #define ROW_PIN_I7 153
213 #define COL_PIN_O0 168
214 #define COL_PIN_O1 167
215 #define COL_PIN_O2 166
216 #define COL_PIN_O3 165
217 #define COL_PIN_O4 160
218 #define COL_PIN_O5 159
219 #define COL_PIN_O6 158
220 #define COL_PIN_O7 157
222 #define SKE_KPD_MAX_ROWS 8
223 #define SKE_KPD_MAX_COLS 8
225 static int ske_kp_rows
[] = {
226 ROW_PIN_I0
, ROW_PIN_I1
, ROW_PIN_I2
, ROW_PIN_I3
,
227 ROW_PIN_I4
, ROW_PIN_I5
, ROW_PIN_I6
, ROW_PIN_I7
,
231 * ske_set_gpio_row: request and set gpio rows
233 static int ske_set_gpio_row(int gpio
)
237 ret
= gpio_request(gpio
, "ske-kp");
239 pr_err("ske_set_gpio_row: gpio request failed\n");
243 ret
= gpio_direction_output(gpio
, 1);
245 pr_err("ske_set_gpio_row: gpio direction failed\n");
253 * ske_kp_init - enable the gpio configuration
255 static int ske_kp_init(void)
259 for (i
= 0; i
< SKE_KPD_MAX_ROWS
; i
++) {
260 ret
= ske_set_gpio_row(ske_kp_rows
[i
]);
262 pr_err("ske_kp_init: failed init\n");
270 static struct ske_keypad_platform_data ske_keypad_board
= {
272 .keymap_data
= &ux500_keymap_data
,
273 .no_autorepeat
= true,
274 .krow
= SKE_KPD_MAX_ROWS
, /* 8x8 matrix */
275 .kcol
= SKE_KPD_MAX_COLS
,
276 .debounce_ms
= 40, /* in millsecs */
281 /* add any platform devices here - TODO */
282 static struct platform_device
*platform_devs
[] __initdata
= {
283 &ux500_ske_keypad_device
,
286 static void __init
mop500_spi_init(void)
288 db8500_add_ssp0(&ssp0_platform_data
);
291 static void __init
mop500_uart_init(void)
298 static void __init
u8500_init_machine(void)
300 u8500_init_devices();
302 nmk_config_pins(mop500_pins
, ARRAY_SIZE(mop500_pins
));
304 platform_add_devices(platform_devs
, ARRAY_SIZE(platform_devs
));
311 platform_device_register(&ab8500_device
);
313 i2c_register_board_info(0, mop500_i2c0_devices
,
314 ARRAY_SIZE(mop500_i2c0_devices
));
317 MACHINE_START(U8500
, "ST-Ericsson MOP500 platform")
318 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
319 .boot_params
= 0x100,
320 .map_io
= u8500_map_io
,
321 .init_irq
= ux500_init_irq
,
322 /* we re-use nomadik timer here */
323 .timer
= &ux500_timer
,
324 .init_machine
= u8500_init_machine
,