]>
Commit | Line | Data |
---|---|---|
6d9598e2 MD |
1 | /* |
2 | * arch/arm/mach-shmobile/board-ag5evm.c | |
3 | * | |
4 | * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com> | |
5 | * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; version 2 of the License. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | * | |
20 | */ | |
21 | ||
22 | #include <linux/kernel.h> | |
23 | #include <linux/init.h> | |
24 | #include <linux/interrupt.h> | |
25 | #include <linux/irq.h> | |
26 | #include <linux/platform_device.h> | |
27 | #include <linux/delay.h> | |
28 | #include <linux/io.h> | |
29 | #include <linux/dma-mapping.h> | |
6add9691 GL |
30 | #include <linux/regulator/fixed.h> |
31 | #include <linux/regulator/machine.h> | |
6d9598e2 MD |
32 | #include <linux/serial_sci.h> |
33 | #include <linux/smsc911x.h> | |
34 | #include <linux/gpio.h> | |
04f47a03 | 35 | #include <linux/videodev2.h> |
2d22d486 TY |
36 | #include <linux/input.h> |
37 | #include <linux/input/sh_keysc.h> | |
6bf45a10 TY |
38 | #include <linux/mmc/host.h> |
39 | #include <linux/mmc/sh_mmcif.h> | |
fb66c523 MD |
40 | #include <linux/mmc/sh_mobile_sdhi.h> |
41 | #include <linux/mfd/tmio.h> | |
170c7ab5 MD |
42 | #include <linux/sh_clk.h> |
43 | #include <video/sh_mobile_lcdc.h> | |
44 | #include <video/sh_mipi_dsi.h> | |
208c7dc2 | 45 | #include <sound/sh_fsi.h> |
6d9598e2 | 46 | #include <mach/hardware.h> |
250a2723 | 47 | #include <mach/irqs.h> |
6d9598e2 MD |
48 | #include <mach/sh73a0.h> |
49 | #include <mach/common.h> | |
50 | #include <asm/mach-types.h> | |
51 | #include <asm/mach/arch.h> | |
6d9598e2 MD |
52 | #include <asm/hardware/gic.h> |
53 | #include <asm/hardware/cache-l2x0.h> | |
54 | #include <asm/traps.h> | |
55 | ||
6add9691 GL |
56 | /* Dummy supplies, where voltage doesn't matter */ |
57 | static struct regulator_consumer_supply dummy_supplies[] = { | |
58 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | |
59 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | |
60 | }; | |
61 | ||
6d9598e2 MD |
62 | static struct resource smsc9220_resources[] = { |
63 | [0] = { | |
64 | .start = 0x14000000, | |
65 | .end = 0x14000000 + SZ_64K - 1, | |
66 | .flags = IORESOURCE_MEM, | |
67 | }, | |
68 | [1] = { | |
566aad39 | 69 | .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */ |
6d9598e2 MD |
70 | .flags = IORESOURCE_IRQ, |
71 | }, | |
72 | }; | |
73 | ||
74 | static struct smsc911x_platform_config smsc9220_platdata = { | |
75 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, | |
76 | .phy_interface = PHY_INTERFACE_MODE_MII, | |
77 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | |
78 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | |
79 | }; | |
80 | ||
81 | static struct platform_device eth_device = { | |
82 | .name = "smsc911x", | |
83 | .id = 0, | |
84 | .dev = { | |
85 | .platform_data = &smsc9220_platdata, | |
86 | }, | |
87 | .resource = smsc9220_resources, | |
88 | .num_resources = ARRAY_SIZE(smsc9220_resources), | |
89 | }; | |
90 | ||
2d22d486 TY |
91 | static struct sh_keysc_info keysc_platdata = { |
92 | .mode = SH_KEYSC_MODE_6, | |
93 | .scan_timing = 3, | |
94 | .delay = 100, | |
95 | .keycodes = { | |
96 | KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, | |
97 | KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, | |
98 | KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, | |
99 | KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP, | |
100 | KEY_SPACE, KEY_9, KEY_6, KEY_3, KEY_WAKEUP, KEY_RIGHT, \ | |
101 | KEY_COFFEE, | |
102 | KEY_0, KEY_8, KEY_5, KEY_2, KEY_DOWN, KEY_ENTER, KEY_UP, | |
103 | KEY_KPASTERISK, KEY_7, KEY_4, KEY_1, KEY_STOP, KEY_LEFT, \ | |
104 | KEY_COMPUTER, | |
105 | }, | |
106 | }; | |
107 | ||
108 | static struct resource keysc_resources[] = { | |
109 | [0] = { | |
110 | .name = "KEYSC", | |
111 | .start = 0xe61b0000, | |
112 | .end = 0xe61b0098 - 1, | |
113 | .flags = IORESOURCE_MEM, | |
114 | }, | |
115 | [1] = { | |
116 | .start = gic_spi(71), | |
117 | .flags = IORESOURCE_IRQ, | |
118 | }, | |
119 | }; | |
120 | ||
121 | static struct platform_device keysc_device = { | |
122 | .name = "sh_keysc", | |
123 | .id = 0, | |
124 | .num_resources = ARRAY_SIZE(keysc_resources), | |
125 | .resource = keysc_resources, | |
126 | .dev = { | |
127 | .platform_data = &keysc_platdata, | |
128 | }, | |
129 | }; | |
130 | ||
208c7dc2 | 131 | /* FSI A */ |
208c7dc2 KM |
132 | static struct resource fsi_resources[] = { |
133 | [0] = { | |
134 | .name = "FSI", | |
135 | .start = 0xEC230000, | |
136 | .end = 0xEC230400 - 1, | |
137 | .flags = IORESOURCE_MEM, | |
138 | }, | |
139 | [1] = { | |
140 | .start = gic_spi(146), | |
141 | .flags = IORESOURCE_IRQ, | |
142 | }, | |
143 | }; | |
144 | ||
145 | static struct platform_device fsi_device = { | |
146 | .name = "sh_fsi2", | |
147 | .id = -1, | |
148 | .num_resources = ARRAY_SIZE(fsi_resources), | |
149 | .resource = fsi_resources, | |
208c7dc2 KM |
150 | }; |
151 | ||
6add9691 GL |
152 | /* Fixed 1.8V regulator to be used by MMCIF */ |
153 | static struct regulator_consumer_supply fixed1v8_power_consumers[] = | |
154 | { | |
155 | REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), | |
156 | REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"), | |
157 | }; | |
158 | ||
6bf45a10 TY |
159 | static struct resource sh_mmcif_resources[] = { |
160 | [0] = { | |
161 | .name = "MMCIF", | |
162 | .start = 0xe6bd0000, | |
163 | .end = 0xe6bd00ff, | |
164 | .flags = IORESOURCE_MEM, | |
165 | }, | |
166 | [1] = { | |
167 | .start = gic_spi(141), | |
168 | .flags = IORESOURCE_IRQ, | |
169 | }, | |
170 | [2] = { | |
171 | .start = gic_spi(140), | |
172 | .flags = IORESOURCE_IRQ, | |
173 | }, | |
174 | }; | |
175 | ||
176 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { | |
177 | .sup_pclk = 0, | |
178 | .ocr = MMC_VDD_165_195, | |
179 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | |
d5bb386d GL |
180 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, |
181 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | |
6bf45a10 TY |
182 | }; |
183 | ||
184 | static struct platform_device mmc_device = { | |
185 | .name = "sh_mmcif", | |
186 | .id = 0, | |
187 | .dev = { | |
188 | .dma_mask = NULL, | |
189 | .coherent_dma_mask = 0xffffffff, | |
190 | .platform_data = &sh_mmcif_platdata, | |
191 | }, | |
192 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), | |
193 | .resource = sh_mmcif_resources, | |
194 | }; | |
195 | ||
a33bb8a2 KM |
196 | /* IrDA */ |
197 | static struct resource irda_resources[] = { | |
198 | [0] = { | |
199 | .start = 0xE6D00000, | |
200 | .end = 0xE6D01FD4 - 1, | |
201 | .flags = IORESOURCE_MEM, | |
202 | }, | |
203 | [1] = { | |
204 | .start = gic_spi(95), | |
205 | .flags = IORESOURCE_IRQ, | |
206 | }, | |
207 | }; | |
208 | ||
209 | static struct platform_device irda_device = { | |
210 | .name = "sh_irda", | |
211 | .id = 0, | |
212 | .resource = irda_resources, | |
213 | .num_resources = ARRAY_SIZE(irda_resources), | |
214 | }; | |
215 | ||
7a4fcf91 LP |
216 | /* MIPI-DSI */ |
217 | static struct resource mipidsi0_resources[] = { | |
218 | [0] = { | |
219 | .name = "DSI0", | |
220 | .start = 0xfeab0000, | |
221 | .end = 0xfeab3fff, | |
222 | .flags = IORESOURCE_MEM, | |
223 | }, | |
224 | [1] = { | |
225 | .name = "DSI0", | |
226 | .start = 0xfeab4000, | |
227 | .end = 0xfeab7fff, | |
228 | .flags = IORESOURCE_MEM, | |
229 | }, | |
230 | }; | |
231 | ||
232 | static int sh_mipi_set_dot_clock(struct platform_device *pdev, | |
233 | void __iomem *base, | |
234 | int enable) | |
235 | { | |
236 | struct clk *pck, *phy; | |
237 | int ret; | |
238 | ||
239 | pck = clk_get(&pdev->dev, "dsip_clk"); | |
240 | if (IS_ERR(pck)) { | |
241 | ret = PTR_ERR(pck); | |
242 | goto sh_mipi_set_dot_clock_pck_err; | |
243 | } | |
244 | ||
245 | phy = clk_get(&pdev->dev, "dsiphy_clk"); | |
246 | if (IS_ERR(phy)) { | |
247 | ret = PTR_ERR(phy); | |
248 | goto sh_mipi_set_dot_clock_phy_err; | |
249 | } | |
250 | ||
251 | if (enable) { | |
252 | clk_set_rate(pck, clk_round_rate(pck, 24000000)); | |
253 | clk_set_rate(phy, clk_round_rate(pck, 510000000)); | |
254 | clk_enable(pck); | |
255 | clk_enable(phy); | |
256 | } else { | |
257 | clk_disable(pck); | |
258 | clk_disable(phy); | |
259 | } | |
260 | ||
261 | ret = 0; | |
262 | ||
263 | clk_put(phy); | |
264 | sh_mipi_set_dot_clock_phy_err: | |
265 | clk_put(pck); | |
266 | sh_mipi_set_dot_clock_pck_err: | |
267 | return ret; | |
268 | } | |
269 | ||
7a4fcf91 LP |
270 | static struct sh_mipi_dsi_info mipidsi0_info = { |
271 | .data_format = MIPI_RGB888, | |
772f5d1b | 272 | .channel = LCDC_CHAN_MAINLCD, |
7a4fcf91 LP |
273 | .lane = 2, |
274 | .vsynw_offset = 20, | |
275 | .clksrc = 1, | |
276 | .flags = SH_MIPI_DSI_HSABM | | |
277 | SH_MIPI_DSI_SYNC_PULSES_MODE | | |
278 | SH_MIPI_DSI_HSbyteCLK, | |
279 | .set_dot_clock = sh_mipi_set_dot_clock, | |
280 | }; | |
281 | ||
282 | static struct platform_device mipidsi0_device = { | |
283 | .name = "sh-mipi-dsi", | |
284 | .num_resources = ARRAY_SIZE(mipidsi0_resources), | |
285 | .resource = mipidsi0_resources, | |
286 | .id = 0, | |
287 | .dev = { | |
288 | .platform_data = &mipidsi0_info, | |
289 | }, | |
290 | }; | |
291 | ||
170c7ab5 MD |
292 | static unsigned char lcd_backlight_seq[3][2] = { |
293 | { 0x04, 0x07 }, | |
294 | { 0x23, 0x80 }, | |
295 | { 0x03, 0x01 }, | |
296 | }; | |
297 | ||
37f4dd13 | 298 | static int lcd_backlight_set_brightness(int brightness) |
170c7ab5 | 299 | { |
37f4dd13 | 300 | struct i2c_adapter *adap; |
170c7ab5 | 301 | struct i2c_msg msg; |
37f4dd13 LP |
302 | unsigned int i; |
303 | int ret; | |
304 | ||
305 | if (brightness == 0) { | |
306 | /* Reset the chip */ | |
307 | gpio_set_value(GPIO_PORT235, 0); | |
308 | mdelay(24); | |
309 | gpio_set_value(GPIO_PORT235, 1); | |
310 | return 0; | |
311 | } | |
312 | ||
313 | adap = i2c_get_adapter(1); | |
314 | if (adap == NULL) | |
315 | return -ENODEV; | |
170c7ab5 | 316 | |
37f4dd13 | 317 | for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) { |
170c7ab5 | 318 | msg.addr = 0x6d; |
37f4dd13 | 319 | msg.buf = &lcd_backlight_seq[i][0]; |
170c7ab5 MD |
320 | msg.len = 2; |
321 | msg.flags = 0; | |
37f4dd13 LP |
322 | |
323 | ret = i2c_transfer(adap, &msg, 1); | |
324 | if (ret < 0) | |
170c7ab5 MD |
325 | break; |
326 | } | |
170c7ab5 | 327 | |
37f4dd13 LP |
328 | i2c_put_adapter(adap); |
329 | return ret < 0 ? ret : 0; | |
170c7ab5 MD |
330 | } |
331 | ||
170c7ab5 MD |
332 | /* LCDC0 */ |
333 | static const struct fb_videomode lcdc0_modes[] = { | |
334 | { | |
335 | .name = "R63302(QHD)", | |
336 | .xres = 544, | |
337 | .yres = 961, | |
338 | .left_margin = 72, | |
339 | .right_margin = 600, | |
340 | .hsync_len = 16, | |
341 | .upper_margin = 8, | |
342 | .lower_margin = 8, | |
343 | .vsync_len = 2, | |
344 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, | |
345 | }, | |
346 | }; | |
347 | ||
348 | static struct sh_mobile_lcdc_info lcdc0_info = { | |
349 | .clock_source = LCDC_CLK_PERIPHERAL, | |
350 | .ch[0] = { | |
351 | .chan = LCDC_CHAN_MAINLCD, | |
352 | .interface_type = RGB24, | |
353 | .clock_divider = 1, | |
354 | .flags = LCDC_FLAGS_DWPOL, | |
edd153a3 | 355 | .fourcc = V4L2_PIX_FMT_RGB565, |
93ff2598 LP |
356 | .lcd_modes = lcdc0_modes, |
357 | .num_modes = ARRAY_SIZE(lcdc0_modes), | |
afaad83b LP |
358 | .panel_cfg = { |
359 | .width = 44, | |
360 | .height = 79, | |
37f4dd13 LP |
361 | }, |
362 | .bl_info = { | |
363 | .name = "sh_mobile_lcdc_bl", | |
364 | .max_brightness = 1, | |
365 | .set_brightness = lcd_backlight_set_brightness, | |
170c7ab5 | 366 | }, |
7a4fcf91 | 367 | .tx_dev = &mipidsi0_device, |
170c7ab5 MD |
368 | } |
369 | }; | |
370 | ||
371 | static struct resource lcdc0_resources[] = { | |
372 | [0] = { | |
373 | .name = "LCDC0", | |
374 | .start = 0xfe940000, /* P4-only space */ | |
375 | .end = 0xfe943fff, | |
376 | .flags = IORESOURCE_MEM, | |
377 | }, | |
378 | [1] = { | |
379 | .start = intcs_evt2irq(0x580), | |
380 | .flags = IORESOURCE_IRQ, | |
381 | }, | |
382 | }; | |
383 | ||
384 | static struct platform_device lcdc0_device = { | |
385 | .name = "sh_mobile_lcdc_fb", | |
386 | .num_resources = ARRAY_SIZE(lcdc0_resources), | |
387 | .resource = lcdc0_resources, | |
388 | .id = 0, | |
389 | .dev = { | |
390 | .platform_data = &lcdc0_info, | |
391 | .coherent_dma_mask = ~0, | |
392 | }, | |
393 | }; | |
394 | ||
6add9691 GL |
395 | /* Fixed 2.8V regulators to be used by SDHI0 */ |
396 | static struct regulator_consumer_supply fixed2v8_power_consumers[] = | |
397 | { | |
398 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), | |
399 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), | |
400 | }; | |
401 | ||
3087b905 | 402 | /* SDHI0 */ |
fb66c523 | 403 | static struct sh_mobile_sdhi_info sdhi0_info = { |
6820e69c MD |
404 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
405 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | |
173e2fec | 406 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, |
fb66c523 MD |
407 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
408 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, | |
173e2fec | 409 | .cd_gpio = GPIO_PORT251, |
fb66c523 MD |
410 | }; |
411 | ||
412 | static struct resource sdhi0_resources[] = { | |
413 | [0] = { | |
414 | .name = "SDHI0", | |
415 | .start = 0xee100000, | |
416 | .end = 0xee1000ff, | |
417 | .flags = IORESOURCE_MEM, | |
418 | }, | |
419 | [1] = { | |
cb2ccc32 | 420 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
fb66c523 MD |
421 | .start = gic_spi(83), |
422 | .flags = IORESOURCE_IRQ, | |
423 | }, | |
424 | [2] = { | |
cb2ccc32 | 425 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
fb66c523 MD |
426 | .start = gic_spi(84), |
427 | .flags = IORESOURCE_IRQ, | |
428 | }, | |
429 | [3] = { | |
cb2ccc32 | 430 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
fb66c523 MD |
431 | .start = gic_spi(85), |
432 | .flags = IORESOURCE_IRQ, | |
433 | }, | |
434 | }; | |
435 | ||
436 | static struct platform_device sdhi0_device = { | |
437 | .name = "sh_mobile_sdhi", | |
438 | .id = 0, | |
439 | .num_resources = ARRAY_SIZE(sdhi0_resources), | |
440 | .resource = sdhi0_resources, | |
441 | .dev = { | |
442 | .platform_data = &sdhi0_info, | |
443 | }, | |
444 | }; | |
445 | ||
6add9691 GL |
446 | /* Fixed 3.3V regulator to be used by SDHI1 */ |
447 | static struct regulator_consumer_supply cn4_power_consumers[] = | |
fb66c523 | 448 | { |
6add9691 GL |
449 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), |
450 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), | |
451 | }; | |
452 | ||
453 | static struct regulator_init_data cn4_power_init_data = { | |
454 | .constraints = { | |
455 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
456 | }, | |
457 | .num_consumer_supplies = ARRAY_SIZE(cn4_power_consumers), | |
458 | .consumer_supplies = cn4_power_consumers, | |
459 | }; | |
460 | ||
461 | static struct fixed_voltage_config cn4_power_info = { | |
462 | .supply_name = "CN4 SD/MMC Vdd", | |
463 | .microvolts = 3300000, | |
464 | .gpio = GPIO_PORT114, | |
465 | .enable_high = 1, | |
466 | .init_data = &cn4_power_init_data, | |
467 | }; | |
468 | ||
469 | static struct platform_device cn4_power = { | |
470 | .name = "reg-fixed-voltage", | |
471 | .id = 2, | |
472 | .dev = { | |
473 | .platform_data = &cn4_power_info, | |
474 | }, | |
475 | }; | |
476 | ||
477 | static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) | |
478 | { | |
479 | static int power_gpio = -EINVAL; | |
480 | ||
481 | if (power_gpio < 0) { | |
482 | int ret = gpio_request(GPIO_PORT114, "sdhi1_power"); | |
483 | if (!ret) { | |
484 | power_gpio = GPIO_PORT114; | |
485 | gpio_direction_output(power_gpio, 0); | |
486 | } | |
487 | } | |
488 | ||
489 | /* | |
490 | * If requesting the GPIO above failed, it means, that the regulator got | |
491 | * probed and grabbed the GPIO, but we don't know, whether the sdhi | |
492 | * driver already uses the regulator. If it doesn't, we have to toggle | |
493 | * the GPIO ourselves, even though it is now owned by the fixed | |
494 | * regulator driver. We have to live with the race in case the driver | |
495 | * gets unloaded and the GPIO freed between these two steps. | |
496 | */ | |
fb66c523 MD |
497 | gpio_set_value(GPIO_PORT114, state); |
498 | } | |
499 | ||
9e05cdde | 500 | static struct sh_mobile_sdhi_info sh_sdhi1_info = { |
c5ad48f3 | 501 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, |
52942060 | 502 | .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ, |
fb66c523 MD |
503 | .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
504 | .set_pwr = ag5evm_sdhi1_set_pwr, | |
505 | }; | |
506 | ||
507 | static struct resource sdhi1_resources[] = { | |
508 | [0] = { | |
509 | .name = "SDHI1", | |
510 | .start = 0xee120000, | |
511 | .end = 0xee1200ff, | |
512 | .flags = IORESOURCE_MEM, | |
513 | }, | |
514 | [1] = { | |
cb2ccc32 | 515 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
fb66c523 MD |
516 | .start = gic_spi(87), |
517 | .flags = IORESOURCE_IRQ, | |
518 | }, | |
519 | [2] = { | |
cb2ccc32 | 520 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
fb66c523 MD |
521 | .start = gic_spi(88), |
522 | .flags = IORESOURCE_IRQ, | |
523 | }, | |
524 | [3] = { | |
cb2ccc32 | 525 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
fb66c523 MD |
526 | .start = gic_spi(89), |
527 | .flags = IORESOURCE_IRQ, | |
528 | }, | |
529 | }; | |
530 | ||
531 | static struct platform_device sdhi1_device = { | |
532 | .name = "sh_mobile_sdhi", | |
533 | .id = 1, | |
534 | .dev = { | |
9e05cdde | 535 | .platform_data = &sh_sdhi1_info, |
fb66c523 MD |
536 | }, |
537 | .num_resources = ARRAY_SIZE(sdhi1_resources), | |
538 | .resource = sdhi1_resources, | |
539 | }; | |
540 | ||
6d9598e2 | 541 | static struct platform_device *ag5evm_devices[] __initdata = { |
6add9691 | 542 | &cn4_power, |
6d9598e2 | 543 | ð_device, |
2d22d486 | 544 | &keysc_device, |
208c7dc2 | 545 | &fsi_device, |
6bf45a10 | 546 | &mmc_device, |
a33bb8a2 | 547 | &irda_device, |
170c7ab5 | 548 | &mipidsi0_device, |
7a4fcf91 | 549 | &lcdc0_device, |
fb66c523 MD |
550 | &sdhi0_device, |
551 | &sdhi1_device, | |
6d9598e2 MD |
552 | }; |
553 | ||
6d9598e2 MD |
554 | static void __init ag5evm_init(void) |
555 | { | |
6add9691 GL |
556 | regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, |
557 | ARRAY_SIZE(fixed1v8_power_consumers), 1800000); | |
558 | regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers, | |
559 | ARRAY_SIZE(fixed2v8_power_consumers), 3300000); | |
560 | regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | |
561 | ||
3256c789 TY |
562 | sh73a0_pinmux_init(); |
563 | ||
6d9598e2 | 564 | /* enable SCIFA2 */ |
3256c789 TY |
565 | gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); |
566 | gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); | |
567 | gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL); | |
568 | gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL); | |
6d9598e2 | 569 | |
2d22d486 | 570 | /* enable KEYSC */ |
5d781472 TY |
571 | gpio_request(GPIO_FN_KEYIN0_PU, NULL); |
572 | gpio_request(GPIO_FN_KEYIN1_PU, NULL); | |
573 | gpio_request(GPIO_FN_KEYIN2_PU, NULL); | |
574 | gpio_request(GPIO_FN_KEYIN3_PU, NULL); | |
575 | gpio_request(GPIO_FN_KEYIN4_PU, NULL); | |
576 | gpio_request(GPIO_FN_KEYIN5_PU, NULL); | |
577 | gpio_request(GPIO_FN_KEYIN6_PU, NULL); | |
578 | gpio_request(GPIO_FN_KEYIN7_PU, NULL); | |
2d22d486 TY |
579 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
580 | gpio_request(GPIO_FN_KEYOUT1, NULL); | |
581 | gpio_request(GPIO_FN_KEYOUT2, NULL); | |
582 | gpio_request(GPIO_FN_KEYOUT3, NULL); | |
583 | gpio_request(GPIO_FN_KEYOUT4, NULL); | |
584 | gpio_request(GPIO_FN_KEYOUT5, NULL); | |
585 | gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL); | |
586 | gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL); | |
587 | gpio_request(GPIO_FN_KEYOUT8, NULL); | |
588 | gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL); | |
589 | ||
6bf45a10 | 590 | /* enable I2C channel 2 and 3 */ |
8e67b22a TY |
591 | gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL); |
592 | gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL); | |
593 | gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL); | |
594 | gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL); | |
595 | ||
6bf45a10 TY |
596 | /* enable MMCIF */ |
597 | gpio_request(GPIO_FN_MMCCLK0, NULL); | |
598 | gpio_request(GPIO_FN_MMCCMD0_PU, NULL); | |
052008ed KM |
599 | gpio_request(GPIO_FN_MMCD0_0_PU, NULL); |
600 | gpio_request(GPIO_FN_MMCD0_1_PU, NULL); | |
601 | gpio_request(GPIO_FN_MMCD0_2_PU, NULL); | |
602 | gpio_request(GPIO_FN_MMCD0_3_PU, NULL); | |
603 | gpio_request(GPIO_FN_MMCD0_4_PU, NULL); | |
604 | gpio_request(GPIO_FN_MMCD0_5_PU, NULL); | |
605 | gpio_request(GPIO_FN_MMCD0_6_PU, NULL); | |
606 | gpio_request(GPIO_FN_MMCD0_7_PU, NULL); | |
6bf45a10 TY |
607 | gpio_request(GPIO_PORT208, NULL); /* Reset */ |
608 | gpio_direction_output(GPIO_PORT208, 1); | |
609 | ||
6d9598e2 | 610 | /* enable SMSC911X */ |
3256c789 TY |
611 | gpio_request(GPIO_PORT144, NULL); /* PINTA2 */ |
612 | gpio_direction_input(GPIO_PORT144); | |
613 | gpio_request(GPIO_PORT145, NULL); /* RESET */ | |
614 | gpio_direction_output(GPIO_PORT145, 1); | |
6d9598e2 | 615 | |
208c7dc2 KM |
616 | /* FSI A */ |
617 | gpio_request(GPIO_FN_FSIACK, NULL); | |
618 | gpio_request(GPIO_FN_FSIAILR, NULL); | |
619 | gpio_request(GPIO_FN_FSIAIBT, NULL); | |
620 | gpio_request(GPIO_FN_FSIAISLD, NULL); | |
621 | gpio_request(GPIO_FN_FSIAOSLD, NULL); | |
622 | ||
a33bb8a2 KM |
623 | /* IrDA */ |
624 | gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); | |
625 | gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL); | |
626 | gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); | |
627 | ||
170c7ab5 MD |
628 | /* LCD panel */ |
629 | gpio_request(GPIO_PORT217, NULL); /* RESET */ | |
630 | gpio_direction_output(GPIO_PORT217, 0); | |
631 | mdelay(1); | |
632 | gpio_set_value(GPIO_PORT217, 1); | |
f55398ab | 633 | mdelay(100); |
170c7ab5 MD |
634 | |
635 | /* LCD backlight controller */ | |
636 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | |
637 | gpio_direction_output(GPIO_PORT235, 0); | |
37f4dd13 | 638 | lcd_backlight_set_brightness(0); |
170c7ab5 | 639 | |
fb66c523 | 640 | /* enable SDHI0 on CN15 [SD I/F] */ |
fb66c523 MD |
641 | gpio_request(GPIO_FN_SDHIWP0, NULL); |
642 | gpio_request(GPIO_FN_SDHICMD0, NULL); | |
643 | gpio_request(GPIO_FN_SDHICLK0, NULL); | |
644 | gpio_request(GPIO_FN_SDHID0_3, NULL); | |
645 | gpio_request(GPIO_FN_SDHID0_2, NULL); | |
646 | gpio_request(GPIO_FN_SDHID0_1, NULL); | |
647 | gpio_request(GPIO_FN_SDHID0_0, NULL); | |
648 | ||
649 | /* enable SDHI1 on CN4 [WLAN I/F] */ | |
650 | gpio_request(GPIO_FN_SDHICLK1, NULL); | |
651 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); | |
652 | gpio_request(GPIO_FN_SDHID1_3_PU, NULL); | |
653 | gpio_request(GPIO_FN_SDHID1_2_PU, NULL); | |
654 | gpio_request(GPIO_FN_SDHID1_1_PU, NULL); | |
655 | gpio_request(GPIO_FN_SDHID1_0_PU, NULL); | |
fb66c523 | 656 | |
6d9598e2 MD |
657 | #ifdef CONFIG_CACHE_L2X0 |
658 | /* Shared attribute override enable, 64K*8way */ | |
a2a47ca3 | 659 | l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff); |
6d9598e2 MD |
660 | #endif |
661 | sh73a0_add_standard_devices(); | |
662 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); | |
663 | } | |
664 | ||
6d9598e2 | 665 | MACHINE_START(AG5EVM, "ag5evm") |
a62580e5 | 666 | .smp = smp_ops(sh73a0_smp_ops), |
50e15c34 MD |
667 | .map_io = sh73a0_map_io, |
668 | .init_early = sh73a0_add_early_devices, | |
eded9143 | 669 | .nr_irqs = NR_IRQS_LEGACY, |
566aad39 | 670 | .init_irq = sh73a0_init_irq, |
a83d8e27 | 671 | .handle_irq = gic_handle_irq, |
6d9598e2 | 672 | .init_machine = ag5evm_init, |
21cc1b7e | 673 | .init_late = shmobile_init_late, |
6bb27d73 | 674 | .init_time = sh73a0_earlytimer_init, |
6d9598e2 | 675 | MACHINE_END |