| 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 | 6bf45a1 | 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 | 6bf45a1 | 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 | 6bf45a1 | 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 | 6bf45a1 | 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, | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 344 | .tmio_caps	= MMC_CAP_SD_HIGHSPEED, | 
|  | 345 | .tmio_ocr_mask	= MMC_VDD_27_28 | MMC_VDD_28_29, | 
|  | 346 | }; | 
|  | 347 |  | 
|  | 348 | static struct resource sdhi0_resources[] = { | 
|  | 349 | [0] = { | 
|  | 350 | .name	= "SDHI0", | 
|  | 351 | .start	= 0xee100000, | 
|  | 352 | .end	= 0xee1000ff, | 
|  | 353 | .flags	= IORESOURCE_MEM, | 
|  | 354 | }, | 
|  | 355 | [1] = { | 
|  | 356 | .start	= gic_spi(83), | 
|  | 357 | .flags	= IORESOURCE_IRQ, | 
|  | 358 | }, | 
|  | 359 | [2] = { | 
|  | 360 | .start	= gic_spi(84), | 
|  | 361 | .flags	= IORESOURCE_IRQ, | 
|  | 362 | }, | 
|  | 363 | [3] = { | 
|  | 364 | .start	= gic_spi(85), | 
|  | 365 | .flags	= IORESOURCE_IRQ, | 
|  | 366 | }, | 
|  | 367 | }; | 
|  | 368 |  | 
|  | 369 | static struct platform_device sdhi0_device = { | 
|  | 370 | .name		= "sh_mobile_sdhi", | 
|  | 371 | .id		= 0, | 
|  | 372 | .num_resources	= ARRAY_SIZE(sdhi0_resources), | 
|  | 373 | .resource	= sdhi0_resources, | 
|  | 374 | .dev	= { | 
|  | 375 | .platform_data	= &sdhi0_info, | 
|  | 376 | }, | 
|  | 377 | }; | 
|  | 378 |  | 
|  | 379 | void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) | 
|  | 380 | { | 
|  | 381 | gpio_set_value(GPIO_PORT114, state); | 
|  | 382 | } | 
|  | 383 |  | 
| Simon Horman | 9e05cdd | 2011-06-20 23:00:11 +0000 | [diff] [blame] | 384 | static struct sh_mobile_sdhi_info sh_sdhi1_info = { | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 385 | .tmio_flags	= TMIO_MMC_WRPROTECT_DISABLE, | 
| Magnus Damm | 5294206 | 2011-06-09 09:02:25 +0000 | [diff] [blame] | 386 | .tmio_caps	= MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ, | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 387 | .tmio_ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34, | 
|  | 388 | .set_pwr	= ag5evm_sdhi1_set_pwr, | 
|  | 389 | }; | 
|  | 390 |  | 
|  | 391 | static struct resource sdhi1_resources[] = { | 
|  | 392 | [0] = { | 
|  | 393 | .name	= "SDHI1", | 
|  | 394 | .start	= 0xee120000, | 
|  | 395 | .end	= 0xee1200ff, | 
|  | 396 | .flags	= IORESOURCE_MEM, | 
|  | 397 | }, | 
|  | 398 | [1] = { | 
|  | 399 | .start	= gic_spi(87), | 
|  | 400 | .flags	= IORESOURCE_IRQ, | 
|  | 401 | }, | 
|  | 402 | [2] = { | 
|  | 403 | .start	= gic_spi(88), | 
|  | 404 | .flags	= IORESOURCE_IRQ, | 
|  | 405 | }, | 
|  | 406 | [3] = { | 
|  | 407 | .start	= gic_spi(89), | 
|  | 408 | .flags	= IORESOURCE_IRQ, | 
|  | 409 | }, | 
|  | 410 | }; | 
|  | 411 |  | 
|  | 412 | static struct platform_device sdhi1_device = { | 
|  | 413 | .name		= "sh_mobile_sdhi", | 
|  | 414 | .id		= 1, | 
|  | 415 | .dev		= { | 
| Simon Horman | 9e05cdd | 2011-06-20 23:00:11 +0000 | [diff] [blame] | 416 | .platform_data	= &sh_sdhi1_info, | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 417 | }, | 
|  | 418 | .num_resources	= ARRAY_SIZE(sdhi1_resources), | 
|  | 419 | .resource	= sdhi1_resources, | 
|  | 420 | }; | 
|  | 421 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 422 | static struct platform_device *ag5evm_devices[] __initdata = { | 
|  | 423 | ð_device, | 
| Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 424 | &keysc_device, | 
| Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 425 | &fsi_device, | 
| Takashi YOSHII | 6bf45a1 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 426 | &mmc_device, | 
| Kuninori Morimoto | a33bb8a | 2011-01-14 11:00:41 +0000 | [diff] [blame] | 427 | &irda_device, | 
| Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 428 | &lcdc0_device, | 
|  | 429 | &mipidsi0_device, | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 430 | &sdhi0_device, | 
|  | 431 | &sdhi1_device, | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 432 | }; | 
|  | 433 |  | 
|  | 434 | static struct map_desc ag5evm_io_desc[] __initdata = { | 
|  | 435 | /* create a 1:1 entity map for 0xe6xxxxxx | 
|  | 436 | * used by CPGA, INTC and PFC. | 
|  | 437 | */ | 
|  | 438 | { | 
|  | 439 | .virtual	= 0xe6000000, | 
|  | 440 | .pfn		= __phys_to_pfn(0xe6000000), | 
|  | 441 | .length		= 256 << 20, | 
|  | 442 | .type		= MT_DEVICE_NONSHARED | 
|  | 443 | }, | 
|  | 444 | }; | 
|  | 445 |  | 
|  | 446 | static void __init ag5evm_map_io(void) | 
|  | 447 | { | 
|  | 448 | iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); | 
|  | 449 |  | 
|  | 450 | /* setup early devices and console here as well */ | 
|  | 451 | sh73a0_add_early_devices(); | 
|  | 452 | shmobile_setup_console(); | 
|  | 453 | } | 
|  | 454 |  | 
|  | 455 | #define PINTC_ADDR	0xe6900000 | 
|  | 456 | #define PINTER0A	(PINTC_ADDR + 0xa0) | 
|  | 457 | #define PINTCR0A	(PINTC_ADDR + 0xb0) | 
|  | 458 |  | 
|  | 459 | void __init ag5evm_init_irq(void) | 
|  | 460 | { | 
| Magnus Damm | 5f53a56 | 2010-12-21 08:37:32 +0000 | [diff] [blame] | 461 | sh73a0_init_irq(); | 
|  | 462 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 463 | /* setup PINT: enable PINTA2 as active low */ | 
|  | 464 | __raw_writel(__raw_readl(PINTER0A) | (1<<29), PINTER0A); | 
|  | 465 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 466 | } | 
|  | 467 |  | 
| Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 468 | #define DSI0PHYCR	0xe615006c | 
|  | 469 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 470 | static void __init ag5evm_init(void) | 
|  | 471 | { | 
| Takashi YOSHII | 3256c78 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 472 | sh73a0_pinmux_init(); | 
|  | 473 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 474 | /* enable SCIFA2 */ | 
| Takashi YOSHII | 3256c78 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 475 | gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); | 
|  | 476 | gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); | 
|  | 477 | gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL); | 
|  | 478 | gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL); | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 479 |  | 
| Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 480 | /* enable KEYSC */ | 
| Takashi YOSHII | 5d78147 | 2010-12-22 06:30:19 +0000 | [diff] [blame] | 481 | gpio_request(GPIO_FN_KEYIN0_PU, NULL); | 
|  | 482 | gpio_request(GPIO_FN_KEYIN1_PU, NULL); | 
|  | 483 | gpio_request(GPIO_FN_KEYIN2_PU, NULL); | 
|  | 484 | gpio_request(GPIO_FN_KEYIN3_PU, NULL); | 
|  | 485 | gpio_request(GPIO_FN_KEYIN4_PU, NULL); | 
|  | 486 | gpio_request(GPIO_FN_KEYIN5_PU, NULL); | 
|  | 487 | gpio_request(GPIO_FN_KEYIN6_PU, NULL); | 
|  | 488 | gpio_request(GPIO_FN_KEYIN7_PU, NULL); | 
| Yoshii Takashi | 2d22d48 | 2010-11-19 13:15:46 +0000 | [diff] [blame] | 489 | gpio_request(GPIO_FN_KEYOUT0, NULL); | 
|  | 490 | gpio_request(GPIO_FN_KEYOUT1, NULL); | 
|  | 491 | gpio_request(GPIO_FN_KEYOUT2, NULL); | 
|  | 492 | gpio_request(GPIO_FN_KEYOUT3, NULL); | 
|  | 493 | gpio_request(GPIO_FN_KEYOUT4, NULL); | 
|  | 494 | gpio_request(GPIO_FN_KEYOUT5, NULL); | 
|  | 495 | gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL); | 
|  | 496 | gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL); | 
|  | 497 | gpio_request(GPIO_FN_KEYOUT8, NULL); | 
|  | 498 | gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL); | 
|  | 499 |  | 
| Takashi YOSHII | 6bf45a1 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 500 | /* enable I2C channel 2 and 3 */ | 
| Yoshii Takashi | 8e67b22 | 2010-11-19 13:21:32 +0000 | [diff] [blame] | 501 | gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL); | 
|  | 502 | gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL); | 
|  | 503 | gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL); | 
|  | 504 | gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL); | 
|  | 505 |  | 
| Takashi YOSHII | 6bf45a1 | 2010-12-22 06:35:30 +0000 | [diff] [blame] | 506 | /* enable MMCIF */ | 
|  | 507 | gpio_request(GPIO_FN_MMCCLK0, NULL); | 
|  | 508 | gpio_request(GPIO_FN_MMCCMD0_PU, NULL); | 
|  | 509 | gpio_request(GPIO_FN_MMCD0_0, NULL); | 
|  | 510 | gpio_request(GPIO_FN_MMCD0_1, NULL); | 
|  | 511 | gpio_request(GPIO_FN_MMCD0_2, NULL); | 
|  | 512 | gpio_request(GPIO_FN_MMCD0_3, NULL); | 
|  | 513 | gpio_request(GPIO_FN_MMCD0_4, NULL); | 
|  | 514 | gpio_request(GPIO_FN_MMCD0_5, NULL); | 
|  | 515 | gpio_request(GPIO_FN_MMCD0_6, NULL); | 
|  | 516 | gpio_request(GPIO_FN_MMCD0_7, NULL); | 
|  | 517 | gpio_request(GPIO_PORT208, NULL); /* Reset */ | 
|  | 518 | gpio_direction_output(GPIO_PORT208, 1); | 
|  | 519 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 520 | /* enable SMSC911X */ | 
| Takashi YOSHII | 3256c78 | 2010-11-19 16:49:38 +0900 | [diff] [blame] | 521 | gpio_request(GPIO_PORT144, NULL); /* PINTA2 */ | 
|  | 522 | gpio_direction_input(GPIO_PORT144); | 
|  | 523 | gpio_request(GPIO_PORT145, NULL); /* RESET */ | 
|  | 524 | gpio_direction_output(GPIO_PORT145, 1); | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 525 |  | 
| Kuninori Morimoto | 208c7dc | 2010-11-29 02:10:08 +0000 | [diff] [blame] | 526 | /* FSI A */ | 
|  | 527 | gpio_request(GPIO_FN_FSIACK, NULL); | 
|  | 528 | gpio_request(GPIO_FN_FSIAILR, NULL); | 
|  | 529 | gpio_request(GPIO_FN_FSIAIBT, NULL); | 
|  | 530 | gpio_request(GPIO_FN_FSIAISLD, NULL); | 
|  | 531 | gpio_request(GPIO_FN_FSIAOSLD, NULL); | 
|  | 532 |  | 
| Kuninori Morimoto | a33bb8a | 2011-01-14 11:00:41 +0000 | [diff] [blame] | 533 | /* IrDA */ | 
|  | 534 | gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); | 
|  | 535 | gpio_request(GPIO_FN_PORT242_IRDA_IN,  NULL); | 
|  | 536 | gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); | 
|  | 537 |  | 
| Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 538 | /* LCD panel */ | 
|  | 539 | gpio_request(GPIO_PORT217, NULL); /* RESET */ | 
|  | 540 | gpio_direction_output(GPIO_PORT217, 0); | 
|  | 541 | mdelay(1); | 
|  | 542 | gpio_set_value(GPIO_PORT217, 1); | 
| Magnus Damm | f55398a | 2011-01-28 09:59:17 +0000 | [diff] [blame] | 543 | mdelay(100); | 
| Magnus Damm | 170c7ab | 2011-01-20 08:41:03 +0000 | [diff] [blame] | 544 |  | 
|  | 545 | /* LCD backlight controller */ | 
|  | 546 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | 
|  | 547 | gpio_direction_output(GPIO_PORT235, 0); | 
|  | 548 | lcd_backlight_reset(); | 
|  | 549 |  | 
|  | 550 | /* MIPI-DSI clock setup */ | 
|  | 551 | __raw_writel(0x2a809010, DSI0PHYCR); | 
|  | 552 |  | 
| Magnus Damm | fb66c52 | 2011-05-23 05:10:36 +0000 | [diff] [blame] | 553 | /* enable SDHI0 on CN15 [SD I/F] */ | 
|  | 554 | gpio_request(GPIO_FN_SDHICD0, NULL); | 
|  | 555 | gpio_request(GPIO_FN_SDHIWP0, NULL); | 
|  | 556 | gpio_request(GPIO_FN_SDHICMD0, NULL); | 
|  | 557 | gpio_request(GPIO_FN_SDHICLK0, NULL); | 
|  | 558 | gpio_request(GPIO_FN_SDHID0_3, NULL); | 
|  | 559 | gpio_request(GPIO_FN_SDHID0_2, NULL); | 
|  | 560 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 
|  | 561 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 
|  | 562 |  | 
|  | 563 | /* enable SDHI1 on CN4 [WLAN I/F] */ | 
|  | 564 | gpio_request(GPIO_FN_SDHICLK1, NULL); | 
|  | 565 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); | 
|  | 566 | gpio_request(GPIO_FN_SDHID1_3_PU, NULL); | 
|  | 567 | gpio_request(GPIO_FN_SDHID1_2_PU, NULL); | 
|  | 568 | gpio_request(GPIO_FN_SDHID1_1_PU, NULL); | 
|  | 569 | gpio_request(GPIO_FN_SDHID1_0_PU, NULL); | 
|  | 570 | gpio_request(GPIO_PORT114, "sdhi1_power"); | 
|  | 571 | gpio_direction_output(GPIO_PORT114, 0); | 
|  | 572 |  | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 573 | #ifdef CONFIG_CACHE_L2X0 | 
|  | 574 | /* Shared attribute override enable, 64K*8way */ | 
|  | 575 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | 
|  | 576 | #endif | 
|  | 577 | sh73a0_add_standard_devices(); | 
|  | 578 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); | 
|  | 579 | } | 
|  | 580 |  | 
|  | 581 | static void __init ag5evm_timer_init(void) | 
|  | 582 | { | 
|  | 583 | sh73a0_clock_init(); | 
|  | 584 | shmobile_timer.init(); | 
|  | 585 | return; | 
|  | 586 | } | 
|  | 587 |  | 
|  | 588 | struct sys_timer ag5evm_timer = { | 
|  | 589 | .init	= ag5evm_timer_init, | 
|  | 590 | }; | 
|  | 591 |  | 
|  | 592 | MACHINE_START(AG5EVM, "ag5evm") | 
|  | 593 | .map_io		= ag5evm_map_io, | 
|  | 594 | .init_irq	= ag5evm_init_irq, | 
| Magnus Damm | e74a962 | 2010-12-28 08:27:10 +0000 | [diff] [blame] | 595 | .handle_irq	= shmobile_handle_irq_gic, | 
| Magnus Damm | 6d9598e | 2010-11-17 10:59:31 +0000 | [diff] [blame] | 596 | .init_machine	= ag5evm_init, | 
|  | 597 | .timer		= &ag5evm_timer, | 
|  | 598 | MACHINE_END |