diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-omap2/board-overo.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 575 |
1 files changed, 342 insertions, 233 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 4c4843618350..175e1ab2b04d 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -24,14 +24,18 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/gpio.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
29 | #include <linux/i2c/twl.h> | 30 | #include <linux/i2c/twl.h> |
30 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/regulator/fixed.h> | ||
33 | #include <linux/spi/spi.h> | ||
31 | 34 | ||
32 | #include <linux/mtd/mtd.h> | 35 | #include <linux/mtd/mtd.h> |
33 | #include <linux/mtd/nand.h> | 36 | #include <linux/mtd/nand.h> |
34 | #include <linux/mtd/partitions.h> | 37 | #include <linux/mtd/partitions.h> |
38 | #include <linux/mmc/host.h> | ||
35 | 39 | ||
36 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
37 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
@@ -40,15 +44,19 @@ | |||
40 | 44 | ||
41 | #include <plat/board.h> | 45 | #include <plat/board.h> |
42 | #include <plat/common.h> | 46 | #include <plat/common.h> |
43 | #include <mach/gpio.h> | 47 | #include <video/omapdss.h> |
48 | #include <video/omap-panel-generic-dpi.h> | ||
44 | #include <plat/gpmc.h> | 49 | #include <plat/gpmc.h> |
45 | #include <mach/hardware.h> | 50 | #include <mach/hardware.h> |
46 | #include <plat/nand.h> | 51 | #include <plat/nand.h> |
52 | #include <plat/mcspi.h> | ||
53 | #include <plat/mux.h> | ||
47 | #include <plat/usb.h> | 54 | #include <plat/usb.h> |
48 | 55 | ||
49 | #include "mux.h" | 56 | #include "mux.h" |
50 | #include "sdram-micron-mt46h32m32lf-6.h" | 57 | #include "sdram-micron-mt46h32m32lf-6.h" |
51 | #include "hsmmc.h" | 58 | #include "hsmmc.h" |
59 | #include "common-board-devices.h" | ||
52 | 60 | ||
53 | #define OVERO_GPIO_BT_XGATE 15 | 61 | #define OVERO_GPIO_BT_XGATE 15 |
54 | #define OVERO_GPIO_W2W_NRESET 16 | 62 | #define OVERO_GPIO_W2W_NRESET 16 |
@@ -57,8 +65,6 @@ | |||
57 | #define OVERO_GPIO_USBH_CPEN 168 | 65 | #define OVERO_GPIO_USBH_CPEN 168 |
58 | #define OVERO_GPIO_USBH_NRESET 183 | 66 | #define OVERO_GPIO_USBH_NRESET 183 |
59 | 67 | ||
60 | #define NAND_BLOCK_SIZE SZ_128K | ||
61 | |||
62 | #define OVERO_SMSC911X_CS 5 | 68 | #define OVERO_SMSC911X_CS 5 |
63 | #define OVERO_SMSC911X_GPIO 176 | 69 | #define OVERO_SMSC911X_GPIO 176 |
64 | #define OVERO_SMSC911X2_CS 4 | 70 | #define OVERO_SMSC911X2_CS 4 |
@@ -67,56 +73,38 @@ | |||
67 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ | 73 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
68 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | 74 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
69 | 75 | ||
70 | #include <plat/mcspi.h> | 76 | /* fixed regulator for ads7846 */ |
71 | #include <linux/spi/spi.h> | 77 | static struct regulator_consumer_supply ads7846_supply = |
72 | #include <linux/spi/ads7846.h> | 78 | REGULATOR_SUPPLY("vcc", "spi1.0"); |
73 | 79 | ||
74 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | 80 | static struct regulator_init_data vads7846_regulator = { |
75 | .turbo_mode = 0, | 81 | .constraints = { |
76 | .single_channel = 1, /* 0: slave, 1: master */ | 82 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
83 | }, | ||
84 | .num_consumer_supplies = 1, | ||
85 | .consumer_supplies = &ads7846_supply, | ||
77 | }; | 86 | }; |
78 | 87 | ||
79 | static int ads7846_get_pendown_state(void) | 88 | static struct fixed_voltage_config vads7846 = { |
80 | { | 89 | .supply_name = "vads7846", |
81 | return !gpio_get_value(OVERO_GPIO_PENDOWN); | 90 | .microvolts = 3300000, /* 3.3V */ |
82 | } | 91 | .gpio = -EINVAL, |
83 | 92 | .startup_delay = 0, | |
84 | static struct ads7846_platform_data ads7846_config = { | 93 | .init_data = &vads7846_regulator, |
85 | .x_max = 0x0fff, | ||
86 | .y_max = 0x0fff, | ||
87 | .x_plate_ohms = 180, | ||
88 | .pressure_max = 255, | ||
89 | .debounce_max = 10, | ||
90 | .debounce_tol = 3, | ||
91 | .debounce_rep = 1, | ||
92 | .get_pendown_state = ads7846_get_pendown_state, | ||
93 | .keep_vref_on = 1, | ||
94 | }; | 94 | }; |
95 | 95 | ||
96 | static struct spi_board_info overo_spi_board_info[] __initdata = { | 96 | static struct platform_device vads7846_device = { |
97 | { | 97 | .name = "reg-fixed-voltage", |
98 | .modalias = "ads7846", | 98 | .id = 1, |
99 | .bus_num = 1, | 99 | .dev = { |
100 | .chip_select = 0, | 100 | .platform_data = &vads7846, |
101 | .max_speed_hz = 1500000, | 101 | }, |
102 | .controller_data = &ads7846_mcspi_config, | ||
103 | .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), | ||
104 | .platform_data = &ads7846_config, | ||
105 | } | ||
106 | }; | 102 | }; |
107 | 103 | ||
108 | static void __init overo_ads7846_init(void) | 104 | static void __init overo_ads7846_init(void) |
109 | { | 105 | { |
110 | if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && | 106 | omap_ads7846_init(1, OVERO_GPIO_PENDOWN, 0, NULL); |
111 | (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) { | 107 | platform_device_register(&vads7846_device); |
112 | gpio_export(OVERO_GPIO_PENDOWN, 0); | ||
113 | } else { | ||
114 | printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n"); | ||
115 | return; | ||
116 | } | ||
117 | |||
118 | spi_register_board_info(overo_spi_board_info, | ||
119 | ARRAY_SIZE(overo_spi_board_info)); | ||
120 | } | 108 | } |
121 | 109 | ||
122 | #else | 110 | #else |
@@ -126,112 +114,164 @@ static inline void __init overo_ads7846_init(void) { return; } | |||
126 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 114 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
127 | 115 | ||
128 | #include <linux/smsc911x.h> | 116 | #include <linux/smsc911x.h> |
117 | #include <plat/gpmc-smsc911x.h> | ||
129 | 118 | ||
130 | static struct resource overo_smsc911x_resources[] = { | 119 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
131 | { | 120 | .id = 0, |
132 | .name = "smsc911x-memory", | 121 | .cs = OVERO_SMSC911X_CS, |
133 | .flags = IORESOURCE_MEM, | 122 | .gpio_irq = OVERO_SMSC911X_GPIO, |
134 | }, | 123 | .gpio_reset = -EINVAL, |
135 | { | 124 | .flags = SMSC911X_USE_32BIT, |
136 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
137 | }, | ||
138 | }; | 125 | }; |
139 | 126 | ||
140 | static struct resource overo_smsc911x2_resources[] = { | 127 | static struct omap_smsc911x_platform_data smsc911x2_cfg = { |
141 | { | 128 | .id = 1, |
142 | .name = "smsc911x2-memory", | 129 | .cs = OVERO_SMSC911X2_CS, |
143 | .flags = IORESOURCE_MEM, | 130 | .gpio_irq = OVERO_SMSC911X2_GPIO, |
144 | }, | 131 | .gpio_reset = -EINVAL, |
145 | { | 132 | .flags = SMSC911X_USE_32BIT, |
146 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
147 | }, | ||
148 | }; | 133 | }; |
149 | 134 | ||
150 | static struct smsc911x_platform_config overo_smsc911x_config = { | 135 | static void __init overo_init_smsc911x(void) |
151 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 136 | { |
152 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | 137 | gpmc_smsc911x_init(&smsc911x_cfg); |
153 | .flags = SMSC911X_USE_32BIT , | 138 | gpmc_smsc911x_init(&smsc911x2_cfg); |
154 | .phy_interface = PHY_INTERFACE_MODE_MII, | 139 | } |
155 | }; | ||
156 | 140 | ||
157 | static struct platform_device overo_smsc911x_device = { | 141 | #else |
158 | .name = "smsc911x", | 142 | static inline void __init overo_init_smsc911x(void) { return; } |
159 | .id = 0, | 143 | #endif |
160 | .num_resources = ARRAY_SIZE(overo_smsc911x_resources), | ||
161 | .resource = overo_smsc911x_resources, | ||
162 | .dev = { | ||
163 | .platform_data = &overo_smsc911x_config, | ||
164 | }, | ||
165 | }; | ||
166 | 144 | ||
167 | static struct platform_device overo_smsc911x2_device = { | 145 | /* DSS */ |
168 | .name = "smsc911x", | 146 | static int lcd_enabled; |
169 | .id = 1, | 147 | static int dvi_enabled; |
170 | .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), | 148 | |
171 | .resource = overo_smsc911x2_resources, | 149 | #define OVERO_GPIO_LCD_EN 144 |
172 | .dev = { | 150 | #define OVERO_GPIO_LCD_BL 145 |
173 | .platform_data = &overo_smsc911x_config, | ||
174 | }, | ||
175 | }; | ||
176 | 151 | ||
177 | static struct platform_device *smsc911x_devices[] = { | 152 | static struct gpio overo_dss_gpios[] __initdata = { |
178 | &overo_smsc911x_device, | 153 | { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" }, |
179 | &overo_smsc911x2_device, | 154 | { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" }, |
180 | }; | 155 | }; |
181 | 156 | ||
182 | static inline void __init overo_init_smsc911x(void) | 157 | static void __init overo_display_init(void) |
183 | { | 158 | { |
184 | unsigned long cs_mem_base, cs_mem_base2; | 159 | if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) { |
185 | 160 | printk(KERN_ERR "could not obtain DSS control GPIOs\n"); | |
186 | /* set up first smsc911x chip */ | ||
187 | |||
188 | if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { | ||
189 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); | ||
190 | return; | 161 | return; |
191 | } | 162 | } |
192 | 163 | ||
193 | overo_smsc911x_resources[0].start = cs_mem_base + 0x0; | 164 | gpio_export(OVERO_GPIO_LCD_EN, 0); |
194 | overo_smsc911x_resources[0].end = cs_mem_base + 0xff; | 165 | gpio_export(OVERO_GPIO_LCD_BL, 0); |
166 | } | ||
195 | 167 | ||
196 | if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && | 168 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) |
197 | (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) { | 169 | { |
198 | gpio_export(OVERO_SMSC911X_GPIO, 0); | 170 | if (lcd_enabled) { |
199 | } else { | 171 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); |
200 | printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n"); | 172 | return -EINVAL; |
201 | return; | ||
202 | } | 173 | } |
174 | dvi_enabled = 1; | ||
203 | 175 | ||
204 | overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); | 176 | return 0; |
205 | overo_smsc911x_resources[1].end = 0; | 177 | } |
206 | 178 | ||
207 | /* set up second smsc911x chip */ | 179 | static void overo_panel_disable_dvi(struct omap_dss_device *dssdev) |
180 | { | ||
181 | dvi_enabled = 0; | ||
182 | } | ||
208 | 183 | ||
209 | if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) { | 184 | static struct panel_generic_dpi_data dvi_panel = { |
210 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n"); | 185 | .name = "generic", |
211 | return; | 186 | .platform_enable = overo_panel_enable_dvi, |
212 | } | 187 | .platform_disable = overo_panel_disable_dvi, |
188 | }; | ||
213 | 189 | ||
214 | overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0; | 190 | static struct omap_dss_device overo_dvi_device = { |
215 | overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff; | 191 | .name = "dvi", |
192 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
193 | .driver_name = "generic_dpi_panel", | ||
194 | .data = &dvi_panel, | ||
195 | .phy.dpi.data_lines = 24, | ||
196 | }; | ||
216 | 197 | ||
217 | if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) && | 198 | static struct omap_dss_device overo_tv_device = { |
218 | (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) { | 199 | .name = "tv", |
219 | gpio_export(OVERO_SMSC911X2_GPIO, 0); | 200 | .driver_name = "venc", |
220 | } else { | 201 | .type = OMAP_DISPLAY_TYPE_VENC, |
221 | printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n"); | 202 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
222 | return; | 203 | }; |
204 | |||
205 | static int overo_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
206 | { | ||
207 | if (dvi_enabled) { | ||
208 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
209 | return -EINVAL; | ||
223 | } | 210 | } |
224 | 211 | ||
225 | overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO); | 212 | gpio_set_value(OVERO_GPIO_LCD_EN, 1); |
226 | overo_smsc911x2_resources[1].end = 0; | 213 | gpio_set_value(OVERO_GPIO_LCD_BL, 1); |
214 | lcd_enabled = 1; | ||
215 | return 0; | ||
216 | } | ||
227 | 217 | ||
228 | platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices)); | 218 | static void overo_panel_disable_lcd(struct omap_dss_device *dssdev) |
219 | { | ||
220 | gpio_set_value(OVERO_GPIO_LCD_EN, 0); | ||
221 | gpio_set_value(OVERO_GPIO_LCD_BL, 0); | ||
222 | lcd_enabled = 0; | ||
229 | } | 223 | } |
230 | 224 | ||
231 | #else | 225 | static struct panel_generic_dpi_data lcd43_panel = { |
232 | static inline void __init overo_init_smsc911x(void) { return; } | 226 | .name = "samsung_lte430wq_f0c", |
227 | .platform_enable = overo_panel_enable_lcd, | ||
228 | .platform_disable = overo_panel_disable_lcd, | ||
229 | }; | ||
230 | |||
231 | static struct omap_dss_device overo_lcd43_device = { | ||
232 | .name = "lcd43", | ||
233 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
234 | .driver_name = "generic_dpi_panel", | ||
235 | .data = &lcd43_panel, | ||
236 | .phy.dpi.data_lines = 24, | ||
237 | }; | ||
238 | |||
239 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ | ||
240 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) | ||
241 | static struct omap_dss_device overo_lcd35_device = { | ||
242 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
243 | .name = "lcd35", | ||
244 | .driver_name = "lgphilips_lb035q02_panel", | ||
245 | .phy.dpi.data_lines = 24, | ||
246 | .platform_enable = overo_panel_enable_lcd, | ||
247 | .platform_disable = overo_panel_disable_lcd, | ||
248 | }; | ||
233 | #endif | 249 | #endif |
234 | 250 | ||
251 | static struct omap_dss_device *overo_dss_devices[] = { | ||
252 | &overo_dvi_device, | ||
253 | &overo_tv_device, | ||
254 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ | ||
255 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) | ||
256 | &overo_lcd35_device, | ||
257 | #endif | ||
258 | &overo_lcd43_device, | ||
259 | }; | ||
260 | |||
261 | static struct omap_dss_board_info overo_dss_data = { | ||
262 | .num_devices = ARRAY_SIZE(overo_dss_devices), | ||
263 | .devices = overo_dss_devices, | ||
264 | .default_device = &overo_dvi_device, | ||
265 | }; | ||
266 | |||
267 | static struct regulator_consumer_supply overo_vdda_dac_supply = | ||
268 | REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"); | ||
269 | |||
270 | static struct regulator_consumer_supply overo_vdds_dsi_supply[] = { | ||
271 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | ||
272 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), | ||
273 | }; | ||
274 | |||
235 | static struct mtd_partition overo_nand_partitions[] = { | 275 | static struct mtd_partition overo_nand_partitions[] = { |
236 | { | 276 | { |
237 | .name = "xloader", | 277 | .name = "xloader", |
@@ -261,55 +301,16 @@ static struct mtd_partition overo_nand_partitions[] = { | |||
261 | }, | 301 | }, |
262 | }; | 302 | }; |
263 | 303 | ||
264 | static struct omap_nand_platform_data overo_nand_data = { | ||
265 | .parts = overo_nand_partitions, | ||
266 | .nr_parts = ARRAY_SIZE(overo_nand_partitions), | ||
267 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | ||
268 | }; | ||
269 | |||
270 | static void __init overo_flash_init(void) | ||
271 | { | ||
272 | u8 cs = 0; | ||
273 | u8 nandcs = GPMC_CS_NUM + 1; | ||
274 | |||
275 | /* find out the chip-select on which NAND exists */ | ||
276 | while (cs < GPMC_CS_NUM) { | ||
277 | u32 ret = 0; | ||
278 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
279 | |||
280 | if ((ret & 0xC00) == 0x800) { | ||
281 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | ||
282 | if (nandcs > GPMC_CS_NUM) | ||
283 | nandcs = cs; | ||
284 | } | ||
285 | cs++; | ||
286 | } | ||
287 | |||
288 | if (nandcs > GPMC_CS_NUM) { | ||
289 | printk(KERN_INFO "NAND: Unable to find configuration " | ||
290 | "in GPMC\n "); | ||
291 | return; | ||
292 | } | ||
293 | |||
294 | if (nandcs < GPMC_CS_NUM) { | ||
295 | overo_nand_data.cs = nandcs; | ||
296 | |||
297 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | ||
298 | if (gpmc_nand_init(&overo_nand_data) < 0) | ||
299 | printk(KERN_ERR "Unable to register NAND device\n"); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | static struct omap2_hsmmc_info mmc[] = { | 304 | static struct omap2_hsmmc_info mmc[] = { |
304 | { | 305 | { |
305 | .mmc = 1, | 306 | .mmc = 1, |
306 | .wires = 4, | 307 | .caps = MMC_CAP_4_BIT_DATA, |
307 | .gpio_cd = -EINVAL, | 308 | .gpio_cd = -EINVAL, |
308 | .gpio_wp = -EINVAL, | 309 | .gpio_wp = -EINVAL, |
309 | }, | 310 | }, |
310 | { | 311 | { |
311 | .mmc = 2, | 312 | .mmc = 2, |
312 | .wires = 4, | 313 | .caps = MMC_CAP_4_BIT_DATA, |
313 | .gpio_cd = -EINVAL, | 314 | .gpio_cd = -EINVAL, |
314 | .gpio_wp = -EINVAL, | 315 | .gpio_wp = -EINVAL, |
315 | .transceiver = true, | 316 | .transceiver = true, |
@@ -322,6 +323,93 @@ static struct regulator_consumer_supply overo_vmmc1_supply = { | |||
322 | .supply = "vmmc", | 323 | .supply = "vmmc", |
323 | }; | 324 | }; |
324 | 325 | ||
326 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
327 | #include <linux/leds.h> | ||
328 | |||
329 | static struct gpio_led gpio_leds[] = { | ||
330 | { | ||
331 | .name = "overo:red:gpio21", | ||
332 | .default_trigger = "heartbeat", | ||
333 | .gpio = 21, | ||
334 | .active_low = true, | ||
335 | }, | ||
336 | { | ||
337 | .name = "overo:blue:gpio22", | ||
338 | .default_trigger = "none", | ||
339 | .gpio = 22, | ||
340 | .active_low = true, | ||
341 | }, | ||
342 | { | ||
343 | .name = "overo:blue:COM", | ||
344 | .default_trigger = "mmc0", | ||
345 | .gpio = -EINVAL, /* gets replaced */ | ||
346 | .active_low = true, | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | static struct gpio_led_platform_data gpio_leds_pdata = { | ||
351 | .leds = gpio_leds, | ||
352 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
353 | }; | ||
354 | |||
355 | static struct platform_device gpio_leds_device = { | ||
356 | .name = "leds-gpio", | ||
357 | .id = -1, | ||
358 | .dev = { | ||
359 | .platform_data = &gpio_leds_pdata, | ||
360 | }, | ||
361 | }; | ||
362 | |||
363 | static void __init overo_init_led(void) | ||
364 | { | ||
365 | platform_device_register(&gpio_leds_device); | ||
366 | } | ||
367 | |||
368 | #else | ||
369 | static inline void __init overo_init_led(void) { return; } | ||
370 | #endif | ||
371 | |||
372 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
373 | #include <linux/input.h> | ||
374 | #include <linux/gpio_keys.h> | ||
375 | |||
376 | static struct gpio_keys_button gpio_buttons[] = { | ||
377 | { | ||
378 | .code = BTN_0, | ||
379 | .gpio = 23, | ||
380 | .desc = "button0", | ||
381 | .wakeup = 1, | ||
382 | }, | ||
383 | { | ||
384 | .code = BTN_1, | ||
385 | .gpio = 14, | ||
386 | .desc = "button1", | ||
387 | .wakeup = 1, | ||
388 | }, | ||
389 | }; | ||
390 | |||
391 | static struct gpio_keys_platform_data gpio_keys_pdata = { | ||
392 | .buttons = gpio_buttons, | ||
393 | .nbuttons = ARRAY_SIZE(gpio_buttons), | ||
394 | }; | ||
395 | |||
396 | static struct platform_device gpio_keys_device = { | ||
397 | .name = "gpio-keys", | ||
398 | .id = -1, | ||
399 | .dev = { | ||
400 | .platform_data = &gpio_keys_pdata, | ||
401 | }, | ||
402 | }; | ||
403 | |||
404 | static void __init overo_init_keys(void) | ||
405 | { | ||
406 | platform_device_register(&gpio_keys_device); | ||
407 | } | ||
408 | |||
409 | #else | ||
410 | static inline void __init overo_init_keys(void) { return; } | ||
411 | #endif | ||
412 | |||
325 | static int overo_twl_gpio_setup(struct device *dev, | 413 | static int overo_twl_gpio_setup(struct device *dev, |
326 | unsigned gpio, unsigned ngpio) | 414 | unsigned gpio, unsigned ngpio) |
327 | { | 415 | { |
@@ -329,6 +417,11 @@ static int overo_twl_gpio_setup(struct device *dev, | |||
329 | 417 | ||
330 | overo_vmmc1_supply.dev = mmc[0].dev; | 418 | overo_vmmc1_supply.dev = mmc[0].dev; |
331 | 419 | ||
420 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
421 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
422 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
423 | #endif | ||
424 | |||
332 | return 0; | 425 | return 0; |
333 | } | 426 | } |
334 | 427 | ||
@@ -336,6 +429,7 @@ static struct twl4030_gpio_platform_data overo_gpio_data = { | |||
336 | .gpio_base = OMAP_MAX_GPIO_LINES, | 429 | .gpio_base = OMAP_MAX_GPIO_LINES, |
337 | .irq_base = TWL4030_GPIO_IRQ_BASE, | 430 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
338 | .irq_end = TWL4030_GPIO_IRQ_END, | 431 | .irq_end = TWL4030_GPIO_IRQ_END, |
432 | .use_leds = true, | ||
339 | .setup = overo_twl_gpio_setup, | 433 | .setup = overo_twl_gpio_setup, |
340 | }; | 434 | }; |
341 | 435 | ||
@@ -357,17 +451,42 @@ static struct regulator_init_data overo_vmmc1 = { | |||
357 | .consumer_supplies = &overo_vmmc1_supply, | 451 | .consumer_supplies = &overo_vmmc1_supply, |
358 | }; | 452 | }; |
359 | 453 | ||
360 | static struct twl4030_codec_audio_data overo_audio_data = { | 454 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ |
361 | .audio_mclk = 26000000, | 455 | static struct regulator_init_data overo_vdac = { |
456 | .constraints = { | ||
457 | .min_uV = 1800000, | ||
458 | .max_uV = 1800000, | ||
459 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
460 | | REGULATOR_MODE_STANDBY, | ||
461 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
462 | | REGULATOR_CHANGE_STATUS, | ||
463 | }, | ||
464 | .num_consumer_supplies = 1, | ||
465 | .consumer_supplies = &overo_vdda_dac_supply, | ||
362 | }; | 466 | }; |
363 | 467 | ||
468 | /* VPLL2 for digital video outputs */ | ||
469 | static struct regulator_init_data overo_vpll2 = { | ||
470 | .constraints = { | ||
471 | .name = "VDVI", | ||
472 | .min_uV = 1800000, | ||
473 | .max_uV = 1800000, | ||
474 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
475 | | REGULATOR_MODE_STANDBY, | ||
476 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
477 | | REGULATOR_CHANGE_STATUS, | ||
478 | }, | ||
479 | .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply), | ||
480 | .consumer_supplies = overo_vdds_dsi_supply, | ||
481 | }; | ||
482 | |||
483 | static struct twl4030_codec_audio_data overo_audio_data; | ||
484 | |||
364 | static struct twl4030_codec_data overo_codec_data = { | 485 | static struct twl4030_codec_data overo_codec_data = { |
365 | .audio_mclk = 26000000, | 486 | .audio_mclk = 26000000, |
366 | .audio = &overo_audio_data, | 487 | .audio = &overo_audio_data, |
367 | }; | 488 | }; |
368 | 489 | ||
369 | /* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */ | ||
370 | |||
371 | static struct twl4030_platform_data overo_twldata = { | 490 | static struct twl4030_platform_data overo_twldata = { |
372 | .irq_base = TWL4030_IRQ_BASE, | 491 | .irq_base = TWL4030_IRQ_BASE, |
373 | .irq_end = TWL4030_IRQ_END, | 492 | .irq_end = TWL4030_IRQ_END, |
@@ -375,58 +494,50 @@ static struct twl4030_platform_data overo_twldata = { | |||
375 | .usb = &overo_usb_data, | 494 | .usb = &overo_usb_data, |
376 | .codec = &overo_codec_data, | 495 | .codec = &overo_codec_data, |
377 | .vmmc1 = &overo_vmmc1, | 496 | .vmmc1 = &overo_vmmc1, |
378 | }; | 497 | .vdac = &overo_vdac, |
379 | 498 | .vpll2 = &overo_vpll2, | |
380 | static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { | ||
381 | { | ||
382 | I2C_BOARD_INFO("tps65950", 0x48), | ||
383 | .flags = I2C_CLIENT_WAKE, | ||
384 | .irq = INT_34XX_SYS_NIRQ, | ||
385 | .platform_data = &overo_twldata, | ||
386 | }, | ||
387 | }; | 499 | }; |
388 | 500 | ||
389 | static int __init overo_i2c_init(void) | 501 | static int __init overo_i2c_init(void) |
390 | { | 502 | { |
391 | omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, | 503 | omap3_pmic_init("tps65950", &overo_twldata); |
392 | ARRAY_SIZE(overo_i2c_boardinfo)); | ||
393 | /* i2c2 pins are used for gpio */ | 504 | /* i2c2 pins are used for gpio */ |
394 | omap_register_i2c_bus(3, 400, NULL, 0); | 505 | omap_register_i2c_bus(3, 400, NULL, 0); |
395 | return 0; | 506 | return 0; |
396 | } | 507 | } |
397 | 508 | ||
398 | static struct platform_device overo_lcd_device = { | 509 | static struct spi_board_info overo_spi_board_info[] __initdata = { |
399 | .name = "overo_lcd", | 510 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ |
400 | .id = -1, | 511 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) |
401 | }; | 512 | { |
402 | 513 | .modalias = "lgphilips_lb035q02_panel-spi", | |
403 | static struct omap_lcd_config overo_lcd_config __initdata = { | 514 | .bus_num = 1, |
404 | .ctrl_name = "internal", | 515 | .chip_select = 1, |
405 | }; | 516 | .max_speed_hz = 500000, |
406 | 517 | .mode = SPI_MODE_3, | |
407 | static struct omap_board_config_kernel overo_config[] __initdata = { | 518 | }, |
408 | { OMAP_TAG_LCD, &overo_lcd_config }, | 519 | #endif |
409 | }; | 520 | }; |
410 | 521 | ||
411 | static void __init overo_init_irq(void) | 522 | static int __init overo_spi_init(void) |
412 | { | 523 | { |
413 | omap_board_config = overo_config; | 524 | overo_ads7846_init(); |
414 | omap_board_config_size = ARRAY_SIZE(overo_config); | 525 | spi_register_board_info(overo_spi_board_info, |
415 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, | 526 | ARRAY_SIZE(overo_spi_board_info)); |
416 | mt46h32m32lf6_sdrc_params); | 527 | return 0; |
417 | omap_init_irq(); | ||
418 | omap_gpio_init(); | ||
419 | } | 528 | } |
420 | 529 | ||
421 | static struct platform_device *overo_devices[] __initdata = { | 530 | static void __init overo_init_early(void) |
422 | &overo_lcd_device, | 531 | { |
423 | }; | 532 | omap2_init_common_infrastructure(); |
424 | 533 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, | |
425 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 534 | mt46h32m32lf6_sdrc_params); |
426 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 535 | } |
427 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | ||
428 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
429 | 536 | ||
537 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | ||
538 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
539 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | ||
540 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
430 | .phy_reset = true, | 541 | .phy_reset = true, |
431 | .reset_gpio_port[0] = -EINVAL, | 542 | .reset_gpio_port[0] = -EINVAL, |
432 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, | 543 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, |
@@ -437,35 +548,39 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | |||
437 | static struct omap_board_mux board_mux[] __initdata = { | 548 | static struct omap_board_mux board_mux[] __initdata = { |
438 | { .reg_offset = OMAP_MUX_TERMINATOR }, | 549 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
439 | }; | 550 | }; |
440 | #else | ||
441 | #define board_mux NULL | ||
442 | #endif | 551 | #endif |
443 | 552 | ||
444 | static struct omap_musb_board_data musb_board_data = { | 553 | static struct gpio overo_bt_gpios[] __initdata = { |
445 | .interface_type = MUSB_INTERFACE_ULPI, | 554 | { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" }, |
446 | .mode = MUSB_OTG, | 555 | { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, |
447 | .power = 100, | ||
448 | }; | 556 | }; |
449 | 557 | ||
450 | static void __init overo_init(void) | 558 | static void __init overo_init(void) |
451 | { | 559 | { |
560 | int ret; | ||
561 | |||
452 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 562 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
453 | overo_i2c_init(); | 563 | overo_i2c_init(); |
454 | platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices)); | 564 | omap_display_init(&overo_dss_data); |
455 | omap_serial_init(); | 565 | omap_serial_init(); |
456 | overo_flash_init(); | 566 | omap_nand_flash_init(0, overo_nand_partitions, |
457 | usb_musb_init(&musb_board_data); | 567 | ARRAY_SIZE(overo_nand_partitions)); |
458 | usb_ehci_init(&ehci_pdata); | 568 | usb_musb_init(NULL); |
569 | usbhs_init(&usbhs_bdata); | ||
570 | overo_spi_init(); | ||
459 | overo_ads7846_init(); | 571 | overo_ads7846_init(); |
460 | overo_init_smsc911x(); | 572 | overo_init_smsc911x(); |
573 | overo_display_init(); | ||
574 | overo_init_led(); | ||
575 | overo_init_keys(); | ||
461 | 576 | ||
462 | /* Ensure SDRC pins are mux'd for self-refresh */ | 577 | /* Ensure SDRC pins are mux'd for self-refresh */ |
463 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 578 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
464 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 579 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
465 | 580 | ||
466 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, | 581 | ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH, |
467 | "OVERO_GPIO_W2W_NRESET") == 0) && | 582 | "OVERO_GPIO_W2W_NRESET"); |
468 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { | 583 | if (ret == 0) { |
469 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); | 584 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); |
470 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); | 585 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); |
471 | udelay(10); | 586 | udelay(10); |
@@ -475,25 +590,20 @@ static void __init overo_init(void) | |||
475 | "OVERO_GPIO_W2W_NRESET\n"); | 590 | "OVERO_GPIO_W2W_NRESET\n"); |
476 | } | 591 | } |
477 | 592 | ||
478 | if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && | 593 | ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios)); |
479 | (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) | 594 | if (ret) { |
595 | pr_err("%s: could not obtain BT gpios\n", __func__); | ||
596 | } else { | ||
480 | gpio_export(OVERO_GPIO_BT_XGATE, 0); | 597 | gpio_export(OVERO_GPIO_BT_XGATE, 0); |
481 | else | ||
482 | printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); | ||
483 | |||
484 | if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && | ||
485 | (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { | ||
486 | gpio_export(OVERO_GPIO_BT_NRESET, 0); | 598 | gpio_export(OVERO_GPIO_BT_NRESET, 0); |
487 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); | 599 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); |
488 | mdelay(6); | 600 | mdelay(6); |
489 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); | 601 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); |
490 | } else { | ||
491 | printk(KERN_ERR "could not obtain gpio for " | ||
492 | "OVERO_GPIO_BT_NRESET\n"); | ||
493 | } | 602 | } |
494 | 603 | ||
495 | if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && | 604 | ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH, |
496 | (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) | 605 | "OVERO_GPIO_USBH_CPEN"); |
606 | if (ret == 0) | ||
497 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); | 607 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); |
498 | else | 608 | else |
499 | printk(KERN_ERR "could not obtain gpio for " | 609 | printk(KERN_ERR "could not obtain gpio for " |
@@ -501,12 +611,11 @@ static void __init overo_init(void) | |||
501 | } | 611 | } |
502 | 612 | ||
503 | MACHINE_START(OVERO, "Gumstix Overo") | 613 | MACHINE_START(OVERO, "Gumstix Overo") |
504 | .phys_io = 0x48000000, | ||
505 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, | ||
506 | .boot_params = 0x80000100, | 614 | .boot_params = 0x80000100, |
507 | .map_io = omap3_map_io, | ||
508 | .reserve = omap_reserve, | 615 | .reserve = omap_reserve, |
509 | .init_irq = overo_init_irq, | 616 | .map_io = omap3_map_io, |
617 | .init_early = overo_init_early, | ||
618 | .init_irq = omap_init_irq, | ||
510 | .init_machine = overo_init, | 619 | .init_machine = overo_init, |
511 | .timer = &omap_timer, | 620 | .timer = &omap_timer, |
512 | MACHINE_END | 621 | MACHINE_END |