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> |
Rob Herring | 520f7bd | 2012-12-27 13:10:24 -0600 | [diff] [blame] | 28 | #include <linux/irqchip/arm-gic.h> |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 29 | #include <linux/mmc/host.h> |
| 30 | #include <linux/mmc/sh_mmcif.h> |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 31 | #include <linux/mmc/sh_mobile_sdhi.h> |
| 32 | #include <linux/mfd/tmio.h> |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 33 | #include <linux/pinctrl/machine.h> |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 34 | #include <linux/pinctrl/pinconf-generic.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 35 | #include <linux/platform_device.h> |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 36 | #include <linux/regulator/fixed.h> |
| 37 | #include <linux/regulator/machine.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 38 | #include <linux/smsc911x.h> |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 39 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 40 | #include <linux/usb/renesas_usbhs.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 41 | #include <linux/videodev2.h> |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 42 | #include <sound/sh_fsi.h> |
| 43 | #include <sound/simple_card.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 44 | #include <mach/irqs.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 45 | #include <mach/sh73a0.h> |
| 46 | #include <mach/common.h> |
| 47 | #include <asm/hardware/cache-l2x0.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 48 | #include <asm/mach-types.h> |
| 49 | #include <asm/mach/arch.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 50 | #include <video/sh_mobile_lcdc.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 51 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 52 | /* |
| 53 | * external GPIO |
| 54 | */ |
| 55 | #define GPIO_PCF8575_BASE (GPIO_NR) |
| 56 | #define GPIO_PCF8575_PORT10 (GPIO_NR + 8) |
| 57 | #define GPIO_PCF8575_PORT11 (GPIO_NR + 9) |
| 58 | #define GPIO_PCF8575_PORT12 (GPIO_NR + 10) |
| 59 | #define GPIO_PCF8575_PORT13 (GPIO_NR + 11) |
| 60 | #define GPIO_PCF8575_PORT14 (GPIO_NR + 12) |
| 61 | #define GPIO_PCF8575_PORT15 (GPIO_NR + 13) |
| 62 | #define GPIO_PCF8575_PORT16 (GPIO_NR + 14) |
| 63 | |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 64 | /* Dummy supplies, where voltage doesn't matter */ |
| 65 | static struct regulator_consumer_supply dummy_supplies[] = { |
| 66 | REGULATOR_SUPPLY("vddvario", "smsc911x"), |
| 67 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), |
| 68 | }; |
| 69 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 70 | /* |
| 71 | * FSI-AK4648 |
| 72 | * |
| 73 | * this command is required when playback. |
| 74 | * |
| 75 | * # amixer set "LINEOUT Mixer DACL" on |
| 76 | */ |
| 77 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 78 | /* SMSC 9221 */ |
| 79 | static struct resource smsc9221_resources[] = { |
| 80 | [0] = { |
| 81 | .start = 0x10000000, /* CS4 */ |
| 82 | .end = 0x100000ff, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | }, |
| 85 | [1] = { |
| 86 | .start = intcs_evt2irq(0x260), /* IRQ3 */ |
| 87 | .flags = IORESOURCE_IRQ, |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | static struct smsc911x_platform_config smsc9221_platdata = { |
| 92 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 93 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 94 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 95 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 96 | }; |
| 97 | |
| 98 | static struct platform_device smsc_device = { |
| 99 | .name = "smsc911x", |
| 100 | .dev = { |
| 101 | .platform_data = &smsc9221_platdata, |
| 102 | }, |
| 103 | .resource = smsc9221_resources, |
| 104 | .num_resources = ARRAY_SIZE(smsc9221_resources), |
| 105 | }; |
| 106 | |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 107 | /* USB external chip */ |
| 108 | static struct r8a66597_platdata usb_host_data = { |
| 109 | .on_chip = 0, |
| 110 | .xtal = R8A66597_PLATDATA_XTAL_48MHZ, |
| 111 | }; |
| 112 | |
| 113 | static struct resource usb_resources[] = { |
| 114 | [0] = { |
| 115 | .start = 0x10010000, |
| 116 | .end = 0x1001ffff - 1, |
| 117 | .flags = IORESOURCE_MEM, |
| 118 | }, |
| 119 | [1] = { |
| 120 | .start = intcs_evt2irq(0x220), /* IRQ1 */ |
| 121 | .flags = IORESOURCE_IRQ, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct platform_device usb_host_device = { |
| 126 | .name = "r8a66597_hcd", |
| 127 | .dev = { |
| 128 | .platform_data = &usb_host_data, |
| 129 | .dma_mask = NULL, |
| 130 | .coherent_dma_mask = 0xffffffff, |
| 131 | }, |
| 132 | .num_resources = ARRAY_SIZE(usb_resources), |
| 133 | .resource = usb_resources, |
| 134 | }; |
| 135 | |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 136 | /* USB Func CN17 */ |
| 137 | struct usbhs_private { |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 138 | void __iomem *phy; |
| 139 | void __iomem *cr2; |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 140 | struct renesas_usbhs_platform_info info; |
| 141 | }; |
| 142 | |
| 143 | #define IRQ15 intcs_evt2irq(0x03e0) |
| 144 | #define USB_PHY_MODE (1 << 4) |
| 145 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) |
| 146 | #define USB_PHY_ON (1 << 1) |
| 147 | #define USB_PHY_OFF (1 << 0) |
| 148 | #define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF) |
| 149 | |
| 150 | #define usbhs_get_priv(pdev) \ |
| 151 | container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info) |
| 152 | |
| 153 | static int usbhs_get_vbus(struct platform_device *pdev) |
| 154 | { |
| 155 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 156 | |
| 157 | return !((1 << 7) & __raw_readw(priv->cr2)); |
| 158 | } |
| 159 | |
| 160 | static void usbhs_phy_reset(struct platform_device *pdev) |
| 161 | { |
| 162 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 163 | |
| 164 | /* init phy */ |
| 165 | __raw_writew(0x8a0a, priv->cr2); |
| 166 | } |
| 167 | |
| 168 | static int usbhs_get_id(struct platform_device *pdev) |
| 169 | { |
| 170 | return USBHS_GADGET; |
| 171 | } |
| 172 | |
| 173 | static irqreturn_t usbhs_interrupt(int irq, void *data) |
| 174 | { |
| 175 | struct platform_device *pdev = data; |
| 176 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 177 | |
| 178 | renesas_usbhs_call_notify_hotplug(pdev); |
| 179 | |
| 180 | /* clear status */ |
| 181 | __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy); |
| 182 | |
| 183 | return IRQ_HANDLED; |
| 184 | } |
| 185 | |
| 186 | static int usbhs_hardware_init(struct platform_device *pdev) |
| 187 | { |
| 188 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 189 | int ret; |
| 190 | |
| 191 | /* clear interrupt status */ |
| 192 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy); |
| 193 | |
| 194 | ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH, |
| 195 | dev_name(&pdev->dev), pdev); |
| 196 | if (ret) { |
| 197 | dev_err(&pdev->dev, "request_irq err\n"); |
| 198 | return ret; |
| 199 | } |
| 200 | |
| 201 | /* enable USB phy interrupt */ |
| 202 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy); |
| 203 | |
| 204 | return 0; |
| 205 | } |
| 206 | |
| 207 | static void usbhs_hardware_exit(struct platform_device *pdev) |
| 208 | { |
| 209 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 210 | |
| 211 | /* clear interrupt status */ |
| 212 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy); |
| 213 | |
| 214 | free_irq(IRQ15, pdev); |
| 215 | } |
| 216 | |
| 217 | static u32 usbhs_pipe_cfg[] = { |
| 218 | USB_ENDPOINT_XFER_CONTROL, |
| 219 | USB_ENDPOINT_XFER_ISOC, |
| 220 | USB_ENDPOINT_XFER_ISOC, |
| 221 | USB_ENDPOINT_XFER_BULK, |
| 222 | USB_ENDPOINT_XFER_BULK, |
| 223 | USB_ENDPOINT_XFER_BULK, |
| 224 | USB_ENDPOINT_XFER_INT, |
| 225 | USB_ENDPOINT_XFER_INT, |
| 226 | USB_ENDPOINT_XFER_INT, |
| 227 | USB_ENDPOINT_XFER_BULK, |
| 228 | USB_ENDPOINT_XFER_BULK, |
| 229 | USB_ENDPOINT_XFER_BULK, |
| 230 | USB_ENDPOINT_XFER_BULK, |
| 231 | USB_ENDPOINT_XFER_BULK, |
| 232 | USB_ENDPOINT_XFER_BULK, |
| 233 | USB_ENDPOINT_XFER_BULK, |
| 234 | }; |
| 235 | |
| 236 | static struct usbhs_private usbhs_private = { |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 237 | .phy = IOMEM(0xe60781e0), /* USBPHYINT */ |
| 238 | .cr2 = IOMEM(0xe605810c), /* USBCR2 */ |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 239 | .info = { |
| 240 | .platform_callback = { |
| 241 | .hardware_init = usbhs_hardware_init, |
| 242 | .hardware_exit = usbhs_hardware_exit, |
| 243 | .get_id = usbhs_get_id, |
| 244 | .phy_reset = usbhs_phy_reset, |
| 245 | .get_vbus = usbhs_get_vbus, |
| 246 | }, |
| 247 | .driver_param = { |
| 248 | .buswait_bwait = 4, |
| 249 | .has_otg = 1, |
| 250 | .pipe_type = usbhs_pipe_cfg, |
| 251 | .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg), |
| 252 | }, |
| 253 | }, |
| 254 | }; |
| 255 | |
| 256 | static struct resource usbhs_resources[] = { |
| 257 | [0] = { |
| 258 | .start = 0xE6890000, |
| 259 | .end = 0xE68900e6 - 1, |
| 260 | .flags = IORESOURCE_MEM, |
| 261 | }, |
| 262 | [1] = { |
| 263 | .start = gic_spi(62), |
| 264 | .end = gic_spi(62), |
| 265 | .flags = IORESOURCE_IRQ, |
| 266 | }, |
| 267 | }; |
| 268 | |
| 269 | static struct platform_device usbhs_device = { |
| 270 | .name = "renesas_usbhs", |
| 271 | .id = -1, |
| 272 | .dev = { |
| 273 | .dma_mask = NULL, |
| 274 | .coherent_dma_mask = 0xffffffff, |
| 275 | .platform_data = &usbhs_private.info, |
| 276 | }, |
| 277 | .num_resources = ARRAY_SIZE(usbhs_resources), |
| 278 | .resource = usbhs_resources, |
| 279 | }; |
| 280 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 281 | /* LCDC */ |
| 282 | static struct fb_videomode kzm_lcdc_mode = { |
| 283 | .name = "WVGA Panel", |
| 284 | .xres = 800, |
| 285 | .yres = 480, |
| 286 | .left_margin = 220, |
| 287 | .right_margin = 110, |
| 288 | .hsync_len = 70, |
| 289 | .upper_margin = 20, |
| 290 | .lower_margin = 5, |
| 291 | .vsync_len = 5, |
| 292 | .sync = 0, |
| 293 | }; |
| 294 | |
| 295 | static struct sh_mobile_lcdc_info lcdc_info = { |
| 296 | .clock_source = LCDC_CLK_BUS, |
| 297 | .ch[0] = { |
| 298 | .chan = LCDC_CHAN_MAINLCD, |
| 299 | .fourcc = V4L2_PIX_FMT_RGB565, |
| 300 | .interface_type = RGB24, |
| 301 | .lcd_modes = &kzm_lcdc_mode, |
| 302 | .num_modes = 1, |
| 303 | .clock_divider = 5, |
| 304 | .flags = 0, |
| 305 | .panel_cfg = { |
| 306 | .width = 152, |
| 307 | .height = 91, |
| 308 | }, |
| 309 | } |
| 310 | }; |
| 311 | |
| 312 | static struct resource lcdc_resources[] = { |
| 313 | [0] = { |
| 314 | .name = "LCDC", |
| 315 | .start = 0xfe940000, |
| 316 | .end = 0xfe943fff, |
| 317 | .flags = IORESOURCE_MEM, |
| 318 | }, |
| 319 | [1] = { |
| 320 | .start = intcs_evt2irq(0x580), |
| 321 | .flags = IORESOURCE_IRQ, |
| 322 | }, |
| 323 | }; |
| 324 | |
| 325 | static struct platform_device lcdc_device = { |
| 326 | .name = "sh_mobile_lcdc_fb", |
| 327 | .num_resources = ARRAY_SIZE(lcdc_resources), |
| 328 | .resource = lcdc_resources, |
| 329 | .dev = { |
| 330 | .platform_data = &lcdc_info, |
| 331 | .coherent_dma_mask = ~0, |
| 332 | }, |
| 333 | }; |
| 334 | |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 335 | /* Fixed 1.8V regulator to be used by MMCIF */ |
| 336 | static struct regulator_consumer_supply fixed1v8_power_consumers[] = |
| 337 | { |
| 338 | REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), |
| 339 | REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"), |
| 340 | }; |
| 341 | |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 342 | /* MMCIF */ |
| 343 | static struct resource sh_mmcif_resources[] = { |
| 344 | [0] = { |
| 345 | .name = "MMCIF", |
| 346 | .start = 0xe6bd0000, |
| 347 | .end = 0xe6bd00ff, |
| 348 | .flags = IORESOURCE_MEM, |
| 349 | }, |
| 350 | [1] = { |
Tetsuyuki Kobayashi | a704835 | 2012-09-06 07:19:36 +0000 | [diff] [blame] | 351 | .start = gic_spi(140), |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 352 | .flags = IORESOURCE_IRQ, |
| 353 | }, |
| 354 | [2] = { |
Tetsuyuki Kobayashi | a704835 | 2012-09-06 07:19:36 +0000 | [diff] [blame] | 355 | .start = gic_spi(141), |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 356 | .flags = IORESOURCE_IRQ, |
| 357 | }, |
| 358 | }; |
| 359 | |
| 360 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
| 361 | .ocr = MMC_VDD_165_195, |
| 362 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
Kuninori Morimoto | a1ca8f4 | 2012-06-25 03:39:39 -0700 | [diff] [blame] | 363 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, |
| 364 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 365 | }; |
| 366 | |
| 367 | static struct platform_device mmc_device = { |
| 368 | .name = "sh_mmcif", |
| 369 | .dev = { |
| 370 | .dma_mask = NULL, |
| 371 | .coherent_dma_mask = 0xffffffff, |
| 372 | .platform_data = &sh_mmcif_platdata, |
| 373 | }, |
| 374 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), |
| 375 | .resource = sh_mmcif_resources, |
| 376 | }; |
| 377 | |
Guennadi Liakhovetski | 11b8e45 | 2012-07-01 01:12:04 +0200 | [diff] [blame] | 378 | /* Fixed 2.8V regulators to be used by SDHI0 and SDHI2 */ |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 379 | static struct regulator_consumer_supply fixed2v8_power_consumers[] = |
| 380 | { |
| 381 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), |
| 382 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), |
Guennadi Liakhovetski | 11b8e45 | 2012-07-01 01:12:04 +0200 | [diff] [blame] | 383 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"), |
| 384 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"), |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 385 | }; |
| 386 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 387 | /* SDHI */ |
| 388 | static struct sh_mobile_sdhi_info sdhi0_info = { |
Tetsuyuki Kobayashi | bd9e2e7 | 2012-09-06 09:09:31 +0000 | [diff] [blame] | 389 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
| 390 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 391 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, |
| 392 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
| 393 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 394 | }; |
| 395 | |
| 396 | static struct resource sdhi0_resources[] = { |
| 397 | [0] = { |
| 398 | .name = "SDHI0", |
| 399 | .start = 0xee100000, |
| 400 | .end = 0xee1000ff, |
| 401 | .flags = IORESOURCE_MEM, |
| 402 | }, |
| 403 | [1] = { |
| 404 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
| 405 | .start = gic_spi(83), |
| 406 | .flags = IORESOURCE_IRQ, |
| 407 | }, |
| 408 | [2] = { |
| 409 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
| 410 | .start = gic_spi(84), |
| 411 | .flags = IORESOURCE_IRQ, |
| 412 | }, |
| 413 | [3] = { |
| 414 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
| 415 | .start = gic_spi(85), |
| 416 | .flags = IORESOURCE_IRQ, |
| 417 | }, |
| 418 | }; |
| 419 | |
| 420 | static struct platform_device sdhi0_device = { |
| 421 | .name = "sh_mobile_sdhi", |
| 422 | .num_resources = ARRAY_SIZE(sdhi0_resources), |
| 423 | .resource = sdhi0_resources, |
| 424 | .dev = { |
| 425 | .platform_data = &sdhi0_info, |
| 426 | }, |
| 427 | }; |
| 428 | |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 429 | /* Micro SD */ |
| 430 | static struct sh_mobile_sdhi_info sdhi2_info = { |
Tetsuyuki Kobayashi | bd9e2e7 | 2012-09-06 09:09:31 +0000 | [diff] [blame] | 431 | .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, |
| 432 | .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 433 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | |
| 434 | TMIO_MMC_USE_GPIO_CD | |
| 435 | TMIO_MMC_WRPROTECT_DISABLE, |
| 436 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
| 437 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 438 | .cd_gpio = 13, |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
| 441 | static struct resource sdhi2_resources[] = { |
| 442 | [0] = { |
| 443 | .name = "SDHI2", |
| 444 | .start = 0xee140000, |
| 445 | .end = 0xee1400ff, |
| 446 | .flags = IORESOURCE_MEM, |
| 447 | }, |
| 448 | [1] = { |
| 449 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
| 450 | .start = gic_spi(103), |
| 451 | .flags = IORESOURCE_IRQ, |
| 452 | }, |
| 453 | [2] = { |
| 454 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
| 455 | .start = gic_spi(104), |
| 456 | .flags = IORESOURCE_IRQ, |
| 457 | }, |
| 458 | [3] = { |
| 459 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
| 460 | .start = gic_spi(105), |
| 461 | .flags = IORESOURCE_IRQ, |
| 462 | }, |
| 463 | }; |
| 464 | |
| 465 | static struct platform_device sdhi2_device = { |
| 466 | .name = "sh_mobile_sdhi", |
| 467 | .id = 2, |
| 468 | .num_resources = ARRAY_SIZE(sdhi2_resources), |
| 469 | .resource = sdhi2_resources, |
| 470 | .dev = { |
| 471 | .platform_data = &sdhi2_info, |
| 472 | }, |
| 473 | }; |
| 474 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 475 | /* KEY */ |
| 476 | #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } |
| 477 | |
| 478 | static struct gpio_keys_button gpio_buttons[] = { |
| 479 | GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"), |
| 480 | GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"), |
| 481 | GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"), |
| 482 | GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"), |
| 483 | GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"), |
| 484 | GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"), |
| 485 | GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"), |
| 486 | }; |
| 487 | |
| 488 | static struct gpio_keys_platform_data gpio_key_info = { |
| 489 | .buttons = gpio_buttons, |
| 490 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 491 | }; |
| 492 | |
| 493 | static struct platform_device gpio_keys_device = { |
Kuninori Morimoto | ee6691d | 2012-09-11 14:26:05 +0900 | [diff] [blame] | 494 | .name = "gpio-keys", |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 495 | .dev = { |
| 496 | .platform_data = &gpio_key_info, |
| 497 | }, |
| 498 | }; |
| 499 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 500 | /* FSI-AK4648 */ |
| 501 | static struct sh_fsi_platform_info fsi_info = { |
| 502 | .port_a = { |
Kuninori Morimoto | 76b8032 | 2012-06-25 03:39:30 -0700 | [diff] [blame] | 503 | .tx_id = SHDMA_SLAVE_FSI2A_TX, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 504 | }, |
| 505 | }; |
| 506 | |
| 507 | static struct resource fsi_resources[] = { |
| 508 | [0] = { |
| 509 | .name = "FSI", |
| 510 | .start = 0xEC230000, |
| 511 | .end = 0xEC230400 - 1, |
| 512 | .flags = IORESOURCE_MEM, |
| 513 | }, |
| 514 | [1] = { |
| 515 | .start = gic_spi(146), |
| 516 | .flags = IORESOURCE_IRQ, |
| 517 | }, |
| 518 | }; |
| 519 | |
| 520 | static struct platform_device fsi_device = { |
| 521 | .name = "sh_fsi2", |
| 522 | .id = -1, |
| 523 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 524 | .resource = fsi_resources, |
| 525 | .dev = { |
| 526 | .platform_data = &fsi_info, |
| 527 | }, |
| 528 | }; |
| 529 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 530 | static struct asoc_simple_card_info fsi2_ak4648_info = { |
| 531 | .name = "AK4648", |
| 532 | .card = "FSI2A-AK4648", |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 533 | .codec = "ak4642-codec.0-0012", |
| 534 | .platform = "sh_fsi2", |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 535 | .daifmt = SND_SOC_DAIFMT_LEFT_J, |
| 536 | .cpu_dai = { |
| 537 | .name = "fsia-dai", |
| 538 | .fmt = SND_SOC_DAIFMT_CBS_CFS, |
| 539 | }, |
| 540 | .codec_dai = { |
| 541 | .name = "ak4642-hifi", |
| 542 | .fmt = SND_SOC_DAIFMT_CBM_CFM, |
| 543 | .sysclk = 11289600, |
| 544 | }, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 545 | }; |
| 546 | |
| 547 | static struct platform_device fsi_ak4648_device = { |
| 548 | .name = "asoc-simple-card", |
| 549 | .dev = { |
| 550 | .platform_data = &fsi2_ak4648_info, |
| 551 | }, |
| 552 | }; |
| 553 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 554 | /* I2C */ |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 555 | static struct pcf857x_platform_data pcf8575_pdata = { |
| 556 | .gpio_base = GPIO_PCF8575_BASE, |
| 557 | }; |
| 558 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 559 | static struct i2c_board_info i2c0_devices[] = { |
| 560 | { |
| 561 | I2C_BOARD_INFO("ak4648", 0x12), |
Tetsuyuki Kobayashi | 080e0d1 | 2012-06-20 12:57:51 +0200 | [diff] [blame] | 562 | }, |
| 563 | { |
| 564 | I2C_BOARD_INFO("r2025sd", 0x32), |
Tetsuyuki Kobayashi | 8cec012 | 2012-09-14 18:14:28 +0900 | [diff] [blame] | 565 | }, |
| 566 | { |
| 567 | I2C_BOARD_INFO("ak8975", 0x0c), |
| 568 | .irq = intcs_evt2irq(0x3380), /* IRQ28 */ |
| 569 | }, |
Tetsuyuki Kobayashi | 608c562 | 2012-09-14 18:14:29 +0900 | [diff] [blame] | 570 | { |
| 571 | I2C_BOARD_INFO("adxl34x", 0x1d), |
| 572 | .irq = intcs_evt2irq(0x3340), /* IRQ26 */ |
| 573 | }, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 574 | }; |
| 575 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 576 | static struct i2c_board_info i2c1_devices[] = { |
| 577 | { |
| 578 | I2C_BOARD_INFO("st1232-ts", 0x55), |
| 579 | .irq = intcs_evt2irq(0x300), /* IRQ8 */ |
| 580 | }, |
| 581 | }; |
| 582 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 583 | static struct i2c_board_info i2c3_devices[] = { |
| 584 | { |
| 585 | I2C_BOARD_INFO("pcf8575", 0x20), |
Kuninori Morimoto | 805f864 | 2012-12-06 01:10:28 -0800 | [diff] [blame] | 586 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 587 | .platform_data = &pcf8575_pdata, |
| 588 | }, |
| 589 | }; |
| 590 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 591 | static struct platform_device *kzm_devices[] __initdata = { |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 592 | &smsc_device, |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 593 | &usb_host_device, |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 594 | &usbhs_device, |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 595 | &lcdc_device, |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 596 | &mmc_device, |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 597 | &sdhi0_device, |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 598 | &sdhi2_device, |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 599 | &gpio_keys_device, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 600 | &fsi_device, |
| 601 | &fsi_ak4648_device, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 602 | }; |
| 603 | |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 604 | static unsigned long pin_pullup_conf[] = { |
| 605 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0), |
| 606 | }; |
| 607 | |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 608 | static const struct pinctrl_map kzm_pinctrl_map[] = { |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 609 | /* FSIA (AK4648) */ |
| 610 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", |
| 611 | "fsia_mclk_in", "fsia"), |
| 612 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", |
| 613 | "fsia_sclk_in", "fsia"), |
| 614 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", |
| 615 | "fsia_data_in", "fsia"), |
| 616 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", |
| 617 | "fsia_data_out", "fsia"), |
Laurent Pinchart | 118b673 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 618 | /* I2C3 */ |
| 619 | PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0", |
| 620 | "i2c3_1", "i2c3"), |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 621 | /* LCD */ |
| 622 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0", |
| 623 | "lcd_data24", "lcd"), |
| 624 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0", |
| 625 | "lcd_sync", "lcd"), |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 626 | /* MMCIF */ |
| 627 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 628 | "mmc0_data8_0", "mmc0"), |
| 629 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 630 | "mmc0_ctrl_0", "mmc0"), |
| 631 | PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 632 | "PORT279", pin_pullup_conf), |
| 633 | PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 634 | "mmc0_data8_0", pin_pullup_conf), |
Laurent Pinchart | 5606ed9 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 635 | /* SCIFA4 */ |
| 636 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 637 | "scifa4_data", "scifa4"), |
| 638 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 639 | "scifa4_ctrl", "scifa4"), |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 640 | /* SDHI0 */ |
| 641 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 642 | "sdhi0_data4", "sdhi0"), |
| 643 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 644 | "sdhi0_ctrl", "sdhi0"), |
| 645 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 646 | "sdhi0_cd", "sdhi0"), |
| 647 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 648 | "sdhi0_wp", "sdhi0"), |
| 649 | /* SDHI2 */ |
| 650 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0", |
| 651 | "sdhi2_data4", "sdhi2"), |
| 652 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0", |
| 653 | "sdhi2_ctrl", "sdhi2"), |
Laurent Pinchart | fed94cf | 2013-03-13 03:21:36 +0100 | [diff] [blame] | 654 | /* SMSC */ |
| 655 | PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", |
| 656 | "bsc_cs4", "bsc"), |
Laurent Pinchart | f424386 | 2013-03-13 03:23:50 +0100 | [diff] [blame^] | 657 | /* USB */ |
| 658 | PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0", |
| 659 | "usb_vbus", "usb"), |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 660 | }; |
| 661 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 662 | /* |
| 663 | * FIXME |
| 664 | * |
| 665 | * This is quick hack for enabling LCDC backlight |
| 666 | */ |
| 667 | static int __init as3711_enable_lcdc_backlight(void) |
| 668 | { |
| 669 | struct i2c_adapter *a = i2c_get_adapter(0); |
| 670 | struct i2c_msg msg; |
| 671 | int i, ret; |
| 672 | __u8 magic[] = { |
| 673 | 0x40, 0x2a, |
| 674 | 0x43, 0x3c, |
| 675 | 0x44, 0x3c, |
| 676 | 0x45, 0x3c, |
| 677 | 0x54, 0x03, |
| 678 | 0x51, 0x00, |
| 679 | 0x51, 0x01, |
| 680 | 0xff, 0x00, /* wait */ |
| 681 | 0x43, 0xf0, |
| 682 | 0x44, 0xf0, |
| 683 | 0x45, 0xf0, |
| 684 | }; |
| 685 | |
Laurent Pinchart | cf24450 | 2013-01-09 01:52:42 +0100 | [diff] [blame] | 686 | if (!of_machine_is_compatible("renesas,kzm9g")) |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 687 | return 0; |
| 688 | |
| 689 | if (!a) |
| 690 | return 0; |
| 691 | |
| 692 | msg.addr = 0x40; |
| 693 | msg.len = 2; |
| 694 | msg.flags = 0; |
| 695 | |
| 696 | for (i = 0; i < ARRAY_SIZE(magic); i += 2) { |
| 697 | msg.buf = magic + i; |
| 698 | |
| 699 | if (0xff == msg.buf[0]) { |
| 700 | udelay(500); |
| 701 | continue; |
| 702 | } |
| 703 | |
| 704 | ret = i2c_transfer(a, &msg, 1); |
| 705 | if (ret < 0) { |
| 706 | pr_err("i2c transfer fail\n"); |
| 707 | break; |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | return 0; |
| 712 | } |
| 713 | device_initcall(as3711_enable_lcdc_backlight); |
| 714 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 715 | static void __init kzm_init(void) |
| 716 | { |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 717 | regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, |
| 718 | ARRAY_SIZE(fixed1v8_power_consumers), 1800000); |
| 719 | regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers, |
| 720 | ARRAY_SIZE(fixed2v8_power_consumers), 2800000); |
| 721 | regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
| 722 | |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 723 | pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map)); |
| 724 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 725 | sh73a0_pinmux_init(); |
| 726 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 727 | /* SMSC */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 728 | gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */ |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 729 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 730 | /* LCDC */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 731 | gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */ |
| 732 | gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */ |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 733 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 734 | /* Touchscreen */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 735 | gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */ |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 736 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 737 | /* enable SD */ |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 738 | gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL); |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 739 | gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */ |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 740 | |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 741 | /* enable Micro SD */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 742 | gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */ |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 743 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 744 | #ifdef CONFIG_CACHE_L2X0 |
| 745 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ |
| 746 | l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); |
| 747 | #endif |
| 748 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 749 | i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 750 | i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices)); |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 751 | i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 752 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 753 | sh73a0_add_standard_devices(); |
| 754 | platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); |
Bastian Hecht | 13baf88 | 2012-12-05 12:13:06 +0000 | [diff] [blame] | 755 | |
| 756 | sh73a0_pm_init(); |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 757 | } |
| 758 | |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 759 | static void kzm9g_restart(char mode, const char *cmd) |
| 760 | { |
Arnd Bergmann | 28901c1 | 2012-09-23 22:41:21 +0000 | [diff] [blame] | 761 | #define RESCNT2 IOMEM(0xe6188020) |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 762 | /* Do soft power on reset */ |
| 763 | writel((1 << 31), RESCNT2); |
| 764 | } |
| 765 | |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 766 | static const char *kzm9g_boards_compat_dt[] __initdata = { |
| 767 | "renesas,kzm9g", |
| 768 | NULL, |
| 769 | }; |
| 770 | |
| 771 | DT_MACHINE_START(KZM9G_DT, "kzm9g") |
Marc Zyngier | a62580e | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 772 | .smp = smp_ops(sh73a0_smp_ops), |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 773 | .map_io = sh73a0_map_io, |
| 774 | .init_early = sh73a0_add_early_devices, |
| 775 | .nr_irqs = NR_IRQS_LEGACY, |
| 776 | .init_irq = sh73a0_init_irq, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 777 | .init_machine = kzm_init, |
Kuninori Morimoto | 14dd52f | 2012-06-20 22:40:08 -0700 | [diff] [blame] | 778 | .init_late = shmobile_init_late, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 779 | .init_time = sh73a0_earlytimer_init, |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 780 | .restart = kzm9g_restart, |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 781 | .dt_compat = kzm9g_boards_compat_dt, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 782 | MACHINE_END |