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. |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 14 | */ |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 15 | |
| 16 | #include <linux/delay.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 17 | #include <linux/gpio.h> |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 18 | #include <linux/gpio_keys.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 19 | #include <linux/io.h> |
| 20 | #include <linux/irq.h> |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 21 | #include <linux/i2c.h> |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 22 | #include <linux/i2c/pcf857x.h> |
| 23 | #include <linux/input.h> |
Rob Herring | 520f7bd | 2012-12-27 13:10:24 -0600 | [diff] [blame] | 24 | #include <linux/irqchip/arm-gic.h> |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 25 | #include <linux/mmc/host.h> |
| 26 | #include <linux/mmc/sh_mmcif.h> |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 27 | #include <linux/mmc/sh_mobile_sdhi.h> |
Guennadi Liakhovetski | 28307e0 | 2013-02-12 17:15:31 +0000 | [diff] [blame] | 28 | #include <linux/mfd/as3711.h> |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 29 | #include <linux/mfd/tmio.h> |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 30 | #include <linux/pinctrl/machine.h> |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 31 | #include <linux/pinctrl/pinconf-generic.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 32 | #include <linux/platform_device.h> |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 33 | #include <linux/reboot.h> |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 34 | #include <linux/regulator/fixed.h> |
| 35 | #include <linux/regulator/machine.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 36 | #include <linux/smsc911x.h> |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 37 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 38 | #include <linux/usb/renesas_usbhs.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 39 | #include <linux/videodev2.h> |
Geert Uytterhoeven | ded59d6 | 2014-06-20 18:53:09 +0200 | [diff] [blame] | 40 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 41 | #include <sound/sh_fsi.h> |
| 42 | #include <sound/simple_card.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 43 | #include <asm/hardware/cache-l2x0.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 44 | #include <asm/mach-types.h> |
| 45 | #include <asm/mach/arch.h> |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 46 | #include <video/sh_mobile_lcdc.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 47 | |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 48 | #include "common.h" |
Geert Uytterhoeven | 86155b3 | 2014-08-20 15:39:23 +0200 | [diff] [blame] | 49 | #include "intc.h" |
Magnus Damm | b6bab12 | 2014-06-17 16:47:29 +0900 | [diff] [blame] | 50 | #include "irqs.h" |
Geert Uytterhoeven | ded59d6 | 2014-06-20 18:53:09 +0200 | [diff] [blame] | 51 | #include "sh73a0.h" |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 52 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 53 | /* |
| 54 | * external GPIO |
| 55 | */ |
Laurent Pinchart | 282b583 | 2013-07-29 21:33:54 +0200 | [diff] [blame] | 56 | #define GPIO_PCF8575_BASE (310) |
| 57 | #define GPIO_PCF8575_PORT10 (GPIO_PCF8575_BASE + 8) |
| 58 | #define GPIO_PCF8575_PORT11 (GPIO_PCF8575_BASE + 9) |
| 59 | #define GPIO_PCF8575_PORT12 (GPIO_PCF8575_BASE + 10) |
| 60 | #define GPIO_PCF8575_PORT13 (GPIO_PCF8575_BASE + 11) |
| 61 | #define GPIO_PCF8575_PORT14 (GPIO_PCF8575_BASE + 12) |
| 62 | #define GPIO_PCF8575_PORT15 (GPIO_PCF8575_BASE + 13) |
| 63 | #define GPIO_PCF8575_PORT16 (GPIO_PCF8575_BASE + 14) |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 64 | |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 65 | /* Dummy supplies, where voltage doesn't matter */ |
| 66 | static struct regulator_consumer_supply dummy_supplies[] = { |
Simon Horman | 48296a1 | 2013-02-15 22:48:36 +0900 | [diff] [blame] | 67 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), |
| 68 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 69 | }; |
| 70 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 71 | /* |
| 72 | * FSI-AK4648 |
| 73 | * |
| 74 | * this command is required when playback. |
| 75 | * |
| 76 | * # amixer set "LINEOUT Mixer DACL" on |
| 77 | */ |
| 78 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 79 | /* SMSC 9221 */ |
| 80 | static struct resource smsc9221_resources[] = { |
| 81 | [0] = { |
| 82 | .start = 0x10000000, /* CS4 */ |
| 83 | .end = 0x100000ff, |
| 84 | .flags = IORESOURCE_MEM, |
| 85 | }, |
| 86 | [1] = { |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 87 | .start = irq_pin(3), /* IRQ3 */ |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 88 | .flags = IORESOURCE_IRQ, |
| 89 | }, |
| 90 | }; |
| 91 | |
| 92 | static struct smsc911x_platform_config smsc9221_platdata = { |
| 93 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 94 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 95 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 96 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 97 | }; |
| 98 | |
| 99 | static struct platform_device smsc_device = { |
| 100 | .name = "smsc911x", |
| 101 | .dev = { |
| 102 | .platform_data = &smsc9221_platdata, |
| 103 | }, |
| 104 | .resource = smsc9221_resources, |
| 105 | .num_resources = ARRAY_SIZE(smsc9221_resources), |
| 106 | }; |
| 107 | |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 108 | /* USB external chip */ |
| 109 | static struct r8a66597_platdata usb_host_data = { |
| 110 | .on_chip = 0, |
| 111 | .xtal = R8A66597_PLATDATA_XTAL_48MHZ, |
| 112 | }; |
| 113 | |
| 114 | static struct resource usb_resources[] = { |
| 115 | [0] = { |
| 116 | .start = 0x10010000, |
| 117 | .end = 0x1001ffff - 1, |
| 118 | .flags = IORESOURCE_MEM, |
| 119 | }, |
| 120 | [1] = { |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 121 | .start = irq_pin(1), /* IRQ1 */ |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 122 | .flags = IORESOURCE_IRQ, |
| 123 | }, |
| 124 | }; |
| 125 | |
| 126 | static struct platform_device usb_host_device = { |
| 127 | .name = "r8a66597_hcd", |
| 128 | .dev = { |
| 129 | .platform_data = &usb_host_data, |
| 130 | .dma_mask = NULL, |
| 131 | .coherent_dma_mask = 0xffffffff, |
| 132 | }, |
| 133 | .num_resources = ARRAY_SIZE(usb_resources), |
| 134 | .resource = usb_resources, |
| 135 | }; |
| 136 | |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 137 | /* USB Func CN17 */ |
| 138 | struct usbhs_private { |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 139 | void __iomem *phy; |
| 140 | void __iomem *cr2; |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 141 | struct renesas_usbhs_platform_info info; |
| 142 | }; |
| 143 | |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 144 | #define IRQ15 irq_pin(15) |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 145 | #define USB_PHY_MODE (1 << 4) |
| 146 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) |
| 147 | #define USB_PHY_ON (1 << 1) |
| 148 | #define USB_PHY_OFF (1 << 0) |
| 149 | #define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF) |
| 150 | |
| 151 | #define usbhs_get_priv(pdev) \ |
| 152 | container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info) |
| 153 | |
| 154 | static int usbhs_get_vbus(struct platform_device *pdev) |
| 155 | { |
| 156 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 157 | |
| 158 | return !((1 << 7) & __raw_readw(priv->cr2)); |
| 159 | } |
| 160 | |
Kuninori Morimoto | 225da3e | 2013-03-31 18:34:43 -0700 | [diff] [blame] | 161 | static int usbhs_phy_reset(struct platform_device *pdev) |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 162 | { |
| 163 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 164 | |
| 165 | /* init phy */ |
| 166 | __raw_writew(0x8a0a, priv->cr2); |
Kuninori Morimoto | 225da3e | 2013-03-31 18:34:43 -0700 | [diff] [blame] | 167 | |
| 168 | return 0; |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | static int usbhs_get_id(struct platform_device *pdev) |
| 172 | { |
| 173 | return USBHS_GADGET; |
| 174 | } |
| 175 | |
| 176 | static irqreturn_t usbhs_interrupt(int irq, void *data) |
| 177 | { |
| 178 | struct platform_device *pdev = data; |
| 179 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 180 | |
| 181 | renesas_usbhs_call_notify_hotplug(pdev); |
| 182 | |
| 183 | /* clear status */ |
| 184 | __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy); |
| 185 | |
| 186 | return IRQ_HANDLED; |
| 187 | } |
| 188 | |
| 189 | static int usbhs_hardware_init(struct platform_device *pdev) |
| 190 | { |
| 191 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 192 | int ret; |
| 193 | |
| 194 | /* clear interrupt status */ |
| 195 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy); |
| 196 | |
| 197 | ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH, |
| 198 | dev_name(&pdev->dev), pdev); |
| 199 | if (ret) { |
| 200 | dev_err(&pdev->dev, "request_irq err\n"); |
| 201 | return ret; |
| 202 | } |
| 203 | |
| 204 | /* enable USB phy interrupt */ |
| 205 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy); |
| 206 | |
| 207 | return 0; |
| 208 | } |
| 209 | |
Kuninori Morimoto | 225da3e | 2013-03-31 18:34:43 -0700 | [diff] [blame] | 210 | static int usbhs_hardware_exit(struct platform_device *pdev) |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 211 | { |
| 212 | struct usbhs_private *priv = usbhs_get_priv(pdev); |
| 213 | |
| 214 | /* clear interrupt status */ |
| 215 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy); |
| 216 | |
| 217 | free_irq(IRQ15, pdev); |
Kuninori Morimoto | 225da3e | 2013-03-31 18:34:43 -0700 | [diff] [blame] | 218 | |
| 219 | return 0; |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | static u32 usbhs_pipe_cfg[] = { |
| 223 | USB_ENDPOINT_XFER_CONTROL, |
| 224 | USB_ENDPOINT_XFER_ISOC, |
| 225 | USB_ENDPOINT_XFER_ISOC, |
| 226 | USB_ENDPOINT_XFER_BULK, |
| 227 | USB_ENDPOINT_XFER_BULK, |
| 228 | USB_ENDPOINT_XFER_BULK, |
| 229 | USB_ENDPOINT_XFER_INT, |
| 230 | USB_ENDPOINT_XFER_INT, |
| 231 | USB_ENDPOINT_XFER_INT, |
| 232 | USB_ENDPOINT_XFER_BULK, |
| 233 | USB_ENDPOINT_XFER_BULK, |
| 234 | USB_ENDPOINT_XFER_BULK, |
| 235 | USB_ENDPOINT_XFER_BULK, |
| 236 | USB_ENDPOINT_XFER_BULK, |
| 237 | USB_ENDPOINT_XFER_BULK, |
| 238 | USB_ENDPOINT_XFER_BULK, |
| 239 | }; |
| 240 | |
| 241 | static struct usbhs_private usbhs_private = { |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 242 | .phy = IOMEM(0xe60781e0), /* USBPHYINT */ |
| 243 | .cr2 = IOMEM(0xe605810c), /* USBCR2 */ |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 244 | .info = { |
| 245 | .platform_callback = { |
| 246 | .hardware_init = usbhs_hardware_init, |
| 247 | .hardware_exit = usbhs_hardware_exit, |
| 248 | .get_id = usbhs_get_id, |
| 249 | .phy_reset = usbhs_phy_reset, |
| 250 | .get_vbus = usbhs_get_vbus, |
| 251 | }, |
| 252 | .driver_param = { |
| 253 | .buswait_bwait = 4, |
| 254 | .has_otg = 1, |
| 255 | .pipe_type = usbhs_pipe_cfg, |
| 256 | .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg), |
| 257 | }, |
| 258 | }, |
| 259 | }; |
| 260 | |
| 261 | static struct resource usbhs_resources[] = { |
| 262 | [0] = { |
| 263 | .start = 0xE6890000, |
| 264 | .end = 0xE68900e6 - 1, |
| 265 | .flags = IORESOURCE_MEM, |
| 266 | }, |
| 267 | [1] = { |
| 268 | .start = gic_spi(62), |
| 269 | .end = gic_spi(62), |
| 270 | .flags = IORESOURCE_IRQ, |
| 271 | }, |
| 272 | }; |
| 273 | |
| 274 | static struct platform_device usbhs_device = { |
| 275 | .name = "renesas_usbhs", |
| 276 | .id = -1, |
| 277 | .dev = { |
| 278 | .dma_mask = NULL, |
| 279 | .coherent_dma_mask = 0xffffffff, |
| 280 | .platform_data = &usbhs_private.info, |
| 281 | }, |
| 282 | .num_resources = ARRAY_SIZE(usbhs_resources), |
| 283 | .resource = usbhs_resources, |
| 284 | }; |
| 285 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 286 | /* LCDC */ |
| 287 | static struct fb_videomode kzm_lcdc_mode = { |
| 288 | .name = "WVGA Panel", |
| 289 | .xres = 800, |
| 290 | .yres = 480, |
| 291 | .left_margin = 220, |
| 292 | .right_margin = 110, |
| 293 | .hsync_len = 70, |
| 294 | .upper_margin = 20, |
| 295 | .lower_margin = 5, |
| 296 | .vsync_len = 5, |
| 297 | .sync = 0, |
| 298 | }; |
| 299 | |
| 300 | static struct sh_mobile_lcdc_info lcdc_info = { |
| 301 | .clock_source = LCDC_CLK_BUS, |
| 302 | .ch[0] = { |
| 303 | .chan = LCDC_CHAN_MAINLCD, |
| 304 | .fourcc = V4L2_PIX_FMT_RGB565, |
| 305 | .interface_type = RGB24, |
| 306 | .lcd_modes = &kzm_lcdc_mode, |
| 307 | .num_modes = 1, |
| 308 | .clock_divider = 5, |
| 309 | .flags = 0, |
| 310 | .panel_cfg = { |
| 311 | .width = 152, |
| 312 | .height = 91, |
| 313 | }, |
| 314 | } |
| 315 | }; |
| 316 | |
| 317 | static struct resource lcdc_resources[] = { |
| 318 | [0] = { |
| 319 | .name = "LCDC", |
| 320 | .start = 0xfe940000, |
| 321 | .end = 0xfe943fff, |
| 322 | .flags = IORESOURCE_MEM, |
| 323 | }, |
| 324 | [1] = { |
| 325 | .start = intcs_evt2irq(0x580), |
| 326 | .flags = IORESOURCE_IRQ, |
| 327 | }, |
| 328 | }; |
| 329 | |
| 330 | static struct platform_device lcdc_device = { |
| 331 | .name = "sh_mobile_lcdc_fb", |
| 332 | .num_resources = ARRAY_SIZE(lcdc_resources), |
| 333 | .resource = lcdc_resources, |
| 334 | .dev = { |
| 335 | .platform_data = &lcdc_info, |
Laurent Pinchart | 4f38732 | 2013-12-16 19:16:08 +0100 | [diff] [blame] | 336 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 337 | }, |
| 338 | }; |
| 339 | |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 340 | /* Fixed 1.8V regulator to be used by MMCIF */ |
| 341 | static struct regulator_consumer_supply fixed1v8_power_consumers[] = |
| 342 | { |
| 343 | REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), |
| 344 | REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"), |
| 345 | }; |
| 346 | |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 347 | /* MMCIF */ |
| 348 | static struct resource sh_mmcif_resources[] = { |
| 349 | [0] = { |
| 350 | .name = "MMCIF", |
| 351 | .start = 0xe6bd0000, |
| 352 | .end = 0xe6bd00ff, |
| 353 | .flags = IORESOURCE_MEM, |
| 354 | }, |
| 355 | [1] = { |
Tetsuyuki Kobayashi | a704835 | 2012-09-06 07:19:36 +0000 | [diff] [blame] | 356 | .start = gic_spi(140), |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 357 | .flags = IORESOURCE_IRQ, |
| 358 | }, |
| 359 | [2] = { |
Tetsuyuki Kobayashi | a704835 | 2012-09-06 07:19:36 +0000 | [diff] [blame] | 360 | .start = gic_spi(141), |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 361 | .flags = IORESOURCE_IRQ, |
| 362 | }, |
| 363 | }; |
| 364 | |
| 365 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
| 366 | .ocr = MMC_VDD_165_195, |
| 367 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
Guennadi Liakhovetski | 58d0bbd | 2013-07-10 21:21:15 +0200 | [diff] [blame] | 368 | .ccs_unsupported = true, |
Kuninori Morimoto | a1ca8f4 | 2012-06-25 03:39:39 -0700 | [diff] [blame] | 369 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, |
| 370 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 371 | }; |
| 372 | |
| 373 | static struct platform_device mmc_device = { |
| 374 | .name = "sh_mmcif", |
| 375 | .dev = { |
| 376 | .dma_mask = NULL, |
| 377 | .coherent_dma_mask = 0xffffffff, |
| 378 | .platform_data = &sh_mmcif_platdata, |
| 379 | }, |
| 380 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), |
| 381 | .resource = sh_mmcif_resources, |
| 382 | }; |
| 383 | |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 384 | /* Fixed 3.3V regulators to be used by SDHI0 */ |
| 385 | static struct regulator_consumer_supply vcc_sdhi0_consumers[] = |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 386 | { |
| 387 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 388 | }; |
| 389 | |
| 390 | static struct regulator_init_data vcc_sdhi0_init_data = { |
| 391 | .constraints = { |
| 392 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 393 | }, |
| 394 | .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers), |
| 395 | .consumer_supplies = vcc_sdhi0_consumers, |
| 396 | }; |
| 397 | |
| 398 | static struct fixed_voltage_config vcc_sdhi0_info = { |
| 399 | .supply_name = "SDHI0 Vcc", |
| 400 | .microvolts = 3300000, |
| 401 | .gpio = 15, |
| 402 | .enable_high = 1, |
| 403 | .init_data = &vcc_sdhi0_init_data, |
| 404 | }; |
| 405 | |
| 406 | static struct platform_device vcc_sdhi0 = { |
| 407 | .name = "reg-fixed-voltage", |
| 408 | .id = 0, |
| 409 | .dev = { |
| 410 | .platform_data = &vcc_sdhi0_info, |
| 411 | }, |
| 412 | }; |
| 413 | |
| 414 | /* Fixed 3.3V regulators to be used by SDHI2 */ |
| 415 | static struct regulator_consumer_supply vcc_sdhi2_consumers[] = |
| 416 | { |
Guennadi Liakhovetski | 11b8e45 | 2012-07-01 01:12:04 +0200 | [diff] [blame] | 417 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"), |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 418 | }; |
| 419 | |
| 420 | static struct regulator_init_data vcc_sdhi2_init_data = { |
| 421 | .constraints = { |
| 422 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 423 | }, |
| 424 | .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers), |
| 425 | .consumer_supplies = vcc_sdhi2_consumers, |
| 426 | }; |
| 427 | |
| 428 | static struct fixed_voltage_config vcc_sdhi2_info = { |
| 429 | .supply_name = "SDHI2 Vcc", |
| 430 | .microvolts = 3300000, |
| 431 | .gpio = 14, |
| 432 | .enable_high = 1, |
| 433 | .init_data = &vcc_sdhi2_init_data, |
| 434 | }; |
| 435 | |
| 436 | static struct platform_device vcc_sdhi2 = { |
| 437 | .name = "reg-fixed-voltage", |
| 438 | .id = 1, |
| 439 | .dev = { |
| 440 | .platform_data = &vcc_sdhi2_info, |
| 441 | }, |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 442 | }; |
| 443 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 444 | /* SDHI */ |
Kuninori Morimoto | 84f11d5 | 2015-02-24 02:07:07 +0000 | [diff] [blame] | 445 | static struct tmio_mmc_data sdhi0_info = { |
| 446 | .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX, |
| 447 | .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX, |
| 448 | .flags = TMIO_MMC_HAS_IDLE_WAIT, |
| 449 | .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 450 | MMC_CAP_POWER_OFF_CARD, |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 451 | }; |
| 452 | |
| 453 | static struct resource sdhi0_resources[] = { |
| 454 | [0] = { |
| 455 | .name = "SDHI0", |
| 456 | .start = 0xee100000, |
| 457 | .end = 0xee1000ff, |
| 458 | .flags = IORESOURCE_MEM, |
| 459 | }, |
| 460 | [1] = { |
| 461 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
| 462 | .start = gic_spi(83), |
| 463 | .flags = IORESOURCE_IRQ, |
| 464 | }, |
| 465 | [2] = { |
| 466 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
| 467 | .start = gic_spi(84), |
| 468 | .flags = IORESOURCE_IRQ, |
| 469 | }, |
| 470 | [3] = { |
| 471 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
| 472 | .start = gic_spi(85), |
| 473 | .flags = IORESOURCE_IRQ, |
| 474 | }, |
| 475 | }; |
| 476 | |
| 477 | static struct platform_device sdhi0_device = { |
| 478 | .name = "sh_mobile_sdhi", |
| 479 | .num_resources = ARRAY_SIZE(sdhi0_resources), |
| 480 | .resource = sdhi0_resources, |
| 481 | .dev = { |
| 482 | .platform_data = &sdhi0_info, |
| 483 | }, |
| 484 | }; |
| 485 | |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 486 | /* Micro SD */ |
Kuninori Morimoto | 84f11d5 | 2015-02-24 02:07:07 +0000 | [diff] [blame] | 487 | static struct tmio_mmc_data sdhi2_info = { |
| 488 | .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI2_TX, |
| 489 | .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI2_RX, |
| 490 | .flags = TMIO_MMC_HAS_IDLE_WAIT | |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 491 | TMIO_MMC_USE_GPIO_CD | |
| 492 | TMIO_MMC_WRPROTECT_DISABLE, |
Kuninori Morimoto | 84f11d5 | 2015-02-24 02:07:07 +0000 | [diff] [blame] | 493 | .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD, |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 494 | .cd_gpio = 13, |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 495 | }; |
| 496 | |
| 497 | static struct resource sdhi2_resources[] = { |
| 498 | [0] = { |
| 499 | .name = "SDHI2", |
| 500 | .start = 0xee140000, |
| 501 | .end = 0xee1400ff, |
| 502 | .flags = IORESOURCE_MEM, |
| 503 | }, |
| 504 | [1] = { |
| 505 | .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT, |
| 506 | .start = gic_spi(103), |
| 507 | .flags = IORESOURCE_IRQ, |
| 508 | }, |
| 509 | [2] = { |
| 510 | .name = SH_MOBILE_SDHI_IRQ_SDCARD, |
| 511 | .start = gic_spi(104), |
| 512 | .flags = IORESOURCE_IRQ, |
| 513 | }, |
| 514 | [3] = { |
| 515 | .name = SH_MOBILE_SDHI_IRQ_SDIO, |
| 516 | .start = gic_spi(105), |
| 517 | .flags = IORESOURCE_IRQ, |
| 518 | }, |
| 519 | }; |
| 520 | |
| 521 | static struct platform_device sdhi2_device = { |
| 522 | .name = "sh_mobile_sdhi", |
| 523 | .id = 2, |
| 524 | .num_resources = ARRAY_SIZE(sdhi2_resources), |
| 525 | .resource = sdhi2_resources, |
| 526 | .dev = { |
| 527 | .platform_data = &sdhi2_info, |
| 528 | }, |
| 529 | }; |
| 530 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 531 | /* KEY */ |
| 532 | #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } |
| 533 | |
| 534 | static struct gpio_keys_button gpio_buttons[] = { |
| 535 | GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"), |
| 536 | GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"), |
| 537 | GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"), |
| 538 | GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"), |
| 539 | GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"), |
| 540 | GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"), |
| 541 | GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"), |
| 542 | }; |
| 543 | |
| 544 | static struct gpio_keys_platform_data gpio_key_info = { |
| 545 | .buttons = gpio_buttons, |
| 546 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 547 | }; |
| 548 | |
| 549 | static struct platform_device gpio_keys_device = { |
Kuninori Morimoto | ee6691d | 2012-09-11 14:26:05 +0900 | [diff] [blame] | 550 | .name = "gpio-keys", |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 551 | .dev = { |
| 552 | .platform_data = &gpio_key_info, |
| 553 | }, |
| 554 | }; |
| 555 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 556 | /* FSI-AK4648 */ |
| 557 | static struct sh_fsi_platform_info fsi_info = { |
| 558 | .port_a = { |
Kuninori Morimoto | 76b8032 | 2012-06-25 03:39:30 -0700 | [diff] [blame] | 559 | .tx_id = SHDMA_SLAVE_FSI2A_TX, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 560 | }, |
| 561 | }; |
| 562 | |
| 563 | static struct resource fsi_resources[] = { |
| 564 | [0] = { |
| 565 | .name = "FSI", |
| 566 | .start = 0xEC230000, |
| 567 | .end = 0xEC230400 - 1, |
| 568 | .flags = IORESOURCE_MEM, |
| 569 | }, |
| 570 | [1] = { |
| 571 | .start = gic_spi(146), |
| 572 | .flags = IORESOURCE_IRQ, |
| 573 | }, |
| 574 | }; |
| 575 | |
| 576 | static struct platform_device fsi_device = { |
| 577 | .name = "sh_fsi2", |
| 578 | .id = -1, |
| 579 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 580 | .resource = fsi_resources, |
| 581 | .dev = { |
| 582 | .platform_data = &fsi_info, |
| 583 | }, |
| 584 | }; |
| 585 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 586 | static struct asoc_simple_card_info fsi2_ak4648_info = { |
| 587 | .name = "AK4648", |
| 588 | .card = "FSI2A-AK4648", |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 589 | .codec = "ak4642-codec.0-0012", |
| 590 | .platform = "sh_fsi2", |
Kuninori Morimoto | c7a507e | 2014-03-13 17:56:25 -0700 | [diff] [blame] | 591 | .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM, |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 592 | .cpu_dai = { |
| 593 | .name = "fsia-dai", |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 594 | }, |
| 595 | .codec_dai = { |
| 596 | .name = "ak4642-hifi", |
Kuninori Morimoto | a4a2992 | 2013-01-10 16:49:11 -0800 | [diff] [blame] | 597 | .sysclk = 11289600, |
| 598 | }, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 599 | }; |
| 600 | |
| 601 | static struct platform_device fsi_ak4648_device = { |
| 602 | .name = "asoc-simple-card", |
| 603 | .dev = { |
| 604 | .platform_data = &fsi2_ak4648_info, |
Kuninori Morimoto | ffb83e8 | 2014-06-22 17:55:18 -0700 | [diff] [blame] | 605 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 606 | .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 607 | }, |
| 608 | }; |
| 609 | |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 610 | /* I2C */ |
Guennadi Liakhovetski | 28307e0 | 2013-02-12 17:15:31 +0000 | [diff] [blame] | 611 | |
| 612 | /* StepDown1 is used to supply 1.315V to the CPU */ |
| 613 | static struct regulator_init_data as3711_sd1 = { |
| 614 | .constraints = { |
| 615 | .name = "1.315V CPU", |
| 616 | .boot_on = 1, |
| 617 | .always_on = 1, |
| 618 | .min_uV = 1315000, |
| 619 | .max_uV = 1335000, |
| 620 | }, |
| 621 | }; |
| 622 | |
| 623 | /* StepDown2 is used to supply 1.8V to the CPU and to the board */ |
| 624 | static struct regulator_init_data as3711_sd2 = { |
| 625 | .constraints = { |
| 626 | .name = "1.8V", |
| 627 | .boot_on = 1, |
| 628 | .always_on = 1, |
| 629 | .min_uV = 1800000, |
| 630 | .max_uV = 1800000, |
| 631 | }, |
| 632 | }; |
| 633 | |
| 634 | /* |
| 635 | * StepDown3 is switched in parallel with StepDown2, seems to be off, |
| 636 | * according to read-back pre-set register values |
| 637 | */ |
| 638 | |
| 639 | /* StepDown4 is used to supply 1.215V to the CPU and to the board */ |
| 640 | static struct regulator_init_data as3711_sd4 = { |
| 641 | .constraints = { |
| 642 | .name = "1.215V", |
| 643 | .boot_on = 1, |
| 644 | .always_on = 1, |
| 645 | .min_uV = 1215000, |
| 646 | .max_uV = 1235000, |
| 647 | }, |
| 648 | }; |
| 649 | |
| 650 | /* LDO1 is unused and unconnected */ |
| 651 | |
| 652 | /* LDO2 is used to supply 2.8V to the CPU */ |
| 653 | static struct regulator_init_data as3711_ldo2 = { |
| 654 | .constraints = { |
| 655 | .name = "2.8V CPU", |
| 656 | .boot_on = 1, |
| 657 | .always_on = 1, |
| 658 | .min_uV = 2800000, |
| 659 | .max_uV = 2800000, |
| 660 | }, |
| 661 | }; |
| 662 | |
| 663 | /* LDO3 is used to supply 3.0V to the CPU */ |
| 664 | static struct regulator_init_data as3711_ldo3 = { |
| 665 | .constraints = { |
| 666 | .name = "3.0V CPU", |
| 667 | .boot_on = 1, |
| 668 | .always_on = 1, |
| 669 | .min_uV = 3000000, |
| 670 | .max_uV = 3000000, |
| 671 | }, |
| 672 | }; |
| 673 | |
| 674 | /* LDO4 is used to supply 2.8V to the board */ |
| 675 | static struct regulator_init_data as3711_ldo4 = { |
| 676 | .constraints = { |
| 677 | .name = "2.8V", |
| 678 | .boot_on = 1, |
| 679 | .always_on = 1, |
| 680 | .min_uV = 2800000, |
| 681 | .max_uV = 2800000, |
| 682 | }, |
| 683 | }; |
| 684 | |
| 685 | /* LDO5 is switched parallel to LDO4, also set to 2.8V */ |
| 686 | static struct regulator_init_data as3711_ldo5 = { |
| 687 | .constraints = { |
| 688 | .name = "2.8V #2", |
| 689 | .boot_on = 1, |
| 690 | .always_on = 1, |
| 691 | .min_uV = 2800000, |
| 692 | .max_uV = 2800000, |
| 693 | }, |
| 694 | }; |
| 695 | |
| 696 | /* LDO6 is unused and unconnected */ |
| 697 | |
| 698 | /* LDO7 is used to supply 1.15V to the CPU */ |
| 699 | static struct regulator_init_data as3711_ldo7 = { |
| 700 | .constraints = { |
| 701 | .name = "1.15V CPU", |
| 702 | .boot_on = 1, |
| 703 | .always_on = 1, |
| 704 | .min_uV = 1150000, |
| 705 | .max_uV = 1150000, |
| 706 | }, |
| 707 | }; |
| 708 | |
| 709 | /* LDO8 is switched parallel to LDO7, also set to 1.15V */ |
| 710 | static struct regulator_init_data as3711_ldo8 = { |
| 711 | .constraints = { |
| 712 | .name = "1.15V CPU #2", |
| 713 | .boot_on = 1, |
| 714 | .always_on = 1, |
| 715 | .min_uV = 1150000, |
| 716 | .max_uV = 1150000, |
| 717 | }, |
| 718 | }; |
| 719 | |
| 720 | static struct as3711_platform_data as3711_pdata = { |
| 721 | .regulator = { |
| 722 | .init_data = { |
| 723 | [AS3711_REGULATOR_SD_1] = &as3711_sd1, |
| 724 | [AS3711_REGULATOR_SD_2] = &as3711_sd2, |
| 725 | [AS3711_REGULATOR_SD_4] = &as3711_sd4, |
| 726 | [AS3711_REGULATOR_LDO_2] = &as3711_ldo2, |
| 727 | [AS3711_REGULATOR_LDO_3] = &as3711_ldo3, |
| 728 | [AS3711_REGULATOR_LDO_4] = &as3711_ldo4, |
| 729 | [AS3711_REGULATOR_LDO_5] = &as3711_ldo5, |
| 730 | [AS3711_REGULATOR_LDO_7] = &as3711_ldo7, |
| 731 | [AS3711_REGULATOR_LDO_8] = &as3711_ldo8, |
| 732 | }, |
| 733 | }, |
| 734 | .backlight = { |
| 735 | .su2_fb = "sh_mobile_lcdc_fb.0", |
| 736 | .su2_max_uA = 36000, |
| 737 | .su2_feedback = AS3711_SU2_CURR_AUTO, |
| 738 | .su2_fbprot = AS3711_SU2_GPIO4, |
| 739 | .su2_auto_curr1 = true, |
| 740 | .su2_auto_curr2 = true, |
| 741 | .su2_auto_curr3 = true, |
| 742 | }, |
| 743 | }; |
| 744 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 745 | static struct pcf857x_platform_data pcf8575_pdata = { |
| 746 | .gpio_base = GPIO_PCF8575_BASE, |
| 747 | }; |
| 748 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 749 | static struct i2c_board_info i2c0_devices[] = { |
| 750 | { |
| 751 | I2C_BOARD_INFO("ak4648", 0x12), |
Tetsuyuki Kobayashi | 080e0d1 | 2012-06-20 12:57:51 +0200 | [diff] [blame] | 752 | }, |
| 753 | { |
| 754 | I2C_BOARD_INFO("r2025sd", 0x32), |
Tetsuyuki Kobayashi | 8cec012 | 2012-09-14 18:14:28 +0900 | [diff] [blame] | 755 | }, |
| 756 | { |
| 757 | I2C_BOARD_INFO("ak8975", 0x0c), |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 758 | .irq = irq_pin(28), /* IRQ28 */ |
Tetsuyuki Kobayashi | 8cec012 | 2012-09-14 18:14:28 +0900 | [diff] [blame] | 759 | }, |
Tetsuyuki Kobayashi | 608c562 | 2012-09-14 18:14:29 +0900 | [diff] [blame] | 760 | { |
| 761 | I2C_BOARD_INFO("adxl34x", 0x1d), |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 762 | .irq = irq_pin(26), /* IRQ26 */ |
Tetsuyuki Kobayashi | 608c562 | 2012-09-14 18:14:29 +0900 | [diff] [blame] | 763 | }, |
Guennadi Liakhovetski | 28307e0 | 2013-02-12 17:15:31 +0000 | [diff] [blame] | 764 | { |
| 765 | I2C_BOARD_INFO("as3711", 0x40), |
| 766 | .irq = intcs_evt2irq(0x3300), /* IRQ24 */ |
| 767 | .platform_data = &as3711_pdata, |
| 768 | }, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 769 | }; |
| 770 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 771 | static struct i2c_board_info i2c1_devices[] = { |
| 772 | { |
| 773 | I2C_BOARD_INFO("st1232-ts", 0x55), |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 774 | .irq = irq_pin(8), /* IRQ8 */ |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 775 | }, |
| 776 | }; |
| 777 | |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 778 | static struct i2c_board_info i2c3_devices[] = { |
| 779 | { |
| 780 | I2C_BOARD_INFO("pcf8575", 0x20), |
Magnus Damm | 341eb54 | 2013-02-26 12:01:09 +0900 | [diff] [blame] | 781 | .irq = irq_pin(19), /* IRQ19 */ |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 782 | .platform_data = &pcf8575_pdata, |
| 783 | }, |
| 784 | }; |
| 785 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 786 | static struct platform_device *kzm_devices[] __initdata = { |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 787 | &smsc_device, |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame] | 788 | &usb_host_device, |
Kuninori Morimoto | 77bcefd | 2012-06-25 03:35:01 -0700 | [diff] [blame] | 789 | &usbhs_device, |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 790 | &lcdc_device, |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 791 | &mmc_device, |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 792 | &vcc_sdhi0, |
| 793 | &vcc_sdhi2, |
Kuninori Morimoto | 7775a93 | 2012-04-22 23:53:59 -0700 | [diff] [blame] | 794 | &sdhi0_device, |
Kuninori Morimoto | 425d694 | 2012-06-25 03:35:11 -0700 | [diff] [blame] | 795 | &sdhi2_device, |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 796 | &gpio_keys_device, |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 797 | &fsi_device, |
| 798 | &fsi_ak4648_device, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 799 | }; |
| 800 | |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 801 | static unsigned long pin_pullup_conf[] = { |
| 802 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0), |
| 803 | }; |
| 804 | |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 805 | static const struct pinctrl_map kzm_pinctrl_map[] = { |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 806 | /* FSIA (AK4648) */ |
Kuninori Morimoto | 41534a3 | 2013-05-22 18:34:10 -0700 | [diff] [blame] | 807 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0", |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 808 | "fsia_mclk_in", "fsia"), |
Kuninori Morimoto | 41534a3 | 2013-05-22 18:34:10 -0700 | [diff] [blame] | 809 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0", |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 810 | "fsia_sclk_in", "fsia"), |
Kuninori Morimoto | 41534a3 | 2013-05-22 18:34:10 -0700 | [diff] [blame] | 811 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0", |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 812 | "fsia_data_in", "fsia"), |
Kuninori Morimoto | 41534a3 | 2013-05-22 18:34:10 -0700 | [diff] [blame] | 813 | PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0", |
Laurent Pinchart | ee9f8da | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 814 | "fsia_data_out", "fsia"), |
Laurent Pinchart | 118b673 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 815 | /* I2C3 */ |
| 816 | PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0", |
| 817 | "i2c3_1", "i2c3"), |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 818 | /* LCD */ |
| 819 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0", |
| 820 | "lcd_data24", "lcd"), |
| 821 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0", |
| 822 | "lcd_sync", "lcd"), |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 823 | /* MMCIF */ |
| 824 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 825 | "mmc0_data8_0", "mmc0"), |
| 826 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 827 | "mmc0_ctrl_0", "mmc0"), |
| 828 | PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 829 | "PORT279", pin_pullup_conf), |
| 830 | PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", |
| 831 | "mmc0_data8_0", pin_pullup_conf), |
Laurent Pinchart | 5606ed9 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 832 | /* SCIFA4 */ |
| 833 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 834 | "scifa4_data", "scifa4"), |
| 835 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 836 | "scifa4_ctrl", "scifa4"), |
Laurent Pinchart | 83aeac9 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 837 | /* SDHI0 */ |
| 838 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 839 | "sdhi0_data4", "sdhi0"), |
| 840 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 841 | "sdhi0_ctrl", "sdhi0"), |
| 842 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 843 | "sdhi0_cd", "sdhi0"), |
| 844 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", |
| 845 | "sdhi0_wp", "sdhi0"), |
| 846 | /* SDHI2 */ |
| 847 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0", |
| 848 | "sdhi2_data4", "sdhi2"), |
| 849 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0", |
| 850 | "sdhi2_ctrl", "sdhi2"), |
Laurent Pinchart | fed94cf | 2013-03-13 03:21:36 +0100 | [diff] [blame] | 851 | /* SMSC */ |
| 852 | PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", |
| 853 | "bsc_cs4", "bsc"), |
Laurent Pinchart | f424386 | 2013-03-13 03:23:50 +0100 | [diff] [blame] | 854 | /* USB */ |
| 855 | PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0", |
| 856 | "usb_vbus", "usb"), |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 857 | }; |
| 858 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 859 | static void __init kzm_init(void) |
| 860 | { |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 861 | regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers, |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 862 | ARRAY_SIZE(fixed1v8_power_consumers), 1800000); |
Guennadi Liakhovetski | 54ca74e | 2013-03-18 19:26:44 +0100 | [diff] [blame] | 863 | regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
Guennadi Liakhovetski | 44a4244 | 2012-06-27 00:32:31 +0200 | [diff] [blame] | 864 | |
Laurent Pinchart | f3202e1 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 865 | pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map)); |
| 866 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 867 | sh73a0_pinmux_init(); |
| 868 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 869 | /* SMSC */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 870 | gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */ |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 871 | |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 872 | /* LCDC */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 873 | gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */ |
| 874 | gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */ |
Kuninori Morimoto | 2678611 | 2012-04-10 20:58:33 -0700 | [diff] [blame] | 875 | |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 876 | /* Touchscreen */ |
Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 877 | gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */ |
Kuninori Morimoto | cc2512b | 2012-04-22 23:53:40 -0700 | [diff] [blame] | 878 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 879 | #ifdef CONFIG_CACHE_L2X0 |
Russell King | 36bccb1 | 2014-03-19 12:44:41 +0000 | [diff] [blame] | 880 | /* Shared attribute override enable, 64K*8way */ |
Russell King | 2edb89c | 2014-03-19 12:16:36 +0000 | [diff] [blame] | 881 | l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff); |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 882 | #endif |
| 883 | |
Kuninori Morimoto | accb90c | 2012-06-12 02:44:03 -0700 | [diff] [blame] | 884 | i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 885 | i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices)); |
Kuninori Morimoto | 1e35464 | 2012-04-22 23:54:14 -0700 | [diff] [blame] | 886 | i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices)); |
Kuninori Morimoto | 407c052 | 2012-04-10 20:58:45 -0700 | [diff] [blame] | 887 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 888 | sh73a0_add_standard_devices(); |
| 889 | platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); |
Bastian Hecht | 13baf88 | 2012-12-05 12:13:06 +0000 | [diff] [blame] | 890 | |
| 891 | sh73a0_pm_init(); |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 892 | } |
| 893 | |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 894 | static void kzm9g_restart(enum reboot_mode mode, const char *cmd) |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 895 | { |
Arnd Bergmann | 28901c1 | 2012-09-23 22:41:21 +0000 | [diff] [blame] | 896 | #define RESCNT2 IOMEM(0xe6188020) |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 897 | /* Do soft power on reset */ |
| 898 | writel((1 << 31), RESCNT2); |
| 899 | } |
| 900 | |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 901 | static const char *kzm9g_boards_compat_dt[] __initdata = { |
| 902 | "renesas,kzm9g", |
| 903 | NULL, |
| 904 | }; |
| 905 | |
| 906 | DT_MACHINE_START(KZM9G_DT, "kzm9g") |
Marc Zyngier | a62580e | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 907 | .smp = smp_ops(sh73a0_smp_ops), |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 908 | .map_io = sh73a0_map_io, |
| 909 | .init_early = sh73a0_add_early_devices, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 910 | .init_irq = sh73a0_init_irq, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 911 | .init_machine = kzm_init, |
Kuninori Morimoto | 14dd52f | 2012-06-20 22:40:08 -0700 | [diff] [blame] | 912 | .init_late = shmobile_init_late, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 913 | .init_time = sh73a0_earlytimer_init, |
Tetsuyuki Kobayashi | 7952717 | 2012-07-20 15:16:30 +0900 | [diff] [blame] | 914 | .restart = kzm9g_restart, |
Magnus Damm | 7296d93 | 2012-05-14 23:22:28 +0200 | [diff] [blame] | 915 | .dt_compat = kzm9g_boards_compat_dt, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 916 | MACHINE_END |