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