blob: 75596948029cffac1e267d9368aca20f30bbadf0 [file] [log] [blame]
Magnus Damm6d9598e2010-11-17 10:59:31 +00001/*
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>
30#include <linux/serial_sci.h>
31#include <linux/smsc911x.h>
32#include <linux/gpio.h>
Paul Gortmaker04f47a02012-01-22 14:57:25 -050033#include <linux/videodev2.h>
Yoshii Takashi2d22d482010-11-19 13:15:46 +000034#include <linux/input.h>
35#include <linux/input/sh_keysc.h>
Takashi YOSHII6bf45a102010-12-22 06:35:30 +000036#include <linux/mmc/host.h>
37#include <linux/mmc/sh_mmcif.h>
Magnus Dammfb66c522011-05-23 05:10:36 +000038#include <linux/mmc/sh_mobile_sdhi.h>
39#include <linux/mfd/tmio.h>
Magnus Damm170c7ab2011-01-20 08:41:03 +000040#include <linux/sh_clk.h>
Jon Medhurst9b742022011-08-04 17:05:21 +010041#include <linux/dma-mapping.h>
Magnus Damm170c7ab2011-01-20 08:41:03 +000042#include <video/sh_mobile_lcdc.h>
43#include <video/sh_mipi_dsi.h>
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +000044#include <sound/sh_fsi.h>
Magnus Damm6d9598e2010-11-17 10:59:31 +000045#include <mach/hardware.h>
46#include <mach/sh73a0.h>
47#include <mach/common.h>
48#include <asm/mach-types.h>
49#include <asm/mach/arch.h>
50#include <asm/mach/map.h>
51#include <asm/mach/time.h>
52#include <asm/hardware/gic.h>
53#include <asm/hardware/cache-l2x0.h>
54#include <asm/traps.h>
55
56static struct resource smsc9220_resources[] = {
57 [0] = {
58 .start = 0x14000000,
59 .end = 0x14000000 + SZ_64K - 1,
60 .flags = IORESOURCE_MEM,
61 },
62 [1] = {
Magnus Damm566aad32011-10-17 18:00:52 +090063 .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */
Magnus Damm6d9598e2010-11-17 10:59:31 +000064 .flags = IORESOURCE_IRQ,
65 },
66};
67
68static struct smsc911x_platform_config smsc9220_platdata = {
69 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
70 .phy_interface = PHY_INTERFACE_MODE_MII,
71 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
72 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
73};
74
75static struct platform_device eth_device = {
76 .name = "smsc911x",
77 .id = 0,
78 .dev = {
79 .platform_data = &smsc9220_platdata,
80 },
81 .resource = smsc9220_resources,
82 .num_resources = ARRAY_SIZE(smsc9220_resources),
83};
84
Yoshii Takashi2d22d482010-11-19 13:15:46 +000085static struct sh_keysc_info keysc_platdata = {
86 .mode = SH_KEYSC_MODE_6,
87 .scan_timing = 3,
88 .delay = 100,
89 .keycodes = {
90 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
91 KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N,
92 KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U,
93 KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP,
94 KEY_SPACE, KEY_9, KEY_6, KEY_3, KEY_WAKEUP, KEY_RIGHT, \
95 KEY_COFFEE,
96 KEY_0, KEY_8, KEY_5, KEY_2, KEY_DOWN, KEY_ENTER, KEY_UP,
97 KEY_KPASTERISK, KEY_7, KEY_4, KEY_1, KEY_STOP, KEY_LEFT, \
98 KEY_COMPUTER,
99 },
100};
101
102static struct resource keysc_resources[] = {
103 [0] = {
104 .name = "KEYSC",
105 .start = 0xe61b0000,
106 .end = 0xe61b0098 - 1,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = gic_spi(71),
111 .flags = IORESOURCE_IRQ,
112 },
113};
114
115static struct platform_device keysc_device = {
116 .name = "sh_keysc",
117 .id = 0,
118 .num_resources = ARRAY_SIZE(keysc_resources),
119 .resource = keysc_resources,
120 .dev = {
121 .platform_data = &keysc_platdata,
122 },
123};
124
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +0000125/* FSI A */
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +0000126static struct resource fsi_resources[] = {
127 [0] = {
128 .name = "FSI",
129 .start = 0xEC230000,
130 .end = 0xEC230400 - 1,
131 .flags = IORESOURCE_MEM,
132 },
133 [1] = {
134 .start = gic_spi(146),
135 .flags = IORESOURCE_IRQ,
136 },
137};
138
139static struct platform_device fsi_device = {
140 .name = "sh_fsi2",
141 .id = -1,
142 .num_resources = ARRAY_SIZE(fsi_resources),
143 .resource = fsi_resources,
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +0000144};
145
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000146static struct resource sh_mmcif_resources[] = {
147 [0] = {
148 .name = "MMCIF",
149 .start = 0xe6bd0000,
150 .end = 0xe6bd00ff,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = gic_spi(141),
155 .flags = IORESOURCE_IRQ,
156 },
157 [2] = {
158 .start = gic_spi(140),
159 .flags = IORESOURCE_IRQ,
160 },
161};
162
Magnus Damm19aec342011-05-24 10:40:33 +0000163static struct sh_mmcif_dma sh_mmcif_dma = {
164 .chan_priv_rx = {
165 .slave_id = SHDMA_SLAVE_MMCIF_RX,
166 },
167 .chan_priv_tx = {
168 .slave_id = SHDMA_SLAVE_MMCIF_TX,
169 },
170};
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000171static struct sh_mmcif_plat_data sh_mmcif_platdata = {
172 .sup_pclk = 0,
173 .ocr = MMC_VDD_165_195,
174 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
Magnus Damm19aec342011-05-24 10:40:33 +0000175 .dma = &sh_mmcif_dma,
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000176};
177
178static struct platform_device mmc_device = {
179 .name = "sh_mmcif",
180 .id = 0,
181 .dev = {
182 .dma_mask = NULL,
183 .coherent_dma_mask = 0xffffffff,
184 .platform_data = &sh_mmcif_platdata,
185 },
186 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
187 .resource = sh_mmcif_resources,
188};
189
Kuninori Morimotoa33bb8a2011-01-14 11:00:41 +0000190/* IrDA */
191static struct resource irda_resources[] = {
192 [0] = {
193 .start = 0xE6D00000,
194 .end = 0xE6D01FD4 - 1,
195 .flags = IORESOURCE_MEM,
196 },
197 [1] = {
198 .start = gic_spi(95),
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203static struct platform_device irda_device = {
204 .name = "sh_irda",
205 .id = 0,
206 .resource = irda_resources,
207 .num_resources = ARRAY_SIZE(irda_resources),
208};
209
Magnus Damm170c7ab2011-01-20 08:41:03 +0000210static unsigned char lcd_backlight_seq[3][2] = {
211 { 0x04, 0x07 },
212 { 0x23, 0x80 },
213 { 0x03, 0x01 },
214};
215
216static void lcd_backlight_on(void)
217{
218 struct i2c_adapter *a;
219 struct i2c_msg msg;
220 int k;
221
222 a = i2c_get_adapter(1);
223 for (k = 0; a && k < 3; k++) {
224 msg.addr = 0x6d;
225 msg.buf = &lcd_backlight_seq[k][0];
226 msg.len = 2;
227 msg.flags = 0;
228 if (i2c_transfer(a, &msg, 1) != 1)
229 break;
230 }
231}
232
233static void lcd_backlight_reset(void)
234{
235 gpio_set_value(GPIO_PORT235, 0);
236 mdelay(24);
237 gpio_set_value(GPIO_PORT235, 1);
238}
239
240static void lcd_on(void *board_data, struct fb_info *info)
241{
242 lcd_backlight_on();
243}
244
245static void lcd_off(void *board_data)
246{
247 lcd_backlight_reset();
248}
249
250/* LCDC0 */
251static const struct fb_videomode lcdc0_modes[] = {
252 {
253 .name = "R63302(QHD)",
254 .xres = 544,
255 .yres = 961,
256 .left_margin = 72,
257 .right_margin = 600,
258 .hsync_len = 16,
259 .upper_margin = 8,
260 .lower_margin = 8,
261 .vsync_len = 2,
262 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
263 },
264};
265
266static struct sh_mobile_lcdc_info lcdc0_info = {
267 .clock_source = LCDC_CLK_PERIPHERAL,
268 .ch[0] = {
269 .chan = LCDC_CHAN_MAINLCD,
270 .interface_type = RGB24,
271 .clock_divider = 1,
272 .flags = LCDC_FLAGS_DWPOL,
273 .lcd_size_cfg.width = 44,
274 .lcd_size_cfg.height = 79,
275 .bpp = 16,
276 .lcd_cfg = lcdc0_modes,
277 .num_cfg = ARRAY_SIZE(lcdc0_modes),
278 .board_cfg = {
279 .display_on = lcd_on,
280 .display_off = lcd_off,
281 },
282 }
283};
284
285static struct resource lcdc0_resources[] = {
286 [0] = {
287 .name = "LCDC0",
288 .start = 0xfe940000, /* P4-only space */
289 .end = 0xfe943fff,
290 .flags = IORESOURCE_MEM,
291 },
292 [1] = {
293 .start = intcs_evt2irq(0x580),
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298static struct platform_device lcdc0_device = {
299 .name = "sh_mobile_lcdc_fb",
300 .num_resources = ARRAY_SIZE(lcdc0_resources),
301 .resource = lcdc0_resources,
302 .id = 0,
303 .dev = {
304 .platform_data = &lcdc0_info,
305 .coherent_dma_mask = ~0,
306 },
307};
308
309/* MIPI-DSI */
310static struct resource mipidsi0_resources[] = {
311 [0] = {
Magnus Damm6b36fdd2011-05-19 06:30:59 +0000312 .name = "DSI0",
Magnus Damm170c7ab2011-01-20 08:41:03 +0000313 .start = 0xfeab0000,
314 .end = 0xfeab3fff,
315 .flags = IORESOURCE_MEM,
316 },
317 [1] = {
Magnus Damm6b36fdd2011-05-19 06:30:59 +0000318 .name = "DSI0",
Magnus Damm170c7ab2011-01-20 08:41:03 +0000319 .start = 0xfeab4000,
320 .end = 0xfeab7fff,
321 .flags = IORESOURCE_MEM,
322 },
323};
324
325static struct sh_mipi_dsi_info mipidsi0_info = {
326 .data_format = MIPI_RGB888,
327 .lcd_chan = &lcdc0_info.ch[0],
328 .vsynw_offset = 20,
329 .clksrc = 1,
330 .flags = SH_MIPI_DSI_HSABM,
331};
332
333static struct platform_device mipidsi0_device = {
334 .name = "sh-mipi-dsi",
335 .num_resources = ARRAY_SIZE(mipidsi0_resources),
336 .resource = mipidsi0_resources,
337 .id = 0,
338 .dev = {
339 .platform_data = &mipidsi0_info,
340 },
341};
342
Magnus Damm3087b902011-10-12 16:21:50 +0900343/* SDHI0 */
344static irqreturn_t ag5evm_sdhi0_gpio_cd(int irq, void *arg)
345{
346 struct device *dev = arg;
347 struct sh_mobile_sdhi_info *info = dev->platform_data;
348 struct tmio_mmc_data *pdata = info->pdata;
349
350 tmio_mmc_cd_wakeup(pdata);
351
352 return IRQ_HANDLED;
353}
354
Magnus Dammfb66c522011-05-23 05:10:36 +0000355static struct sh_mobile_sdhi_info sdhi0_info = {
Magnus Damm6820e692011-05-24 10:42:15 +0000356 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
357 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
Simon Hormanc5ad48f2011-06-20 23:00:12 +0000358 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
Magnus Dammfb66c522011-05-23 05:10:36 +0000359 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
360 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
361};
362
363static struct resource sdhi0_resources[] = {
364 [0] = {
365 .name = "SDHI0",
366 .start = 0xee100000,
367 .end = 0xee1000ff,
368 .flags = IORESOURCE_MEM,
369 },
370 [1] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900371 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
Magnus Dammfb66c522011-05-23 05:10:36 +0000372 .start = gic_spi(83),
373 .flags = IORESOURCE_IRQ,
374 },
375 [2] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900376 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
Magnus Dammfb66c522011-05-23 05:10:36 +0000377 .start = gic_spi(84),
378 .flags = IORESOURCE_IRQ,
379 },
380 [3] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900381 .name = SH_MOBILE_SDHI_IRQ_SDIO,
Magnus Dammfb66c522011-05-23 05:10:36 +0000382 .start = gic_spi(85),
383 .flags = IORESOURCE_IRQ,
384 },
385};
386
387static struct platform_device sdhi0_device = {
388 .name = "sh_mobile_sdhi",
389 .id = 0,
390 .num_resources = ARRAY_SIZE(sdhi0_resources),
391 .resource = sdhi0_resources,
392 .dev = {
393 .platform_data = &sdhi0_info,
394 },
395};
396
397void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
398{
399 gpio_set_value(GPIO_PORT114, state);
400}
401
Simon Horman9e05cdd2011-06-20 23:00:11 +0000402static struct sh_mobile_sdhi_info sh_sdhi1_info = {
Simon Hormanc5ad48f2011-06-20 23:00:12 +0000403 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
Magnus Damm52942062011-06-09 09:02:25 +0000404 .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
Magnus Dammfb66c522011-05-23 05:10:36 +0000405 .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
406 .set_pwr = ag5evm_sdhi1_set_pwr,
407};
408
409static struct resource sdhi1_resources[] = {
410 [0] = {
411 .name = "SDHI1",
412 .start = 0xee120000,
413 .end = 0xee1200ff,
414 .flags = IORESOURCE_MEM,
415 },
416 [1] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900417 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
Magnus Dammfb66c522011-05-23 05:10:36 +0000418 .start = gic_spi(87),
419 .flags = IORESOURCE_IRQ,
420 },
421 [2] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900422 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
Magnus Dammfb66c522011-05-23 05:10:36 +0000423 .start = gic_spi(88),
424 .flags = IORESOURCE_IRQ,
425 },
426 [3] = {
Simon Hormancb2ccc32011-08-25 10:27:28 +0900427 .name = SH_MOBILE_SDHI_IRQ_SDIO,
Magnus Dammfb66c522011-05-23 05:10:36 +0000428 .start = gic_spi(89),
429 .flags = IORESOURCE_IRQ,
430 },
431};
432
433static struct platform_device sdhi1_device = {
434 .name = "sh_mobile_sdhi",
435 .id = 1,
436 .dev = {
Simon Horman9e05cdd2011-06-20 23:00:11 +0000437 .platform_data = &sh_sdhi1_info,
Magnus Dammfb66c522011-05-23 05:10:36 +0000438 },
439 .num_resources = ARRAY_SIZE(sdhi1_resources),
440 .resource = sdhi1_resources,
441};
442
Magnus Damm6d9598e2010-11-17 10:59:31 +0000443static struct platform_device *ag5evm_devices[] __initdata = {
444 &eth_device,
Yoshii Takashi2d22d482010-11-19 13:15:46 +0000445 &keysc_device,
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +0000446 &fsi_device,
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000447 &mmc_device,
Kuninori Morimotoa33bb8a2011-01-14 11:00:41 +0000448 &irda_device,
Magnus Damm170c7ab2011-01-20 08:41:03 +0000449 &lcdc0_device,
450 &mipidsi0_device,
Magnus Dammfb66c522011-05-23 05:10:36 +0000451 &sdhi0_device,
452 &sdhi1_device,
Magnus Damm6d9598e2010-11-17 10:59:31 +0000453};
454
455static struct map_desc ag5evm_io_desc[] __initdata = {
456 /* create a 1:1 entity map for 0xe6xxxxxx
457 * used by CPGA, INTC and PFC.
458 */
459 {
460 .virtual = 0xe6000000,
461 .pfn = __phys_to_pfn(0xe6000000),
462 .length = 256 << 20,
463 .type = MT_DEVICE_NONSHARED
464 },
465};
466
467static void __init ag5evm_map_io(void)
468{
469 iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc));
470
471 /* setup early devices and console here as well */
472 sh73a0_add_early_devices();
473 shmobile_setup_console();
474}
475
Magnus Damm170c7ab2011-01-20 08:41:03 +0000476#define DSI0PHYCR 0xe615006c
477
Magnus Damm6d9598e2010-11-17 10:59:31 +0000478static void __init ag5evm_init(void)
479{
Takashi YOSHII3256c782010-11-19 16:49:38 +0900480 sh73a0_pinmux_init();
481
Magnus Damm6d9598e2010-11-17 10:59:31 +0000482 /* enable SCIFA2 */
Takashi YOSHII3256c782010-11-19 16:49:38 +0900483 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
484 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
485 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
486 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
Magnus Damm6d9598e2010-11-17 10:59:31 +0000487
Yoshii Takashi2d22d482010-11-19 13:15:46 +0000488 /* enable KEYSC */
Takashi YOSHII5d781472010-12-22 06:30:19 +0000489 gpio_request(GPIO_FN_KEYIN0_PU, NULL);
490 gpio_request(GPIO_FN_KEYIN1_PU, NULL);
491 gpio_request(GPIO_FN_KEYIN2_PU, NULL);
492 gpio_request(GPIO_FN_KEYIN3_PU, NULL);
493 gpio_request(GPIO_FN_KEYIN4_PU, NULL);
494 gpio_request(GPIO_FN_KEYIN5_PU, NULL);
495 gpio_request(GPIO_FN_KEYIN6_PU, NULL);
496 gpio_request(GPIO_FN_KEYIN7_PU, NULL);
Yoshii Takashi2d22d482010-11-19 13:15:46 +0000497 gpio_request(GPIO_FN_KEYOUT0, NULL);
498 gpio_request(GPIO_FN_KEYOUT1, NULL);
499 gpio_request(GPIO_FN_KEYOUT2, NULL);
500 gpio_request(GPIO_FN_KEYOUT3, NULL);
501 gpio_request(GPIO_FN_KEYOUT4, NULL);
502 gpio_request(GPIO_FN_KEYOUT5, NULL);
503 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
504 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
505 gpio_request(GPIO_FN_KEYOUT8, NULL);
506 gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
507
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000508 /* enable I2C channel 2 and 3 */
Yoshii Takashi8e67b222010-11-19 13:21:32 +0000509 gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL);
510 gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL);
511 gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL);
512 gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL);
513
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000514 /* enable MMCIF */
515 gpio_request(GPIO_FN_MMCCLK0, NULL);
516 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
Kuninori Morimoto052008e2011-11-10 18:44:24 -0800517 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
518 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
519 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
520 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
521 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
522 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
523 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
524 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
Takashi YOSHII6bf45a102010-12-22 06:35:30 +0000525 gpio_request(GPIO_PORT208, NULL); /* Reset */
526 gpio_direction_output(GPIO_PORT208, 1);
527
Magnus Damm6d9598e2010-11-17 10:59:31 +0000528 /* enable SMSC911X */
Takashi YOSHII3256c782010-11-19 16:49:38 +0900529 gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
530 gpio_direction_input(GPIO_PORT144);
531 gpio_request(GPIO_PORT145, NULL); /* RESET */
532 gpio_direction_output(GPIO_PORT145, 1);
Magnus Damm6d9598e2010-11-17 10:59:31 +0000533
Kuninori Morimoto208c7dc2010-11-29 02:10:08 +0000534 /* FSI A */
535 gpio_request(GPIO_FN_FSIACK, NULL);
536 gpio_request(GPIO_FN_FSIAILR, NULL);
537 gpio_request(GPIO_FN_FSIAIBT, NULL);
538 gpio_request(GPIO_FN_FSIAISLD, NULL);
539 gpio_request(GPIO_FN_FSIAOSLD, NULL);
540
Kuninori Morimotoa33bb8a2011-01-14 11:00:41 +0000541 /* IrDA */
542 gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
543 gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
544 gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
545
Magnus Damm170c7ab2011-01-20 08:41:03 +0000546 /* LCD panel */
547 gpio_request(GPIO_PORT217, NULL); /* RESET */
548 gpio_direction_output(GPIO_PORT217, 0);
549 mdelay(1);
550 gpio_set_value(GPIO_PORT217, 1);
Magnus Dammf55398a2011-01-28 09:59:17 +0000551 mdelay(100);
Magnus Damm170c7ab2011-01-20 08:41:03 +0000552
553 /* LCD backlight controller */
554 gpio_request(GPIO_PORT235, NULL); /* RESET */
555 gpio_direction_output(GPIO_PORT235, 0);
556 lcd_backlight_reset();
557
558 /* MIPI-DSI clock setup */
559 __raw_writel(0x2a809010, DSI0PHYCR);
560
Magnus Dammfb66c522011-05-23 05:10:36 +0000561 /* enable SDHI0 on CN15 [SD I/F] */
562 gpio_request(GPIO_FN_SDHICD0, NULL);
563 gpio_request(GPIO_FN_SDHIWP0, NULL);
564 gpio_request(GPIO_FN_SDHICMD0, NULL);
565 gpio_request(GPIO_FN_SDHICLK0, NULL);
566 gpio_request(GPIO_FN_SDHID0_3, NULL);
567 gpio_request(GPIO_FN_SDHID0_2, NULL);
568 gpio_request(GPIO_FN_SDHID0_1, NULL);
569 gpio_request(GPIO_FN_SDHID0_0, NULL);
570
Magnus Damm3087b902011-10-12 16:21:50 +0900571 if (!request_irq(intcs_evt2irq(0x3c0), ag5evm_sdhi0_gpio_cd,
572 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
573 "sdhi0 cd", &sdhi0_device.dev))
574 sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
575 else
576 pr_warn("Unable to setup SDHI0 GPIO IRQ\n");
577
Magnus Dammfb66c522011-05-23 05:10:36 +0000578 /* enable SDHI1 on CN4 [WLAN I/F] */
579 gpio_request(GPIO_FN_SDHICLK1, NULL);
580 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
581 gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
582 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
583 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
584 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
585 gpio_request(GPIO_PORT114, "sdhi1_power");
586 gpio_direction_output(GPIO_PORT114, 0);
587
Magnus Damm6d9598e2010-11-17 10:59:31 +0000588#ifdef CONFIG_CACHE_L2X0
589 /* Shared attribute override enable, 64K*8way */
590 l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff);
591#endif
592 sh73a0_add_standard_devices();
593 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
594}
595
596static void __init ag5evm_timer_init(void)
597{
598 sh73a0_clock_init();
599 shmobile_timer.init();
600 return;
601}
602
603struct sys_timer ag5evm_timer = {
604 .init = ag5evm_timer_init,
605};
606
607MACHINE_START(AG5EVM, "ag5evm")
608 .map_io = ag5evm_map_io,
Magnus Dammeded9142011-11-22 15:31:40 +0900609 .nr_irqs = NR_IRQS_LEGACY,
Magnus Damm566aad32011-10-17 18:00:52 +0900610 .init_irq = sh73a0_init_irq,
Marc Zyngiera83d8e22011-09-06 10:23:45 +0100611 .handle_irq = gic_handle_irq,
Magnus Damm6d9598e2010-11-17 10:59:31 +0000612 .init_machine = ag5evm_init,
613 .timer = &ag5evm_timer,
614MACHINE_END