Pull cpumask into release branch
[sfrench/cifs-2.6.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 #include <linux/i2c/twl4030.h>
25 #include <linux/io.h>
26
27 #include <mach/hardware.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31
32 #include <mach/mcspi.h>
33 #include <mach/gpio.h>
34 #include <mach/board.h>
35 #include <mach/common.h>
36 #include <mach/gpmc.h>
37
38 #include <asm/delay.h>
39 #include <mach/control.h>
40 #include <mach/usb.h>
41
42 #include "mmc-twl4030.h"
43
44 #define LDP_SMC911X_CS          1
45 #define LDP_SMC911X_GPIO        152
46 #define DEBUG_BASE              0x08000000
47 #define LDP_ETHR_START          DEBUG_BASE
48
49 static struct resource ldp_smc911x_resources[] = {
50         [0] = {
51                 .start  = LDP_ETHR_START,
52                 .end    = LDP_ETHR_START + SZ_4K,
53                 .flags  = IORESOURCE_MEM,
54         },
55         [1] = {
56                 .start  = 0,
57                 .end    = 0,
58                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
59         },
60 };
61
62 static struct platform_device ldp_smc911x_device = {
63         .name           = "smc911x",
64         .id             = -1,
65         .num_resources  = ARRAY_SIZE(ldp_smc911x_resources),
66         .resource       = ldp_smc911x_resources,
67 };
68
69 static struct platform_device *ldp_devices[] __initdata = {
70         &ldp_smc911x_device,
71 };
72
73 static inline void __init ldp_init_smc911x(void)
74 {
75         int eth_cs;
76         unsigned long cs_mem_base;
77         int eth_gpio = 0;
78
79         eth_cs = LDP_SMC911X_CS;
80
81         if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
82                 printk(KERN_ERR "Failed to request GPMC mem for smc911x\n");
83                 return;
84         }
85
86         ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
87         ldp_smc911x_resources[0].end   = cs_mem_base + 0xff;
88         udelay(100);
89
90         eth_gpio = LDP_SMC911X_GPIO;
91
92         ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
93
94         if (gpio_request(eth_gpio, "smc911x irq") < 0) {
95                 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
96                                 eth_gpio);
97                 return;
98         }
99         gpio_direction_input(eth_gpio);
100 }
101
102 static void __init omap_ldp_init_irq(void)
103 {
104         omap2_init_common_hw(NULL);
105         omap_init_irq();
106         omap_gpio_init();
107         ldp_init_smc911x();
108 }
109
110 static struct omap_uart_config ldp_uart_config __initdata = {
111         .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
112 };
113
114 static struct omap_board_config_kernel ldp_config[] __initdata = {
115         { OMAP_TAG_UART,        &ldp_uart_config },
116 };
117
118 static struct twl4030_gpio_platform_data ldp_gpio_data = {
119         .gpio_base      = OMAP_MAX_GPIO_LINES,
120         .irq_base       = TWL4030_GPIO_IRQ_BASE,
121         .irq_end        = TWL4030_GPIO_IRQ_END,
122 };
123
124 static struct twl4030_platform_data ldp_twldata = {
125         .irq_base       = TWL4030_IRQ_BASE,
126         .irq_end        = TWL4030_IRQ_END,
127
128         /* platform_data for children goes here */
129         .gpio           = &ldp_gpio_data,
130 };
131
132 static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
133         {
134                 I2C_BOARD_INFO("twl4030", 0x48),
135                 .flags = I2C_CLIENT_WAKE,
136                 .irq = INT_34XX_SYS_NIRQ,
137                 .platform_data = &ldp_twldata,
138         },
139 };
140
141 static int __init omap_i2c_init(void)
142 {
143         omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
144                         ARRAY_SIZE(ldp_i2c_boardinfo));
145         omap_register_i2c_bus(2, 400, NULL, 0);
146         omap_register_i2c_bus(3, 400, NULL, 0);
147         return 0;
148 }
149
150 static struct twl4030_hsmmc_info mmc[] __initdata = {
151         {
152                 .mmc            = 1,
153                 .wires          = 4,
154                 .gpio_cd        = -EINVAL,
155                 .gpio_wp        = -EINVAL,
156         },
157         {}      /* Terminator */
158 };
159
160 static void __init omap_ldp_init(void)
161 {
162         omap_i2c_init();
163         platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
164         omap_board_config = ldp_config;
165         omap_board_config_size = ARRAY_SIZE(ldp_config);
166         omap_serial_init();
167         twl4030_mmc_init(mmc);
168         usb_musb_init();
169 }
170
171 static void __init omap_ldp_map_io(void)
172 {
173         omap2_set_globals_343x();
174         omap2_map_common_io();
175 }
176
177 MACHINE_START(OMAP_LDP, "OMAP LDP board")
178         .phys_io        = 0x48000000,
179         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
180         .boot_params    = 0x80000100,
181         .map_io         = omap_ldp_map_io,
182         .init_irq       = omap_ldp_init_irq,
183         .init_machine   = omap_ldp_init,
184         .timer          = &omap_timer,
185 MACHINE_END