diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-perseus2.c')
-rw-r--r-- | arch/arm/mach-omap1/board-perseus2.c | 123 |
1 files changed, 112 insertions, 11 deletions
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c index 3913a3cc0ce6..64b45d8ae357 100644 --- a/arch/arm/mach-omap1/board-perseus2.c +++ b/arch/arm/mach-omap1/board-perseus2.c | |||
@@ -16,7 +16,9 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/nand.h> | ||
19 | #include <linux/mtd/partitions.h> | 20 | #include <linux/mtd/partitions.h> |
21 | #include <linux/input.h> | ||
20 | 22 | ||
21 | #include <asm/hardware.h> | 23 | #include <asm/hardware.h> |
22 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
@@ -28,9 +30,44 @@ | |||
28 | #include <asm/arch/gpio.h> | 30 | #include <asm/arch/gpio.h> |
29 | #include <asm/arch/mux.h> | 31 | #include <asm/arch/mux.h> |
30 | #include <asm/arch/fpga.h> | 32 | #include <asm/arch/fpga.h> |
33 | #include <asm/arch/keypad.h> | ||
31 | #include <asm/arch/common.h> | 34 | #include <asm/arch/common.h> |
32 | #include <asm/arch/board.h> | 35 | #include <asm/arch/board.h> |
33 | 36 | ||
37 | static int p2_keymap[] = { | ||
38 | KEY(0,0,KEY_UP), | ||
39 | KEY(0,1,KEY_RIGHT), | ||
40 | KEY(0,2,KEY_LEFT), | ||
41 | KEY(0,3,KEY_DOWN), | ||
42 | KEY(0,4,KEY_CENTER), | ||
43 | KEY(0,5,KEY_0_5), | ||
44 | KEY(1,0,KEY_SOFT2), | ||
45 | KEY(1,1,KEY_SEND), | ||
46 | KEY(1,2,KEY_END), | ||
47 | KEY(1,3,KEY_VOLUMEDOWN), | ||
48 | KEY(1,4,KEY_VOLUMEUP), | ||
49 | KEY(1,5,KEY_RECORD), | ||
50 | KEY(2,0,KEY_SOFT1), | ||
51 | KEY(2,1,KEY_3), | ||
52 | KEY(2,2,KEY_6), | ||
53 | KEY(2,3,KEY_9), | ||
54 | KEY(2,4,KEY_SHARP), | ||
55 | KEY(2,5,KEY_2_5), | ||
56 | KEY(3,0,KEY_BACK), | ||
57 | KEY(3,1,KEY_2), | ||
58 | KEY(3,2,KEY_5), | ||
59 | KEY(3,3,KEY_8), | ||
60 | KEY(3,4,KEY_0), | ||
61 | KEY(3,5,KEY_HEADSETHOOK), | ||
62 | KEY(4,0,KEY_HOME), | ||
63 | KEY(4,1,KEY_1), | ||
64 | KEY(4,2,KEY_4), | ||
65 | KEY(4,3,KEY_7), | ||
66 | KEY(4,4,KEY_STAR), | ||
67 | KEY(4,5,KEY_POWER), | ||
68 | 0 | ||
69 | }; | ||
70 | |||
34 | static struct resource smc91x_resources[] = { | 71 | static struct resource smc91x_resources[] = { |
35 | [0] = { | 72 | [0] = { |
36 | .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */ | 73 | .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */ |
@@ -44,7 +81,7 @@ static struct resource smc91x_resources[] = { | |||
44 | }, | 81 | }, |
45 | }; | 82 | }; |
46 | 83 | ||
47 | static struct mtd_partition p2_partitions[] = { | 84 | static struct mtd_partition nor_partitions[] = { |
48 | /* bootloader (U-Boot, etc) in first sector */ | 85 | /* bootloader (U-Boot, etc) in first sector */ |
49 | { | 86 | { |
50 | .name = "bootloader", | 87 | .name = "bootloader", |
@@ -75,27 +112,47 @@ static struct mtd_partition p2_partitions[] = { | |||
75 | }, | 112 | }, |
76 | }; | 113 | }; |
77 | 114 | ||
78 | static struct flash_platform_data p2_flash_data = { | 115 | static struct flash_platform_data nor_data = { |
79 | .map_name = "cfi_probe", | 116 | .map_name = "cfi_probe", |
80 | .width = 2, | 117 | .width = 2, |
81 | .parts = p2_partitions, | 118 | .parts = nor_partitions, |
82 | .nr_parts = ARRAY_SIZE(p2_partitions), | 119 | .nr_parts = ARRAY_SIZE(nor_partitions), |
83 | }; | 120 | }; |
84 | 121 | ||
85 | static struct resource p2_flash_resource = { | 122 | static struct resource nor_resource = { |
86 | .start = OMAP_CS0_PHYS, | 123 | .start = OMAP_CS0_PHYS, |
87 | .end = OMAP_CS0_PHYS + SZ_32M - 1, | 124 | .end = OMAP_CS0_PHYS + SZ_32M - 1, |
88 | .flags = IORESOURCE_MEM, | 125 | .flags = IORESOURCE_MEM, |
89 | }; | 126 | }; |
90 | 127 | ||
91 | static struct platform_device p2_flash_device = { | 128 | static struct platform_device nor_device = { |
92 | .name = "omapflash", | 129 | .name = "omapflash", |
93 | .id = 0, | 130 | .id = 0, |
94 | .dev = { | 131 | .dev = { |
95 | .platform_data = &p2_flash_data, | 132 | .platform_data = &nor_data, |
133 | }, | ||
134 | .num_resources = 1, | ||
135 | .resource = &nor_resource, | ||
136 | }; | ||
137 | |||
138 | static struct nand_platform_data nand_data = { | ||
139 | .options = NAND_SAMSUNG_LP_OPTIONS, | ||
140 | }; | ||
141 | |||
142 | static struct resource nand_resource = { | ||
143 | .start = OMAP_CS3_PHYS, | ||
144 | .end = OMAP_CS3_PHYS + SZ_4K - 1, | ||
145 | .flags = IORESOURCE_MEM, | ||
146 | }; | ||
147 | |||
148 | static struct platform_device nand_device = { | ||
149 | .name = "omapnand", | ||
150 | .id = 0, | ||
151 | .dev = { | ||
152 | .platform_data = &nand_data, | ||
96 | }, | 153 | }, |
97 | .num_resources = 1, | 154 | .num_resources = 1, |
98 | .resource = &p2_flash_resource, | 155 | .resource = &nand_resource, |
99 | }; | 156 | }; |
100 | 157 | ||
101 | static struct platform_device smc91x_device = { | 158 | static struct platform_device smc91x_device = { |
@@ -105,17 +162,55 @@ static struct platform_device smc91x_device = { | |||
105 | .resource = smc91x_resources, | 162 | .resource = smc91x_resources, |
106 | }; | 163 | }; |
107 | 164 | ||
165 | static struct resource kp_resources[] = { | ||
166 | [0] = { | ||
167 | .start = INT_730_MPUIO_KEYPAD, | ||
168 | .end = INT_730_MPUIO_KEYPAD, | ||
169 | .flags = IORESOURCE_IRQ, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static struct omap_kp_platform_data kp_data = { | ||
174 | .rows = 8, | ||
175 | .cols = 8, | ||
176 | .keymap = p2_keymap, | ||
177 | }; | ||
178 | |||
179 | static struct platform_device kp_device = { | ||
180 | .name = "omap-keypad", | ||
181 | .id = -1, | ||
182 | .dev = { | ||
183 | .platform_data = &kp_data, | ||
184 | }, | ||
185 | .num_resources = ARRAY_SIZE(kp_resources), | ||
186 | .resource = kp_resources, | ||
187 | }; | ||
188 | |||
189 | static struct platform_device lcd_device = { | ||
190 | .name = "lcd_p2", | ||
191 | .id = -1, | ||
192 | }; | ||
193 | |||
108 | static struct platform_device *devices[] __initdata = { | 194 | static struct platform_device *devices[] __initdata = { |
109 | &p2_flash_device, | 195 | &nor_device, |
196 | &nand_device, | ||
110 | &smc91x_device, | 197 | &smc91x_device, |
198 | &kp_device, | ||
199 | &lcd_device, | ||
111 | }; | 200 | }; |
112 | 201 | ||
202 | #define P2_NAND_RB_GPIO_PIN 62 | ||
203 | |||
204 | static int nand_dev_ready(struct nand_platform_data *data) | ||
205 | { | ||
206 | return omap_get_gpio_datain(P2_NAND_RB_GPIO_PIN); | ||
207 | } | ||
208 | |||
113 | static struct omap_uart_config perseus2_uart_config __initdata = { | 209 | static struct omap_uart_config perseus2_uart_config __initdata = { |
114 | .enabled_uarts = ((1 << 0) | (1 << 1)), | 210 | .enabled_uarts = ((1 << 0) | (1 << 1)), |
115 | }; | 211 | }; |
116 | 212 | ||
117 | static struct omap_lcd_config perseus2_lcd_config __initdata = { | 213 | static struct omap_lcd_config perseus2_lcd_config __initdata = { |
118 | .panel_name = "p2", | ||
119 | .ctrl_name = "internal", | 214 | .ctrl_name = "internal", |
120 | }; | 215 | }; |
121 | 216 | ||
@@ -126,7 +221,13 @@ static struct omap_board_config_kernel perseus2_config[] = { | |||
126 | 221 | ||
127 | static void __init omap_perseus2_init(void) | 222 | static void __init omap_perseus2_init(void) |
128 | { | 223 | { |
129 | (void) platform_add_devices(devices, ARRAY_SIZE(devices)); | 224 | if (!(omap_request_gpio(P2_NAND_RB_GPIO_PIN))) |
225 | nand_data.dev_ready = nand_dev_ready; | ||
226 | |||
227 | omap_cfg_reg(L3_1610_FLASH_CS2B_OE); | ||
228 | omap_cfg_reg(M8_1610_FLASH_CS2B_WE); | ||
229 | |||
230 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
130 | 231 | ||
131 | omap_board_config = perseus2_config; | 232 | omap_board_config = perseus2_config; |
132 | omap_board_config_size = ARRAY_SIZE(perseus2_config); | 233 | omap_board_config_size = ARRAY_SIZE(perseus2_config); |