Merge branch 'omap3-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-omap2 / board-ldp.c
1 /*
2 * linux/arch/arm/mach-omap2/board-ldp.c
3 *
4 * Copyright (C) 2008 Texas Instruments Inc.
5 * Nishant Kamat <nskamat@ti.com>
6 *
7 * Modified from mach-omap2/board-3430sdp.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/delay.h>
18 #include <linux/input.h>
19 #include <linux/workqueue.h>
20 #include <linux/err.h>
21 #include <linux/clk.h>
22 #include <linux/spi/spi.h>
23 #include <linux/spi/ads7846.h>
24
25 #include <mach/hardware.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29
30 #include <mach/board-ldp.h>
31 #include <mach/mcspi.h>
32 #include <mach/gpio.h>
33 #include <mach/board.h>
34 #include <mach/common.h>
35 #include <mach/gpmc.h>
36
37 #include <asm/io.h>
38 #include <asm/delay.h>
39 #include <mach/control.h>
40
41 #define SDP3430_SMC91X_CS 3
42
43 static struct resource ldp_smc911x_resources[] = {
44 [0] = {
45 .start = OMAP34XX_ETHR_START,
46 .end = OMAP34XX_ETHR_START + SZ_4K,
47 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
50 .start = 0,
51 .end = 0,
52 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
53 },
54 };
55
56 static struct platform_device ldp_smc911x_device = {
57 .name = "smc911x",
58 .id = -1,
59 .num_resources = ARRAY_SIZE(ldp_smc911x_resources),
60 .resource = ldp_smc911x_resources,
61 };
62
63 static struct platform_device *ldp_devices[] __initdata = {
64 &ldp_smc911x_device,
65 };
66
67 static inline void __init ldp_init_smc911x(void)
68 {
69 int eth_cs;
70 unsigned long cs_mem_base;
71 int eth_gpio = 0;
72
73 eth_cs = LDP_SMC911X_CS;
74
75 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
76 printk(KERN_ERR "Failed to request GPMC mem for smc911x\n");
77 return;
78 }
79
80 ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
81 ldp_smc911x_resources[0].end = cs_mem_base + 0xf;
82 udelay(100);
83
84 eth_gpio = LDP_SMC911X_GPIO;
85
86 ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
87
88 if (omap_request_gpio(eth_gpio) < 0) {
89 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
90 eth_gpio);
91 return;
92 }
93 gpio_direction_input(eth_gpio);
94 }
95
96 static void __init omap_ldp_init_irq(void)
97 {
98 omap2_init_common_hw();
99 omap_init_irq();
100 omap_gpio_init();
101 ldp_init_smc911x();
102 }
103
104 static struct omap_uart_config ldp_uart_config __initdata = {
105 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
106 };
107
108 static struct omap_board_config_kernel ldp_config[] __initdata = {
109 { OMAP_TAG_UART, &ldp_uart_config },
110 };
111
112 static int __init omap_i2c_init(void)
113 {
114 omap_register_i2c_bus(1, 2600, NULL, 0);
115 omap_register_i2c_bus(2, 400, NULL, 0);
116 omap_register_i2c_bus(3, 400, NULL, 0);
117 return 0;
118 }
119
120 static void __init omap_ldp_init(void)
121 {
122 omap_i2c_init();
123 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
124 omap_board_config = ldp_config;
125 omap_board_config_size = ARRAY_SIZE(ldp_config);
126 omap_serial_init();
127 }
128
129 static void __init omap_ldp_map_io(void)
130 {
131 omap2_set_globals_343x();
132 omap2_map_common_io();
133 }
134
135 MACHINE_START(OMAP_LDP, "OMAP LDP board")
136 .phys_io = 0x48000000,
137 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
138 .boot_params = 0x80000100,
139 .map_io = omap_ldp_map_io,
140 .init_irq = omap_ldp_init_irq,
141 .init_machine = omap_ldp_init,
142 .timer = &omap_timer,
143 MACHINE_END