2 * linux/arch/arm/mach-omap2/board-rx51-flash.c
4 * Copyright (C) 2008 Nokia
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/platform_device.h>
14 #include <linux/input.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/tsc2005.h>
17 #include <linux/i2c.h>
18 #include <linux/i2c/twl4030.h>
19 #include <linux/clk.h>
20 #include <linux/delay.h>
22 #include <mach/mcspi.h>
23 #include <mach/gpio.h>
25 #include <mach/board.h>
26 #include <mach/common.h>
27 #include <mach/keypad.h>
29 #include <mach/gpmc.h>
31 #define RX51_DEBUG_BASE 0x08000000 /* debug board */
32 #define RX51_ETHR_START RX51_DEBUG_BASE
33 #define RX51_ETHR_GPIO_IRQ 54
35 #define RX51_TSC2005_RESET_GPIO 104
36 #define RX51_TSC2005_IRQ_GPIO 100
38 #define RX51_SMC91X_CS 1
40 static struct resource rx51_smc91x_resources[] = {
42 .start = RX51_ETHR_START,
43 .end = RX51_ETHR_START + SZ_4K,
44 .flags = IORESOURCE_MEM,
47 .start = OMAP_GPIO_IRQ(RX51_ETHR_GPIO_IRQ),
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
53 static struct platform_device rx51_smc91x_device = {
56 .num_resources = ARRAY_SIZE(rx51_smc91x_resources),
57 .resource = rx51_smc91x_resources,
60 static struct tsc2005_platform_data tsc2005_config = {
61 .reset_gpio = RX51_TSC2005_RESET_GPIO, /* not used */
63 .ts_x_plate_ohm = 280,
65 .ts_touch_pressure = 1500,
67 .ts_pressure_max = 2048,
68 .ts_pressure_fudge = 2,
75 static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
81 static struct spi_board_info rx51_peripherals_spi_board_info[] = {
83 .modalias = "tsc2005",
86 .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
87 .max_speed_hz = 6000000,
88 .controller_data = &tsc2005_mcspi_config,
89 .platform_data = &tsc2005_config,
93 static int rx51_keymap[] = {
106 KEY(1, 4, KEY_DOWN ),
111 KEY(2, 4, KEY_RIGHT ),
112 KEY(3, 0, KEY_COMMA ),
114 KEY(3, 2, KEY_ENTER ),
116 KEY(4, 0, KEY_BACKSPACE ),
119 KEY(4, 4, KEY_LEFTCTRL),
122 KEY(5, 3, KEY_SPACE),
123 KEY(5, 4, KEY_LEFTSHIFT),
127 KEY(6, 3, KEY_SPACE),
133 KEY(0xff, 0, KEY_F6),
134 KEY(0xff, 1, KEY_F7),
135 KEY(0xff, 2, KEY_F8),
136 KEY(0xff, 4, KEY_F9),
137 KEY(0xff, 5, KEY_F10),
140 static struct twl4030_keypad_data rx51_kp_data = {
143 .keymap = rx51_keymap,
144 .keymapsize = ARRAY_SIZE(rx51_keymap),
148 static struct platform_device *rx51_peripherals_devices[] = {
152 static void __init rx51_init_smc91x(void)
155 unsigned long cs_mem_base;
159 eth_cs = RX51_SMC91X_CS;
161 l3ck = clk_get(NULL, "core_l3_ck");
165 rate = clk_get_rate(l3ck);
167 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
168 printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
172 rx51_smc91x_resources[0].start = cs_mem_base + 0x0;
173 rx51_smc91x_resources[0].end = cs_mem_base + 0xf;
176 if (gpio_request(RX51_ETHR_GPIO_IRQ, "SMC91X irq") < 0) {
177 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
181 gpio_direction_input(RX51_ETHR_GPIO_IRQ);
184 static void __init rx51_init_tsc2005(void)
188 r = gpio_request(RX51_TSC2005_IRQ_GPIO, "tsc2005 DAV IRQ");
190 gpio_direction_input(RX51_TSC2005_IRQ_GPIO);
192 printk(KERN_ERR "unable to get DAV GPIO");
196 static struct twl4030_usb_data rx51_usb_data = {
197 .usb_mode = T2_USB_MODE_ULPI,
200 static struct twl4030_madc_platform_data rx51_madc_data = {
204 static struct twl4030_gpio_platform_data rx51_gpio_data = {
205 .gpio_base = OMAP_MAX_GPIO_LINES,
206 .irq_base = TWL4030_GPIO_IRQ_BASE,
207 .irq_end = TWL4030_GPIO_IRQ_END,
210 static struct twl4030_platform_data rx51_twldata = {
211 .irq_base = TWL4030_IRQ_BASE,
212 .irq_end = TWL4030_IRQ_END,
214 /* platform_data for children goes here */
215 .gpio = &rx51_gpio_data,
216 .keypad = &rx51_kp_data,
217 .madc = &rx51_madc_data,
218 .usb = &rx51_usb_data,
221 static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
223 I2C_BOARD_INFO("twl4030", 0x48),
224 .flags = I2C_CLIENT_WAKE,
225 .irq = INT_34XX_SYS_NIRQ,
226 .platform_data = &rx51_twldata,
230 static int __init rx51_i2c_init(void)
232 omap_register_i2c_bus(1, 2600, rx51_peripherals_i2c_board_info_1,
233 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
234 omap_register_i2c_bus(2, 100, NULL, 0);
235 omap_register_i2c_bus(3, 400, NULL, 0);
240 void __init rx51_peripherals_init(void)
242 platform_add_devices(rx51_peripherals_devices,
243 ARRAY_SIZE(rx51_peripherals_devices));
244 spi_register_board_info(rx51_peripherals_spi_board_info,
245 ARRAY_SIZE(rx51_peripherals_spi_board_info));