This source file includes following definitions.
- h2_nand_dev_ready
- h2_init_smc91x
- tps_setup
- h2_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/gpio.h>
19 #include <linux/kernel.h>
20 #include <linux/platform_device.h>
21 #include <linux/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/platnand.h>
25 #include <linux/mtd/physmap.h>
26 #include <linux/input.h>
27 #include <linux/mfd/tps65010.h>
28 #include <linux/smc91x.h>
29 #include <linux/omapfb.h>
30 #include <linux/platform_data/gpio-omap.h>
31 #include <linux/leds.h>
32
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
36
37 #include <mach/mux.h>
38 #include <linux/omap-dma.h>
39 #include <mach/tc.h>
40 #include <linux/platform_data/keypad-omap.h>
41 #include "flash.h"
42
43 #include <mach/hardware.h>
44 #include <mach/usb.h>
45
46 #include "common.h"
47 #include "board-h2.h"
48
49
50 #define OMAP1610_ETHR_START 0x04000300
51
52 static const unsigned int h2_keymap[] = {
53 KEY(0, 0, KEY_LEFT),
54 KEY(1, 0, KEY_RIGHT),
55 KEY(2, 0, KEY_3),
56 KEY(3, 0, KEY_F10),
57 KEY(4, 0, KEY_F5),
58 KEY(5, 0, KEY_9),
59 KEY(0, 1, KEY_DOWN),
60 KEY(1, 1, KEY_UP),
61 KEY(2, 1, KEY_2),
62 KEY(3, 1, KEY_F9),
63 KEY(4, 1, KEY_F7),
64 KEY(5, 1, KEY_0),
65 KEY(0, 2, KEY_ENTER),
66 KEY(1, 2, KEY_6),
67 KEY(2, 2, KEY_1),
68 KEY(3, 2, KEY_F2),
69 KEY(4, 2, KEY_F6),
70 KEY(5, 2, KEY_HOME),
71 KEY(0, 3, KEY_8),
72 KEY(1, 3, KEY_5),
73 KEY(2, 3, KEY_F12),
74 KEY(3, 3, KEY_F3),
75 KEY(4, 3, KEY_F8),
76 KEY(5, 3, KEY_END),
77 KEY(0, 4, KEY_7),
78 KEY(1, 4, KEY_4),
79 KEY(2, 4, KEY_F11),
80 KEY(3, 4, KEY_F1),
81 KEY(4, 4, KEY_F4),
82 KEY(5, 4, KEY_ESC),
83 KEY(0, 5, KEY_F13),
84 KEY(1, 5, KEY_F14),
85 KEY(2, 5, KEY_F15),
86 KEY(3, 5, KEY_F16),
87 KEY(4, 5, KEY_SLEEP),
88 };
89
90 static struct mtd_partition h2_nor_partitions[] = {
91
92 {
93 .name = "bootloader",
94 .offset = 0,
95 .size = SZ_128K,
96 .mask_flags = MTD_WRITEABLE,
97 },
98
99 {
100 .name = "params",
101 .offset = MTDPART_OFS_APPEND,
102 .size = SZ_128K,
103 .mask_flags = 0,
104 },
105
106 {
107 .name = "kernel",
108 .offset = MTDPART_OFS_APPEND,
109 .size = SZ_2M,
110 .mask_flags = 0
111 },
112
113 {
114 .name = "filesystem",
115 .offset = MTDPART_OFS_APPEND,
116 .size = MTDPART_SIZ_FULL,
117 .mask_flags = 0
118 }
119 };
120
121 static struct physmap_flash_data h2_nor_data = {
122 .width = 2,
123 .set_vpp = omap1_set_vpp,
124 .parts = h2_nor_partitions,
125 .nr_parts = ARRAY_SIZE(h2_nor_partitions),
126 };
127
128 static struct resource h2_nor_resource = {
129
130 .flags = IORESOURCE_MEM,
131 };
132
133 static struct platform_device h2_nor_device = {
134 .name = "physmap-flash",
135 .id = 0,
136 .dev = {
137 .platform_data = &h2_nor_data,
138 },
139 .num_resources = 1,
140 .resource = &h2_nor_resource,
141 };
142
143 static struct mtd_partition h2_nand_partitions[] = {
144 #if 0
145
146
147
148
149 {
150 .name = "xloader",
151 .offset = 0,
152 .size = 64 * 1024,
153 .mask_flags = MTD_WRITEABLE,
154 },
155 {
156 .name = "bootloader",
157 .offset = MTDPART_OFS_APPEND,
158 .size = 256 * 1024,
159 .mask_flags = MTD_WRITEABLE,
160 },
161 {
162 .name = "params",
163 .offset = MTDPART_OFS_APPEND,
164 .size = 192 * 1024,
165 },
166 {
167 .name = "kernel",
168 .offset = MTDPART_OFS_APPEND,
169 .size = 2 * SZ_1M,
170 },
171 #endif
172 {
173 .name = "filesystem",
174 .size = MTDPART_SIZ_FULL,
175 .offset = MTDPART_OFS_APPEND,
176 },
177 };
178
179 #define H2_NAND_RB_GPIO_PIN 62
180
181 static int h2_nand_dev_ready(struct nand_chip *chip)
182 {
183 return gpio_get_value(H2_NAND_RB_GPIO_PIN);
184 }
185
186 static struct platform_nand_data h2_nand_platdata = {
187 .chip = {
188 .nr_chips = 1,
189 .chip_offset = 0,
190 .nr_partitions = ARRAY_SIZE(h2_nand_partitions),
191 .partitions = h2_nand_partitions,
192 .options = NAND_SAMSUNG_LP_OPTIONS,
193 },
194 .ctrl = {
195 .cmd_ctrl = omap1_nand_cmd_ctl,
196 .dev_ready = h2_nand_dev_ready,
197 },
198 };
199
200 static struct resource h2_nand_resource = {
201 .flags = IORESOURCE_MEM,
202 };
203
204 static struct platform_device h2_nand_device = {
205 .name = "gen_nand",
206 .id = 0,
207 .dev = {
208 .platform_data = &h2_nand_platdata,
209 },
210 .num_resources = 1,
211 .resource = &h2_nand_resource,
212 };
213
214 static struct smc91x_platdata h2_smc91x_info = {
215 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
216 .leda = RPC_LED_100_10,
217 .ledb = RPC_LED_TX_RX,
218 };
219
220 static struct resource h2_smc91x_resources[] = {
221 [0] = {
222 .start = OMAP1610_ETHR_START,
223 .end = OMAP1610_ETHR_START + 0xf,
224 .flags = IORESOURCE_MEM,
225 },
226 [1] = {
227 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
228 },
229 };
230
231 static struct platform_device h2_smc91x_device = {
232 .name = "smc91x",
233 .id = 0,
234 .dev = {
235 .platform_data = &h2_smc91x_info,
236 },
237 .num_resources = ARRAY_SIZE(h2_smc91x_resources),
238 .resource = h2_smc91x_resources,
239 };
240
241 static struct resource h2_kp_resources[] = {
242 [0] = {
243 .start = INT_KEYBOARD,
244 .end = INT_KEYBOARD,
245 .flags = IORESOURCE_IRQ,
246 },
247 };
248
249 static const struct matrix_keymap_data h2_keymap_data = {
250 .keymap = h2_keymap,
251 .keymap_size = ARRAY_SIZE(h2_keymap),
252 };
253
254 static struct omap_kp_platform_data h2_kp_data = {
255 .rows = 8,
256 .cols = 8,
257 .keymap_data = &h2_keymap_data,
258 .rep = true,
259 .delay = 9,
260 .dbounce = true,
261 };
262
263 static struct platform_device h2_kp_device = {
264 .name = "omap-keypad",
265 .id = -1,
266 .dev = {
267 .platform_data = &h2_kp_data,
268 },
269 .num_resources = ARRAY_SIZE(h2_kp_resources),
270 .resource = h2_kp_resources,
271 };
272
273 static const struct gpio_led h2_gpio_led_pins[] = {
274 {
275 .name = "h2:red",
276 .default_trigger = "heartbeat",
277 .gpio = 3,
278 },
279 {
280 .name = "h2:green",
281 .default_trigger = "cpu0",
282 .gpio = OMAP_MPUIO(4),
283 },
284 };
285
286 static struct gpio_led_platform_data h2_gpio_led_data = {
287 .leds = h2_gpio_led_pins,
288 .num_leds = ARRAY_SIZE(h2_gpio_led_pins),
289 };
290
291 static struct platform_device h2_gpio_leds = {
292 .name = "leds-gpio",
293 .id = -1,
294 .dev = {
295 .platform_data = &h2_gpio_led_data,
296 },
297 };
298
299 static struct platform_device *h2_devices[] __initdata = {
300 &h2_nor_device,
301 &h2_nand_device,
302 &h2_smc91x_device,
303 &h2_kp_device,
304 &h2_gpio_leds,
305 };
306
307 static void __init h2_init_smc91x(void)
308 {
309 if (gpio_request(0, "SMC91x irq") < 0) {
310 printk("Error requesting gpio 0 for smc91x irq\n");
311 return;
312 }
313 }
314
315 static int tps_setup(struct i2c_client *client, void *context)
316 {
317 if (!IS_BUILTIN(CONFIG_TPS65010))
318 return -ENOSYS;
319
320 tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V |
321 TPS_LDO1_ENABLE | TPS_VLDO1_3_0V);
322
323 return 0;
324 }
325
326 static struct tps65010_board tps_board = {
327 .base = H2_TPS_GPIO_BASE,
328 .outmask = 0x0f,
329 .setup = tps_setup,
330 };
331
332 static struct i2c_board_info __initdata h2_i2c_board_info[] = {
333 {
334 I2C_BOARD_INFO("tps65010", 0x48),
335 .platform_data = &tps_board,
336 }, {
337 I2C_BOARD_INFO("isp1301_omap", 0x2d),
338 },
339 };
340
341 static struct omap_usb_config h2_usb_config __initdata = {
342
343 .otg = 2,
344
345 #if IS_ENABLED(CONFIG_USB_OMAP)
346 .hmc_mode = 19,
347
348 #elif IS_ENABLED(CONFIG_USB_OHCI_HCD)
349
350 .hmc_mode = 20,
351 #endif
352
353 .pins[1] = 3,
354 };
355
356 static const struct omap_lcd_config h2_lcd_config __initconst = {
357 .ctrl_name = "internal",
358 };
359
360 static void __init h2_init(void)
361 {
362 h2_init_smc91x();
363
364
365
366
367
368
369
370
371
372
373 h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys();
374 h2_nor_resource.end += SZ_32M - 1;
375
376 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
377 h2_nand_resource.end += SZ_4K - 1;
378 BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
379 gpio_direction_input(H2_NAND_RB_GPIO_PIN);
380
381 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
382 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
383
384
385
386 omap_cfg_reg(BALLOUT_V8_ARMIO3);
387
388
389 omap_cfg_reg(F18_1610_KBC0);
390 omap_cfg_reg(D20_1610_KBC1);
391 omap_cfg_reg(D19_1610_KBC2);
392 omap_cfg_reg(E18_1610_KBC3);
393 omap_cfg_reg(C21_1610_KBC4);
394 omap_cfg_reg(G18_1610_KBR0);
395 omap_cfg_reg(F19_1610_KBR1);
396 omap_cfg_reg(H14_1610_KBR2);
397 omap_cfg_reg(E20_1610_KBR3);
398 omap_cfg_reg(E19_1610_KBR4);
399 omap_cfg_reg(N19_1610_KBR5);
400
401
402 omap_cfg_reg(P18_1610_GPIO3);
403 omap_cfg_reg(MPUIO4);
404
405 h2_smc91x_resources[1].start = gpio_to_irq(0);
406 h2_smc91x_resources[1].end = gpio_to_irq(0);
407 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
408 omap_serial_init();
409 h2_i2c_board_info[0].irq = gpio_to_irq(58);
410 h2_i2c_board_info[1].irq = gpio_to_irq(2);
411 omap_register_i2c_bus(1, 100, h2_i2c_board_info,
412 ARRAY_SIZE(h2_i2c_board_info));
413 omap1_usb_init(&h2_usb_config);
414 h2_mmc_init();
415
416 omapfb_set_lcd_config(&h2_lcd_config);
417 }
418
419 MACHINE_START(OMAP_H2, "TI-H2")
420
421 .atag_offset = 0x100,
422 .map_io = omap16xx_map_io,
423 .init_early = omap1_init_early,
424 .init_irq = omap1_init_irq,
425 .handle_irq = omap1_handle_irq,
426 .init_machine = h2_init,
427 .init_late = omap1_init_late,
428 .init_time = omap1_timer_init,
429 .restart = omap1_restart,
430 MACHINE_END