Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 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> |
| 30 | #include <linux/serial_sci.h> |
| 31 | #include <linux/smsc911x.h> |
| 32 | #include <linux/gpio.h> |
Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 33 | #include <linux/input.h> |
| 34 | #include <linux/input/sh_keysc.h> |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 35 | #include <linux/mmc/host.h> |
| 36 | #include <linux/mmc/sh_mmcif.h> |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 37 | #include <linux/mmc/sh_mobile_sdhi.h> |
| 38 | #include <linux/mfd/tmio.h> |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 39 | #include <linux/sh_clk.h> |
| 40 | #include <video/sh_mobile_lcdc.h> |
| 41 | #include <video/sh_mipi_dsi.h> |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 42 | #include <sound/sh_fsi.h> |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 43 | #include <mach/hardware.h> |
| 44 | #include <mach/sh73a0.h> |
| 45 | #include <mach/common.h> |
| 46 | #include <asm/mach-types.h> |
| 47 | #include <asm/mach/arch.h> |
| 48 | #include <asm/mach/map.h> |
| 49 | #include <asm/mach/time.h> |
| 50 | #include <asm/hardware/gic.h> |
| 51 | #include <asm/hardware/cache-l2x0.h> |
| 52 | #include <asm/traps.h> |
| 53 | |
| 54 | static struct resource smsc9220_resources[] = { |
| 55 | [0] = { |
| 56 | .start = 0x14000000, |
| 57 | .end = 0x14000000 + SZ_64K - 1, |
| 58 | .flags = IORESOURCE_MEM, |
| 59 | }, |
| 60 | [1] = { |
| 61 | .start = gic_spi(33), /* PINT1 */ |
| 62 | .flags = IORESOURCE_IRQ, |
| 63 | }, |
| 64 | }; |
| 65 | |
| 66 | static struct smsc911x_platform_config smsc9220_platdata = { |
| 67 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 68 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 69 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 70 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 71 | }; |
| 72 | |
| 73 | static struct platform_device eth_device = { |
| 74 | .name = "smsc911x", |
| 75 | .id = 0, |
| 76 | .dev = { |
| 77 | .platform_data = &smsc9220_platdata, |
| 78 | }, |
| 79 | .resource = smsc9220_resources, |
| 80 | .num_resources = ARRAY_SIZE(smsc9220_resources), |
| 81 | }; |
| 82 | |
Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 83 | static struct sh_keysc_info keysc_platdata = { |
| 84 | .mode = SH_KEYSC_MODE_6, |
| 85 | .scan_timing = 3, |
| 86 | .delay = 100, |
| 87 | .keycodes = { |
| 88 | KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, |
| 89 | KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, |
| 90 | KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, |
| 91 | KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP, |
| 92 | KEY_SPACE, KEY_9, KEY_6, KEY_3, KEY_WAKEUP, KEY_RIGHT, \ |
| 93 | KEY_COFFEE, |
| 94 | KEY_0, KEY_8, KEY_5, KEY_2, KEY_DOWN, KEY_ENTER, KEY_UP, |
| 95 | KEY_KPASTERISK, KEY_7, KEY_4, KEY_1, KEY_STOP, KEY_LEFT, \ |
| 96 | KEY_COMPUTER, |
| 97 | }, |
| 98 | }; |
| 99 | |
| 100 | static struct resource keysc_resources[] = { |
| 101 | [0] = { |
| 102 | .name = "KEYSC", |
| 103 | .start = 0xe61b0000, |
| 104 | .end = 0xe61b0098 - 1, |
| 105 | .flags = IORESOURCE_MEM, |
| 106 | }, |
| 107 | [1] = { |
| 108 | .start = gic_spi(71), |
| 109 | .flags = IORESOURCE_IRQ, |
| 110 | }, |
| 111 | }; |
| 112 | |
| 113 | static struct platform_device keysc_device = { |
| 114 | .name = "sh_keysc", |
| 115 | .id = 0, |
| 116 | .num_resources = ARRAY_SIZE(keysc_resources), |
| 117 | .resource = keysc_resources, |
| 118 | .dev = { |
| 119 | .platform_data = &keysc_platdata, |
| 120 | }, |
| 121 | }; |
| 122 | |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 123 | /* FSI A */ |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 124 | static struct resource fsi_resources[] = { |
| 125 | [0] = { |
| 126 | .name = "FSI", |
| 127 | .start = 0xEC230000, |
| 128 | .end = 0xEC230400 - 1, |
| 129 | .flags = IORESOURCE_MEM, |
| 130 | }, |
| 131 | [1] = { |
| 132 | .start = gic_spi(146), |
| 133 | .flags = IORESOURCE_IRQ, |
| 134 | }, |
| 135 | }; |
| 136 | |
| 137 | static struct platform_device fsi_device = { |
| 138 | .name = "sh_fsi2", |
| 139 | .id = -1, |
| 140 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 141 | .resource = fsi_resources, |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 142 | }; |
| 143 | |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 144 | static struct resource sh_mmcif_resources[] = { |
| 145 | [0] = { |
| 146 | .name = "MMCIF", |
| 147 | .start = 0xe6bd0000, |
| 148 | .end = 0xe6bd00ff, |
| 149 | .flags = IORESOURCE_MEM, |
| 150 | }, |
| 151 | [1] = { |
| 152 | .start = gic_spi(141), |
| 153 | .flags = IORESOURCE_IRQ, |
| 154 | }, |
| 155 | [2] = { |
| 156 | .start = gic_spi(140), |
| 157 | .flags = IORESOURCE_IRQ, |
| 158 | }, |
| 159 | }; |
| 160 | |
Magnus Damm | 19aec34 | 2011-05-24 10:40:33 +0000 | [diff] [blame] | 161 | static struct sh_mmcif_dma sh_mmcif_dma = { |
| 162 | .chan_priv_rx = { |
| 163 | .slave_id = SHDMA_SLAVE_MMCIF_RX, |
| 164 | }, |
| 165 | .chan_priv_tx = { |
| 166 | .slave_id = SHDMA_SLAVE_MMCIF_TX, |
| 167 | }, |
| 168 | }; |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 169 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
| 170 | .sup_pclk = 0, |
| 171 | .ocr = MMC_VDD_165_195, |
| 172 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
Magnus Damm | 19aec34 | 2011-05-24 10:40:33 +0000 | [diff] [blame] | 173 | .dma = &sh_mmcif_dma, |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | static struct platform_device mmc_device = { |
| 177 | .name = "sh_mmcif", |
| 178 | .id = 0, |
| 179 | .dev = { |
| 180 | .dma_mask = NULL, |
| 181 | .coherent_dma_mask = 0xffffffff, |
| 182 | .platform_data = &sh_mmcif_platdata, |
| 183 | }, |
| 184 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), |
| 185 | .resource = sh_mmcif_resources, |
| 186 | }; |
| 187 | |
Kuninori Morimoto | a33bb8a | 2011-01-14 11:00:41 +0000 | [diff] [blame] | 188 | /* IrDA */ |
| 189 | static struct resource irda_resources[] = { |
| 190 | [0] = { |
| 191 | .start = 0xE6D00000, |
| 192 | .end = 0xE6D01FD4 - 1, |
| 193 | .flags = IORESOURCE_MEM, |
| 194 | }, |
| 195 | [1] = { |
| 196 | .start = gic_spi(95), |
| 197 | .flags = IORESOURCE_IRQ, |
| 198 | }, |
| 199 | }; |
| 200 | |
| 201 | static struct platform_device irda_device = { |
| 202 | .name = "sh_irda", |
| 203 | .id = 0, |
| 204 | .resource = irda_resources, |
| 205 | .num_resources = ARRAY_SIZE(irda_resources), |
| 206 | }; |
| 207 | |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 208 | static unsigned char lcd_backlight_seq[3][2] = { |
| 209 | { 0x04, 0x07 }, |
| 210 | { 0x23, 0x80 }, |
| 211 | { 0x03, 0x01 }, |
| 212 | }; |
| 213 | |
| 214 | static void lcd_backlight_on(void) |
| 215 | { |
| 216 | struct i2c_adapter *a; |
| 217 | struct i2c_msg msg; |
| 218 | int k; |
| 219 | |
| 220 | a = i2c_get_adapter(1); |
| 221 | for (k = 0; a && k < 3; k++) { |
| 222 | msg.addr = 0x6d; |
| 223 | msg.buf = &lcd_backlight_seq[k][0]; |
| 224 | msg.len = 2; |
| 225 | msg.flags = 0; |
| 226 | if (i2c_transfer(a, &msg, 1) != 1) |
| 227 | break; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | static void lcd_backlight_reset(void) |
| 232 | { |
| 233 | gpio_set_value(GPIO_PORT235, 0); |
| 234 | mdelay(24); |
| 235 | gpio_set_value(GPIO_PORT235, 1); |
| 236 | } |
| 237 | |
| 238 | static void lcd_on(void *board_data, struct fb_info *info) |
| 239 | { |
| 240 | lcd_backlight_on(); |
| 241 | } |
| 242 | |
| 243 | static void lcd_off(void *board_data) |
| 244 | { |
| 245 | lcd_backlight_reset(); |
| 246 | } |
| 247 | |
| 248 | /* LCDC0 */ |
| 249 | static const struct fb_videomode lcdc0_modes[] = { |
| 250 | { |
| 251 | .name = "R63302(QHD)", |
| 252 | .xres = 544, |
| 253 | .yres = 961, |
| 254 | .left_margin = 72, |
| 255 | .right_margin = 600, |
| 256 | .hsync_len = 16, |
| 257 | .upper_margin = 8, |
| 258 | .lower_margin = 8, |
| 259 | .vsync_len = 2, |
| 260 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, |
| 261 | }, |
| 262 | }; |
| 263 | |
| 264 | static struct sh_mobile_lcdc_info lcdc0_info = { |
| 265 | .clock_source = LCDC_CLK_PERIPHERAL, |
| 266 | .ch[0] = { |
| 267 | .chan = LCDC_CHAN_MAINLCD, |
| 268 | .interface_type = RGB24, |
| 269 | .clock_divider = 1, |
| 270 | .flags = LCDC_FLAGS_DWPOL, |
| 271 | .lcd_size_cfg.width = 44, |
| 272 | .lcd_size_cfg.height = 79, |
| 273 | .bpp = 16, |
| 274 | .lcd_cfg = lcdc0_modes, |
| 275 | .num_cfg = ARRAY_SIZE(lcdc0_modes), |
| 276 | .board_cfg = { |
| 277 | .display_on = lcd_on, |
| 278 | .display_off = lcd_off, |
| 279 | }, |
| 280 | } |
| 281 | }; |
| 282 | |
| 283 | static struct resource lcdc0_resources[] = { |
| 284 | [0] = { |
| 285 | .name = "LCDC0", |
| 286 | .start = 0xfe940000, /* P4-only space */ |
| 287 | .end = 0xfe943fff, |
| 288 | .flags = IORESOURCE_MEM, |
| 289 | }, |
| 290 | [1] = { |
| 291 | .start = intcs_evt2irq(0x580), |
| 292 | .flags = IORESOURCE_IRQ, |
| 293 | }, |
| 294 | }; |
| 295 | |
| 296 | static struct platform_device lcdc0_device = { |
| 297 | .name = "sh_mobile_lcdc_fb", |
| 298 | .num_resources = ARRAY_SIZE(lcdc0_resources), |
| 299 | .resource = lcdc0_resources, |
| 300 | .id = 0, |
| 301 | .dev = { |
| 302 | .platform_data = &lcdc0_info, |
| 303 | .coherent_dma_mask = ~0, |
| 304 | }, |
| 305 | }; |
| 306 | |
| 307 | /* MIPI-DSI */ |
| 308 | static struct resource mipidsi0_resources[] = { |
| 309 | [0] = { |
Magnus Damm | 6b36fdd | 2011-05-19 06:30:59 +0000 | [diff] [blame] | 310 | .name = "DSI0", |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 311 | .start = 0xfeab0000, |
| 312 | .end = 0xfeab3fff, |
| 313 | .flags = IORESOURCE_MEM, |
| 314 | }, |
| 315 | [1] = { |
Magnus Damm | 6b36fdd | 2011-05-19 06:30:59 +0000 | [diff] [blame] | 316 | .name = "DSI0", |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 317 | .start = 0xfeab4000, |
| 318 | .end = 0xfeab7fff, |
| 319 | .flags = IORESOURCE_MEM, |
| 320 | }, |
| 321 | }; |
| 322 | |
| 323 | static struct sh_mipi_dsi_info mipidsi0_info = { |
| 324 | .data_format = MIPI_RGB888, |
| 325 | .lcd_chan = &lcdc0_info.ch[0], |
| 326 | .vsynw_offset = 20, |
| 327 | .clksrc = 1, |
| 328 | .flags = SH_MIPI_DSI_HSABM, |
| 329 | }; |
| 330 | |
| 331 | static struct platform_device mipidsi0_device = { |
| 332 | .name = "sh-mipi-dsi", |
| 333 | .num_resources = ARRAY_SIZE(mipidsi0_resources), |
| 334 | .resource = mipidsi0_resources, |
| 335 | .id = 0, |
| 336 | .dev = { |
| 337 | .platform_data = &mipidsi0_info, |
| 338 | }, |
| 339 | }; |
| 340 | |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 341 | static struct sh_mobile_sdhi_info sdhi0_info = { |
Magnus Damm | 6820e69 | 2011-05-24 10:42:15 +0000 | [diff] [blame] | 342 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
| 343 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
Simon Horman | c5ad48f | 2011-06-20 23:00:12 +0000 | [diff] [blame^] | 344 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 345 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
| 346 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 347 | }; |
| 348 | |
| 349 | static struct resource sdhi0_resources[] = { |
| 350 | [0] = { |
| 351 | .name = "SDHI0", |
| 352 | .start = 0xee100000, |
| 353 | .end = 0xee1000ff, |
| 354 | .flags = IORESOURCE_MEM, |
| 355 | }, |
| 356 | [1] = { |
| 357 | .start = gic_spi(83), |
| 358 | .flags = IORESOURCE_IRQ, |
| 359 | }, |
| 360 | [2] = { |
| 361 | .start = gic_spi(84), |
| 362 | .flags = IORESOURCE_IRQ, |
| 363 | }, |
| 364 | [3] = { |
| 365 | .start = gic_spi(85), |
| 366 | .flags = IORESOURCE_IRQ, |
| 367 | }, |
| 368 | }; |
| 369 | |
| 370 | static struct platform_device sdhi0_device = { |
| 371 | .name = "sh_mobile_sdhi", |
| 372 | .id = 0, |
| 373 | .num_resources = ARRAY_SIZE(sdhi0_resources), |
| 374 | .resource = sdhi0_resources, |
| 375 | .dev = { |
| 376 | .platform_data = &sdhi0_info, |
| 377 | }, |
| 378 | }; |
| 379 | |
| 380 | void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) |
| 381 | { |
| 382 | gpio_set_value(GPIO_PORT114, state); |
| 383 | } |
| 384 | |
Simon Horman | 9e05cdd | 2011-06-20 23:00:11 +0000 | [diff] [blame] | 385 | static struct sh_mobile_sdhi_info sh_sdhi1_info = { |
Simon Horman | c5ad48f | 2011-06-20 23:00:12 +0000 | [diff] [blame^] | 386 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, |
Magnus Damm | 5294206 | 2011-06-09 09:02:25 +0000 | [diff] [blame] | 387 | .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ, |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 388 | .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 389 | .set_pwr = ag5evm_sdhi1_set_pwr, |
| 390 | }; |
| 391 | |
| 392 | static struct resource sdhi1_resources[] = { |
| 393 | [0] = { |
| 394 | .name = "SDHI1", |
| 395 | .start = 0xee120000, |
| 396 | .end = 0xee1200ff, |
| 397 | .flags = IORESOURCE_MEM, |
| 398 | }, |
| 399 | [1] = { |
| 400 | .start = gic_spi(87), |
| 401 | .flags = IORESOURCE_IRQ, |
| 402 | }, |
| 403 | [2] = { |
| 404 | .start = gic_spi(88), |
| 405 | .flags = IORESOURCE_IRQ, |
| 406 | }, |
| 407 | [3] = { |
| 408 | .start = gic_spi(89), |
| 409 | .flags = IORESOURCE_IRQ, |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | static struct platform_device sdhi1_device = { |
| 414 | .name = "sh_mobile_sdhi", |
| 415 | .id = 1, |
| 416 | .dev = { |
Simon Horman | 9e05cdd | 2011-06-20 23:00:11 +0000 | [diff] [blame] | 417 | .platform_data = &sh_sdhi1_info, |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 418 | }, |
| 419 | .num_resources = ARRAY_SIZE(sdhi1_resources), |
| 420 | .resource = sdhi1_resources, |
| 421 | }; |
| 422 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 423 | static struct platform_device *ag5evm_devices[] __initdata = { |
| 424 | ð_device, |
Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 425 | &keysc_device, |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 426 | &fsi_device, |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 427 | &mmc_device, |
Kuninori Morimoto | a33bb8a | 2011-01-14 11:00:41 +0000 | [diff] [blame] | 428 | &irda_device, |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 429 | &lcdc0_device, |
| 430 | &mipidsi0_device, |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 431 | &sdhi0_device, |
| 432 | &sdhi1_device, |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | static struct map_desc ag5evm_io_desc[] __initdata = { |
| 436 | /* create a 1:1 entity map for 0xe6xxxxxx |
| 437 | * used by CPGA, INTC and PFC. |
| 438 | */ |
| 439 | { |
| 440 | .virtual = 0xe6000000, |
| 441 | .pfn = __phys_to_pfn(0xe6000000), |
| 442 | .length = 256 << 20, |
| 443 | .type = MT_DEVICE_NONSHARED |
| 444 | }, |
| 445 | }; |
| 446 | |
| 447 | static void __init ag5evm_map_io(void) |
| 448 | { |
| 449 | iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); |
| 450 | |
| 451 | /* setup early devices and console here as well */ |
| 452 | sh73a0_add_early_devices(); |
| 453 | shmobile_setup_console(); |
| 454 | } |
| 455 | |
| 456 | #define PINTC_ADDR 0xe6900000 |
| 457 | #define PINTER0A (PINTC_ADDR + 0xa0) |
| 458 | #define PINTCR0A (PINTC_ADDR + 0xb0) |
| 459 | |
| 460 | void __init ag5evm_init_irq(void) |
| 461 | { |
Magnus Damm | 5f53a56 | 2010-12-21 08:37:32 +0000 | [diff] [blame] | 462 | sh73a0_init_irq(); |
| 463 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 464 | /* setup PINT: enable PINTA2 as active low */ |
| 465 | __raw_writel(__raw_readl(PINTER0A) | (1<<29), PINTER0A); |
| 466 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 467 | } |
| 468 | |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 469 | #define DSI0PHYCR 0xe615006c |
| 470 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 471 | static void __init ag5evm_init(void) |
| 472 | { |
Takashi YOSHII | 3256c789 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 473 | sh73a0_pinmux_init(); |
| 474 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 475 | /* enable SCIFA2 */ |
Takashi YOSHII | 3256c789 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 476 | gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); |
| 477 | gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); |
| 478 | gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL); |
| 479 | gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL); |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 480 | |
Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 481 | /* enable KEYSC */ |
Takashi YOSHII | 5d78147 | 2010-12-22 06:30:19 +0000 | [diff] [blame] | 482 | gpio_request(GPIO_FN_KEYIN0_PU, NULL); |
| 483 | gpio_request(GPIO_FN_KEYIN1_PU, NULL); |
| 484 | gpio_request(GPIO_FN_KEYIN2_PU, NULL); |
| 485 | gpio_request(GPIO_FN_KEYIN3_PU, NULL); |
| 486 | gpio_request(GPIO_FN_KEYIN4_PU, NULL); |
| 487 | gpio_request(GPIO_FN_KEYIN5_PU, NULL); |
| 488 | gpio_request(GPIO_FN_KEYIN6_PU, NULL); |
| 489 | gpio_request(GPIO_FN_KEYIN7_PU, NULL); |
Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 490 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
| 491 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
| 492 | gpio_request(GPIO_FN_KEYOUT2, NULL); |
| 493 | gpio_request(GPIO_FN_KEYOUT3, NULL); |
| 494 | gpio_request(GPIO_FN_KEYOUT4, NULL); |
| 495 | gpio_request(GPIO_FN_KEYOUT5, NULL); |
| 496 | gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL); |
| 497 | gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL); |
| 498 | gpio_request(GPIO_FN_KEYOUT8, NULL); |
| 499 | gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL); |
| 500 | |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 501 | /* enable I2C channel 2 and 3 */ |
Yoshii Takashi | 8e67b22 | 2010-11-19 13:21:32 +0000 | [diff] [blame] | 502 | gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL); |
| 503 | gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL); |
| 504 | gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL); |
| 505 | gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL); |
| 506 | |
Takashi YOSHII | 6bf45a10 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 507 | /* enable MMCIF */ |
| 508 | gpio_request(GPIO_FN_MMCCLK0, NULL); |
| 509 | gpio_request(GPIO_FN_MMCCMD0_PU, NULL); |
| 510 | gpio_request(GPIO_FN_MMCD0_0, NULL); |
| 511 | gpio_request(GPIO_FN_MMCD0_1, NULL); |
| 512 | gpio_request(GPIO_FN_MMCD0_2, NULL); |
| 513 | gpio_request(GPIO_FN_MMCD0_3, NULL); |
| 514 | gpio_request(GPIO_FN_MMCD0_4, NULL); |
| 515 | gpio_request(GPIO_FN_MMCD0_5, NULL); |
| 516 | gpio_request(GPIO_FN_MMCD0_6, NULL); |
| 517 | gpio_request(GPIO_FN_MMCD0_7, NULL); |
| 518 | gpio_request(GPIO_PORT208, NULL); /* Reset */ |
| 519 | gpio_direction_output(GPIO_PORT208, 1); |
| 520 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 521 | /* enable SMSC911X */ |
Takashi YOSHII | 3256c789 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 522 | gpio_request(GPIO_PORT144, NULL); /* PINTA2 */ |
| 523 | gpio_direction_input(GPIO_PORT144); |
| 524 | gpio_request(GPIO_PORT145, NULL); /* RESET */ |
| 525 | gpio_direction_output(GPIO_PORT145, 1); |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 526 | |
Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 527 | /* FSI A */ |
| 528 | gpio_request(GPIO_FN_FSIACK, NULL); |
| 529 | gpio_request(GPIO_FN_FSIAILR, NULL); |
| 530 | gpio_request(GPIO_FN_FSIAIBT, NULL); |
| 531 | gpio_request(GPIO_FN_FSIAISLD, NULL); |
| 532 | gpio_request(GPIO_FN_FSIAOSLD, NULL); |
| 533 | |
Kuninori Morimoto | a33bb8a | 2011-01-14 11:00:41 +0000 | [diff] [blame] | 534 | /* IrDA */ |
| 535 | gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); |
| 536 | gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL); |
| 537 | gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); |
| 538 | |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 539 | /* LCD panel */ |
| 540 | gpio_request(GPIO_PORT217, NULL); /* RESET */ |
| 541 | gpio_direction_output(GPIO_PORT217, 0); |
| 542 | mdelay(1); |
| 543 | gpio_set_value(GPIO_PORT217, 1); |
Magnus Damm | f55398a | 2011-01-28 09:59:17 +0000 | [diff] [blame] | 544 | mdelay(100); |
Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 545 | |
| 546 | /* LCD backlight controller */ |
| 547 | gpio_request(GPIO_PORT235, NULL); /* RESET */ |
| 548 | gpio_direction_output(GPIO_PORT235, 0); |
| 549 | lcd_backlight_reset(); |
| 550 | |
| 551 | /* MIPI-DSI clock setup */ |
| 552 | __raw_writel(0x2a809010, DSI0PHYCR); |
| 553 | |
Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 554 | /* enable SDHI0 on CN15 [SD I/F] */ |
| 555 | gpio_request(GPIO_FN_SDHICD0, NULL); |
| 556 | gpio_request(GPIO_FN_SDHIWP0, NULL); |
| 557 | gpio_request(GPIO_FN_SDHICMD0, NULL); |
| 558 | gpio_request(GPIO_FN_SDHICLK0, NULL); |
| 559 | gpio_request(GPIO_FN_SDHID0_3, NULL); |
| 560 | gpio_request(GPIO_FN_SDHID0_2, NULL); |
| 561 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
| 562 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
| 563 | |
| 564 | /* enable SDHI1 on CN4 [WLAN I/F] */ |
| 565 | gpio_request(GPIO_FN_SDHICLK1, NULL); |
| 566 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); |
| 567 | gpio_request(GPIO_FN_SDHID1_3_PU, NULL); |
| 568 | gpio_request(GPIO_FN_SDHID1_2_PU, NULL); |
| 569 | gpio_request(GPIO_FN_SDHID1_1_PU, NULL); |
| 570 | gpio_request(GPIO_FN_SDHID1_0_PU, NULL); |
| 571 | gpio_request(GPIO_PORT114, "sdhi1_power"); |
| 572 | gpio_direction_output(GPIO_PORT114, 0); |
| 573 | |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 574 | #ifdef CONFIG_CACHE_L2X0 |
| 575 | /* Shared attribute override enable, 64K*8way */ |
| 576 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); |
| 577 | #endif |
| 578 | sh73a0_add_standard_devices(); |
| 579 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); |
| 580 | } |
| 581 | |
| 582 | static void __init ag5evm_timer_init(void) |
| 583 | { |
| 584 | sh73a0_clock_init(); |
| 585 | shmobile_timer.init(); |
| 586 | return; |
| 587 | } |
| 588 | |
| 589 | struct sys_timer ag5evm_timer = { |
| 590 | .init = ag5evm_timer_init, |
| 591 | }; |
| 592 | |
| 593 | MACHINE_START(AG5EVM, "ag5evm") |
| 594 | .map_io = ag5evm_map_io, |
| 595 | .init_irq = ag5evm_init_irq, |
Magnus Damm | e74a962 | 2010-12-28 08:27:10 +0000 | [diff] [blame] | 596 | .handle_irq = shmobile_handle_irq_gic, |
Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 597 | .init_machine = ag5evm_init, |
| 598 | .timer = &ag5evm_timer, |
| 599 | MACHINE_END |