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