Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 1 | /* |
| 2 | * KZM-A9-GT board support |
| 3 | * |
| 4 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 19 | |
| 20 | #include <linux/delay.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 21 | #include <linux/gpio.h> |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 22 | #include <linux/gpio_keys.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 23 | #include <linux/io.h> |
| 24 | #include <linux/irq.h> |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 25 | #include <linux/i2c.h> |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 26 | #include <linux/i2c/pcf857x.h> |
| 27 | #include <linux/input.h> |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 28 | #include <linux/mmc/host.h> |
| 29 | #include <linux/mmc/sh_mmcif.h> |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 30 | #include <linux/mmc/sh_mobile_sdhi.h> |
| 31 | #include <linux/mfd/tmio.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 32 | #include <linux/platform_device.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 33 | #include <linux/smsc911x.h> |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 34 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 35 | #include <linux/videodev2.h> |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 36 | #include <sound/sh_fsi.h> |
| 37 | #include <sound/simple_card.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 38 | #include <mach/irqs.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 39 | #include <mach/sh73a0.h> |
| 40 | #include <mach/common.h> |
| 41 | #include <asm/hardware/cache-l2x0.h> |
| 42 | #include <asm/hardware/gic.h> |
| 43 | #include <asm/mach-types.h> |
| 44 | #include <asm/mach/arch.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 45 | #include <video/sh_mobile_lcdc.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 46 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 47 | /* |
| 48 | * external GPIO |
| 49 | */ |
| 50 | #define GPIO_PCF8575_BASE (GPIO_NR) |
| 51 | #define GPIO_PCF8575_PORT10 (GPIO_NR + 8) |
| 52 | #define GPIO_PCF8575_PORT11 (GPIO_NR + 9) |
| 53 | #define GPIO_PCF8575_PORT12 (GPIO_NR + 10) |
| 54 | #define GPIO_PCF8575_PORT13 (GPIO_NR + 11) |
| 55 | #define GPIO_PCF8575_PORT14 (GPIO_NR + 12) |
| 56 | #define GPIO_PCF8575_PORT15 (GPIO_NR + 13) |
| 57 | #define GPIO_PCF8575_PORT16 (GPIO_NR + 14) |
| 58 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 59 | /* |
| 60 | * FSI-AK4648 |
| 61 | * |
| 62 | * this command is required when playback. |
| 63 | * |
| 64 | * # amixer set "LINEOUT Mixer DACL" on |
| 65 | */ |
| 66 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 67 | /* SMSC 9221 */ |
| 68 | static struct resource smsc9221_resources[] = { |
| 69 | [0] = { |
| 70 | .start = 0x10000000, /* CS4 */ |
| 71 | .end = 0x100000ff, |
| 72 | .flags = IORESOURCE_MEM, |
| 73 | }, |
| 74 | [1] = { |
| 75 | .start = intcs_evt2irq(0x260), /* IRQ3 */ |
| 76 | .flags = IORESOURCE_IRQ, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | static struct smsc911x_platform_config smsc9221_platdata = { |
| 81 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 82 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 83 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 84 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device smsc_device = { |
| 88 | .name = "smsc911x", |
| 89 | .dev = { |
| 90 | .platform_data = &smsc9221_platdata, |
| 91 | }, |
| 92 | .resource = smsc9221_resources, |
| 93 | .num_resources = ARRAY_SIZE(smsc9221_resources), |
| 94 | }; |
| 95 | |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 96 | /* USB external chip */ |
| 97 | static struct r8a66597_platdata usb_host_data = { |
| 98 | .on_chip = 0, |
| 99 | .xtal = R8A66597_PLATDATA_XTAL_48MHZ, |
| 100 | }; |
| 101 | |
| 102 | static struct resource usb_resources[] = { |
| 103 | [0] = { |
| 104 | .start = 0x10010000, |
| 105 | .end = 0x1001ffff - 1, |
| 106 | .flags = IORESOURCE_MEM, |
| 107 | }, |
| 108 | [1] = { |
| 109 | .start = intcs_evt2irq(0x220), /* IRQ1 */ |
| 110 | .flags = IORESOURCE_IRQ, |
| 111 | }, |
| 112 | }; |
| 113 | |
| 114 | static struct platform_device usb_host_device = { |
| 115 | .name = "r8a66597_hcd", |
| 116 | .dev = { |
| 117 | .platform_data = &usb_host_data, |
| 118 | .dma_mask = NULL, |
| 119 | .coherent_dma_mask = 0xffffffff, |
| 120 | }, |
| 121 | .num_resources = ARRAY_SIZE(usb_resources), |
| 122 | .resource = usb_resources, |
| 123 | }; |
| 124 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 125 | /* LCDC */ |
| 126 | static struct fb_videomode kzm_lcdc_mode = { |
| 127 | .name = "WVGA Panel", |
| 128 | .xres = 800, |
| 129 | .yres = 480, |
| 130 | .left_margin = 220, |
| 131 | .right_margin = 110, |
| 132 | .hsync_len = 70, |
| 133 | .upper_margin = 20, |
| 134 | .lower_margin = 5, |
| 135 | .vsync_len = 5, |
| 136 | .sync = 0, |
| 137 | }; |
| 138 | |
| 139 | static struct sh_mobile_lcdc_info lcdc_info = { |
| 140 | .clock_source = LCDC_CLK_BUS, |
| 141 | .ch[0] = { |
| 142 | .chan = LCDC_CHAN_MAINLCD, |
| 143 | .fourcc = V4L2_PIX_FMT_RGB565, |
| 144 | .interface_type = RGB24, |
| 145 | .lcd_modes = &kzm_lcdc_mode, |
| 146 | .num_modes = 1, |
| 147 | .clock_divider = 5, |
| 148 | .flags = 0, |
| 149 | .panel_cfg = { |
| 150 | .width = 152, |
| 151 | .height = 91, |
| 152 | }, |
| 153 | } |
| 154 | }; |
| 155 | |
| 156 | static struct resource lcdc_resources[] = { |
| 157 | [0] = { |
| 158 | .name = "LCDC", |
| 159 | .start = 0xfe940000, |
| 160 | .end = 0xfe943fff, |
| 161 | .flags = IORESOURCE_MEM, |
| 162 | }, |
| 163 | [1] = { |
| 164 | .start = intcs_evt2irq(0x580), |
| 165 | .flags = IORESOURCE_IRQ, |
| 166 | }, |
| 167 | }; |
| 168 | |
| 169 | static struct platform_device lcdc_device = { |
| 170 | .name = "sh_mobile_lcdc_fb", |
| 171 | .num_resources = ARRAY_SIZE(lcdc_resources), |
| 172 | .resource = lcdc_resources, |
| 173 | .dev = { |
| 174 | .platform_data = &lcdc_info, |
| 175 | .coherent_dma_mask = ~0, |
| 176 | }, |
| 177 | }; |
| 178 | |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 179 | /* MMCIF */ |
| 180 | static struct resource sh_mmcif_resources[] = { |
| 181 | [0] = { |
| 182 | .name = "MMCIF", |
| 183 | .start = 0xe6bd0000, |
| 184 | .end = 0xe6bd00ff, |
| 185 | .flags = IORESOURCE_MEM, |
| 186 | }, |
| 187 | [1] = { |
| 188 | .start = gic_spi(141), |
| 189 | .flags = IORESOURCE_IRQ, |
| 190 | }, |
| 191 | [2] = { |
| 192 | .start = gic_spi(140), |
| 193 | .flags = IORESOURCE_IRQ, |
| 194 | }, |
| 195 | }; |
| 196 | |
| 197 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
| 198 | .ocr = MMC_VDD_165_195, |
| 199 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
| 200 | }; |
| 201 | |
| 202 | static struct platform_device mmc_device = { |
| 203 | .name = "sh_mmcif", |
| 204 | .dev = { |
| 205 | .dma_mask = NULL, |
| 206 | .coherent_dma_mask = 0xffffffff, |
| 207 | .platform_data = &sh_mmcif_platdata, |
| 208 | }, |
| 209 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), |
| 210 | .resource = sh_mmcif_resources, |
| 211 | }; |
| 212 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 213 | /* SDHI */ |
| 214 | static struct sh_mobile_sdhi_info sdhi0_info = { |
| 215 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, |
| 216 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
| 217 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 218 | }; |
| 219 | |
| 220 | static struct resource sdhi0_resources[] = { |
| 221 | [0] = { |
| 222 | .name = "SDHI0", |
| 223 | .start = 0xee100000, |
| 224 | .end = 0xee1000ff, |
| 225 | .flags = IORESOURCE_MEM, |
| 226 | }, |
| 227 | [1] = { |
| 228 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
| 229 | .start = gic_spi(83), |
| 230 | .flags = IORESOURCE_IRQ, |
| 231 | }, |
| 232 | [2] = { |
| 233 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
| 234 | .start = gic_spi(84), |
| 235 | .flags = IORESOURCE_IRQ, |
| 236 | }, |
| 237 | [3] = { |
| 238 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
| 239 | .start = gic_spi(85), |
| 240 | .flags = IORESOURCE_IRQ, |
| 241 | }, |
| 242 | }; |
| 243 | |
| 244 | static struct platform_device sdhi0_device = { |
| 245 | .name = "sh_mobile_sdhi", |
| 246 | .num_resources = ARRAY_SIZE(sdhi0_resources), |
| 247 | .resource = sdhi0_resources, |
| 248 | .dev = { |
| 249 | .platform_data = &sdhi0_info, |
| 250 | }, |
| 251 | }; |
| 252 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 253 | /* KEY */ |
| 254 | #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } |
| 255 | |
| 256 | static struct gpio_keys_button gpio_buttons[] = { |
| 257 | GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"), |
| 258 | GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"), |
| 259 | GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"), |
| 260 | GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"), |
| 261 | GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"), |
| 262 | GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"), |
| 263 | GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"), |
| 264 | }; |
| 265 | |
| 266 | static struct gpio_keys_platform_data gpio_key_info = { |
| 267 | .buttons = gpio_buttons, |
| 268 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
| 269 | .poll_interval = 250, /* poling at this point */ |
| 270 | }; |
| 271 | |
| 272 | static struct platform_device gpio_keys_device = { |
| 273 | /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */ |
| 274 | .name = "gpio-keys-polled", |
| 275 | .dev = { |
| 276 | .platform_data = &gpio_key_info, |
| 277 | }, |
| 278 | }; |
| 279 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 280 | /* FSI-AK4648 */ |
| 281 | static struct sh_fsi_platform_info fsi_info = { |
| 282 | .port_a = { |
| 283 | }, |
| 284 | }; |
| 285 | |
| 286 | static struct resource fsi_resources[] = { |
| 287 | [0] = { |
| 288 | .name = "FSI", |
| 289 | .start = 0xEC230000, |
| 290 | .end = 0xEC230400 - 1, |
| 291 | .flags = IORESOURCE_MEM, |
| 292 | }, |
| 293 | [1] = { |
| 294 | .start = gic_spi(146), |
| 295 | .flags = IORESOURCE_IRQ, |
| 296 | }, |
| 297 | }; |
| 298 | |
| 299 | static struct platform_device fsi_device = { |
| 300 | .name = "sh_fsi2", |
| 301 | .id = -1, |
| 302 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 303 | .resource = fsi_resources, |
| 304 | .dev = { |
| 305 | .platform_data = &fsi_info, |
| 306 | }, |
| 307 | }; |
| 308 | |
| 309 | static struct asoc_simple_dai_init_info fsi2_ak4648_init_info = { |
| 310 | .fmt = SND_SOC_DAIFMT_LEFT_J, |
| 311 | .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM, |
| 312 | .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS, |
| 313 | .sysclk = 11289600, |
| 314 | }; |
| 315 | |
| 316 | static struct asoc_simple_card_info fsi2_ak4648_info = { |
| 317 | .name = "AK4648", |
| 318 | .card = "FSI2A-AK4648", |
| 319 | .cpu_dai = "fsia-dai", |
| 320 | .codec = "ak4642-codec.0-0012", |
| 321 | .platform = "sh_fsi2", |
| 322 | .codec_dai = "ak4642-hifi", |
| 323 | .init = &fsi2_ak4648_init_info, |
| 324 | }; |
| 325 | |
| 326 | static struct platform_device fsi_ak4648_device = { |
| 327 | .name = "asoc-simple-card", |
| 328 | .dev = { |
| 329 | .platform_data = &fsi2_ak4648_info, |
| 330 | }, |
| 331 | }; |
| 332 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 333 | /* I2C */ |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 334 | static struct pcf857x_platform_data pcf8575_pdata = { |
| 335 | .gpio_base = GPIO_PCF8575_BASE, |
| 336 | }; |
| 337 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 338 | static struct i2c_board_info i2c0_devices[] = { |
| 339 | { |
| 340 | I2C_BOARD_INFO("ak4648", 0x12), |
| 341 | } |
| 342 | }; |
| 343 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 344 | static struct i2c_board_info i2c1_devices[] = { |
| 345 | { |
| 346 | I2C_BOARD_INFO("st1232-ts", 0x55), |
| 347 | .irq = intcs_evt2irq(0x300), /* IRQ8 */ |
| 348 | }, |
| 349 | }; |
| 350 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 351 | static struct i2c_board_info i2c3_devices[] = { |
| 352 | { |
| 353 | I2C_BOARD_INFO("pcf8575", 0x20), |
| 354 | .platform_data = &pcf8575_pdata, |
| 355 | }, |
| 356 | }; |
| 357 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 358 | static struct platform_device *kzm_devices[] __initdata = { |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 359 | &smsc_device, |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 360 | &usb_host_device, |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 361 | &lcdc_device, |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 362 | &mmc_device, |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 363 | &sdhi0_device, |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 364 | &gpio_keys_device, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 365 | &fsi_device, |
| 366 | &fsi_ak4648_device, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 367 | }; |
| 368 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 369 | /* |
| 370 | * FIXME |
| 371 | * |
| 372 | * This is quick hack for enabling LCDC backlight |
| 373 | */ |
| 374 | static int __init as3711_enable_lcdc_backlight(void) |
| 375 | { |
| 376 | struct i2c_adapter *a = i2c_get_adapter(0); |
| 377 | struct i2c_msg msg; |
| 378 | int i, ret; |
| 379 | __u8 magic[] = { |
| 380 | 0x40, 0x2a, |
| 381 | 0x43, 0x3c, |
| 382 | 0x44, 0x3c, |
| 383 | 0x45, 0x3c, |
| 384 | 0x54, 0x03, |
| 385 | 0x51, 0x00, |
| 386 | 0x51, 0x01, |
| 387 | 0xff, 0x00, /* wait */ |
| 388 | 0x43, 0xf0, |
| 389 | 0x44, 0xf0, |
| 390 | 0x45, 0xf0, |
| 391 | }; |
| 392 | |
| 393 | if (!machine_is_kzm9g()) |
| 394 | return 0; |
| 395 | |
| 396 | if (!a) |
| 397 | return 0; |
| 398 | |
| 399 | msg.addr = 0x40; |
| 400 | msg.len = 2; |
| 401 | msg.flags = 0; |
| 402 | |
| 403 | for (i = 0; i < ARRAY_SIZE(magic); i += 2) { |
| 404 | msg.buf = magic + i; |
| 405 | |
| 406 | if (0xff == msg.buf[0]) { |
| 407 | udelay(500); |
| 408 | continue; |
| 409 | } |
| 410 | |
| 411 | ret = i2c_transfer(a, &msg, 1); |
| 412 | if (ret < 0) { |
| 413 | pr_err("i2c transfer fail\n"); |
| 414 | break; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | return 0; |
| 419 | } |
| 420 | device_initcall(as3711_enable_lcdc_backlight); |
| 421 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 422 | static void __init kzm_init(void) |
| 423 | { |
| 424 | sh73a0_pinmux_init(); |
| 425 | |
| 426 | /* enable SCIFA4 */ |
| 427 | gpio_request(GPIO_FN_SCIFA4_TXD, NULL); |
| 428 | gpio_request(GPIO_FN_SCIFA4_RXD, NULL); |
| 429 | gpio_request(GPIO_FN_SCIFA4_RTS_, NULL); |
| 430 | gpio_request(GPIO_FN_SCIFA4_CTS_, NULL); |
| 431 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 432 | /* CS4 for SMSC/USB */ |
| 433 | gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */ |
| 434 | |
| 435 | /* SMSC */ |
| 436 | gpio_request(GPIO_PORT224, NULL); /* IRQ3 */ |
| 437 | gpio_direction_input(GPIO_PORT224); |
| 438 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 439 | /* LCDC */ |
| 440 | gpio_request(GPIO_FN_LCDD23, NULL); |
| 441 | gpio_request(GPIO_FN_LCDD22, NULL); |
| 442 | gpio_request(GPIO_FN_LCDD21, NULL); |
| 443 | gpio_request(GPIO_FN_LCDD20, NULL); |
| 444 | gpio_request(GPIO_FN_LCDD19, NULL); |
| 445 | gpio_request(GPIO_FN_LCDD18, NULL); |
| 446 | gpio_request(GPIO_FN_LCDD17, NULL); |
| 447 | gpio_request(GPIO_FN_LCDD16, NULL); |
| 448 | gpio_request(GPIO_FN_LCDD15, NULL); |
| 449 | gpio_request(GPIO_FN_LCDD14, NULL); |
| 450 | gpio_request(GPIO_FN_LCDD13, NULL); |
| 451 | gpio_request(GPIO_FN_LCDD12, NULL); |
| 452 | gpio_request(GPIO_FN_LCDD11, NULL); |
| 453 | gpio_request(GPIO_FN_LCDD10, NULL); |
| 454 | gpio_request(GPIO_FN_LCDD9, NULL); |
| 455 | gpio_request(GPIO_FN_LCDD8, NULL); |
| 456 | gpio_request(GPIO_FN_LCDD7, NULL); |
| 457 | gpio_request(GPIO_FN_LCDD6, NULL); |
| 458 | gpio_request(GPIO_FN_LCDD5, NULL); |
| 459 | gpio_request(GPIO_FN_LCDD4, NULL); |
| 460 | gpio_request(GPIO_FN_LCDD3, NULL); |
| 461 | gpio_request(GPIO_FN_LCDD2, NULL); |
| 462 | gpio_request(GPIO_FN_LCDD1, NULL); |
| 463 | gpio_request(GPIO_FN_LCDD0, NULL); |
| 464 | gpio_request(GPIO_FN_LCDDISP, NULL); |
| 465 | gpio_request(GPIO_FN_LCDDCK, NULL); |
| 466 | |
Kuninori Morimoto | 601df61 | 2012-04-22 23:53:24 -0700 | [diff] [blame] | 467 | gpio_request(GPIO_PORT222, NULL); /* LCDCDON */ |
| 468 | gpio_request(GPIO_PORT226, NULL); /* SC */ |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 469 | gpio_direction_output(GPIO_PORT222, 1); |
Kuninori Morimoto | 601df61 | 2012-04-22 23:53:24 -0700 | [diff] [blame] | 470 | gpio_direction_output(GPIO_PORT226, 1); |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 471 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 472 | /* Touchscreen */ |
| 473 | gpio_request(GPIO_PORT223, NULL); /* IRQ8 */ |
| 474 | gpio_direction_input(GPIO_PORT223); |
| 475 | |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 476 | /* enable MMCIF */ |
| 477 | gpio_request(GPIO_FN_MMCCLK0, NULL); |
| 478 | gpio_request(GPIO_FN_MMCCMD0_PU, NULL); |
| 479 | gpio_request(GPIO_FN_MMCD0_0_PU, NULL); |
| 480 | gpio_request(GPIO_FN_MMCD0_1_PU, NULL); |
| 481 | gpio_request(GPIO_FN_MMCD0_2_PU, NULL); |
| 482 | gpio_request(GPIO_FN_MMCD0_3_PU, NULL); |
| 483 | gpio_request(GPIO_FN_MMCD0_4_PU, NULL); |
| 484 | gpio_request(GPIO_FN_MMCD0_5_PU, NULL); |
| 485 | gpio_request(GPIO_FN_MMCD0_6_PU, NULL); |
| 486 | gpio_request(GPIO_FN_MMCD0_7_PU, NULL); |
| 487 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 488 | /* enable SD */ |
| 489 | gpio_request(GPIO_FN_SDHIWP0, NULL); |
| 490 | gpio_request(GPIO_FN_SDHICD0, NULL); |
| 491 | gpio_request(GPIO_FN_SDHICMD0, NULL); |
| 492 | gpio_request(GPIO_FN_SDHICLK0, NULL); |
| 493 | gpio_request(GPIO_FN_SDHID0_3, NULL); |
| 494 | gpio_request(GPIO_FN_SDHID0_2, NULL); |
| 495 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
| 496 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
| 497 | gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL); |
| 498 | gpio_request(GPIO_PORT15, NULL); |
| 499 | gpio_direction_output(GPIO_PORT15, 1); /* power */ |
| 500 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 501 | /* I2C 3 */ |
| 502 | gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL); |
| 503 | gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL); |
| 504 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 505 | /* enable FSI2 port A (ak4648) */ |
| 506 | gpio_request(GPIO_FN_FSIACK, NULL); |
| 507 | gpio_request(GPIO_FN_FSIAILR, NULL); |
| 508 | gpio_request(GPIO_FN_FSIAIBT, NULL); |
| 509 | gpio_request(GPIO_FN_FSIAISLD, NULL); |
| 510 | gpio_request(GPIO_FN_FSIAOSLD, NULL); |
| 511 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 512 | #ifdef CONFIG_CACHE_L2X0 |
| 513 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ |
| 514 | l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); |
| 515 | #endif |
| 516 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame^] | 517 | i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 518 | i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices)); |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 519 | i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 520 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 521 | sh73a0_add_standard_devices(); |
| 522 | platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); |
| 523 | } |
| 524 | |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 525 | static const char *kzm9g_boards_compat_dt[] __initdata = { |
| 526 | "renesas,kzm9g", |
| 527 | NULL, |
| 528 | }; |
| 529 | |
| 530 | DT_MACHINE_START(KZM9G_DT, "kzm9g") |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 531 | .map_io = sh73a0_map_io, |
| 532 | .init_early = sh73a0_add_early_devices, |
| 533 | .nr_irqs = NR_IRQS_LEGACY, |
| 534 | .init_irq = sh73a0_init_irq, |
| 535 | .handle_irq = gic_handle_irq, |
| 536 | .init_machine = kzm_init, |
| 537 | .timer = &shmobile_timer, |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 538 | .dt_compat = kzm9g_boards_compat_dt, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 539 | MACHINE_END |