| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 1 | /* | 
 | 2 |  * kota2 board support | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2011  Renesas Solutions Corp. | 
 | 5 |  * Copyright (C) 2011  Magnus Damm | 
 | 6 |  * Copyright (C) 2010  Takashi Yoshii <yoshii.takashi.zj@renesas.com> | 
 | 7 |  * Copyright (C) 2009  Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | 
 | 8 |  * | 
 | 9 |  * This program is free software; you can redistribute it and/or modify | 
 | 10 |  * it under the terms of the GNU General Public License as published by | 
 | 11 |  * the Free Software Foundation; version 2 of the License. | 
 | 12 |  * | 
 | 13 |  * This program is distributed in the hope that it will be useful, | 
 | 14 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 15 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 16 |  * GNU General Public License for more details. | 
 | 17 |  * | 
 | 18 |  * You should have received a copy of the GNU General Public License | 
 | 19 |  * along with this program; if not, write to the Free Software | 
 | 20 |  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
 | 21 |  */ | 
 | 22 |  | 
 | 23 | #include <linux/kernel.h> | 
 | 24 | #include <linux/init.h> | 
 | 25 | #include <linux/interrupt.h> | 
 | 26 | #include <linux/irq.h> | 
| Laurent Pinchart | ff11e87 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 27 | #include <linux/pinctrl/machine.h> | 
| Laurent Pinchart | d1436d1 | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 28 | #include <linux/pinctrl/pinconf-generic.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 29 | #include <linux/platform_device.h> | 
 | 30 | #include <linux/delay.h> | 
 | 31 | #include <linux/io.h> | 
| Guennadi Liakhovetski | f185c21 | 2012-06-27 00:32:29 +0200 | [diff] [blame] | 32 | #include <linux/regulator/fixed.h> | 
 | 33 | #include <linux/regulator/machine.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 34 | #include <linux/smsc911x.h> | 
 | 35 | #include <linux/gpio.h> | 
| Magnus Damm | ef4f994 | 2011-08-18 05:44:16 +0000 | [diff] [blame] | 36 | #include <linux/input.h> | 
 | 37 | #include <linux/input/sh_keysc.h> | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 38 | #include <linux/gpio_keys.h> | 
| Magnus Damm | ae6e708 | 2011-08-18 05:44:33 +0000 | [diff] [blame] | 39 | #include <linux/leds.h> | 
| Rob Herring | 520f7bd | 2012-12-27 13:10:24 -0600 | [diff] [blame] | 40 | #include <linux/irqchip/arm-gic.h> | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 41 | #include <linux/platform_data/leds-renesas-tpu.h> | 
| Magnus Damm | 4e92794 | 2011-08-18 05:44:42 +0000 | [diff] [blame] | 42 | #include <linux/mmc/host.h> | 
 | 43 | #include <linux/mmc/sh_mmcif.h> | 
| Magnus Damm | 8722c99 | 2011-08-18 05:45:00 +0000 | [diff] [blame] | 44 | #include <linux/mfd/tmio.h> | 
 | 45 | #include <linux/mmc/sh_mobile_sdhi.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 46 | #include <mach/hardware.h> | 
| Rob Herring | 250a272 | 2012-01-03 16:57:33 -0600 | [diff] [blame] | 47 | #include <mach/irqs.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 48 | #include <mach/sh73a0.h> | 
 | 49 | #include <mach/common.h> | 
 | 50 | #include <asm/mach-types.h> | 
 | 51 | #include <asm/mach/arch.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 52 | #include <asm/mach/time.h> | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 53 | #include <asm/hardware/cache-l2x0.h> | 
 | 54 | #include <asm/traps.h> | 
 | 55 |  | 
| Guennadi Liakhovetski | f185c21 | 2012-06-27 00:32:29 +0200 | [diff] [blame] | 56 | /* Dummy supplies, where voltage doesn't matter */ | 
 | 57 | static struct regulator_consumer_supply dummy_supplies[] = { | 
 | 58 | 	REGULATOR_SUPPLY("vddvario", "smsc911x"), | 
 | 59 | 	REGULATOR_SUPPLY("vdd33a", "smsc911x"), | 
 | 60 | }; | 
 | 61 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 62 | /* SMSC 9220 */ | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 63 | static struct resource smsc9220_resources[] = { | 
 | 64 | 	[0] = { | 
 | 65 | 		.start		= 0x14000000, /* CS5A */ | 
 | 66 | 		.end		= 0x140000ff, /* A1->A7 */ | 
 | 67 | 		.flags		= IORESOURCE_MEM, | 
 | 68 | 	}, | 
 | 69 | 	[1] = { | 
| Magnus Damm | 1b6cec8 | 2011-11-22 15:15:57 +0900 | [diff] [blame] | 70 | 		.start		= SH73A0_PINT0_IRQ(2), /* PINTA2 */ | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 71 | 		.flags		= IORESOURCE_IRQ, | 
 | 72 | 	}, | 
 | 73 | }; | 
 | 74 |  | 
 | 75 | static struct smsc911x_platform_config smsc9220_platdata = { | 
 | 76 | 	.flags		= SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */ | 
 | 77 | 	.phy_interface	= PHY_INTERFACE_MODE_MII, | 
 | 78 | 	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 
 | 79 | 	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL, | 
 | 80 | }; | 
 | 81 |  | 
 | 82 | static struct platform_device eth_device = { | 
 | 83 | 	.name		= "smsc911x", | 
 | 84 | 	.id		= 0, | 
 | 85 | 	.dev  = { | 
 | 86 | 		.platform_data = &smsc9220_platdata, | 
 | 87 | 	}, | 
 | 88 | 	.resource	= smsc9220_resources, | 
 | 89 | 	.num_resources	= ARRAY_SIZE(smsc9220_resources), | 
 | 90 | }; | 
 | 91 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 92 | /* KEYSC */ | 
| Magnus Damm | ef4f994 | 2011-08-18 05:44:16 +0000 | [diff] [blame] | 93 | static struct sh_keysc_info keysc_platdata = { | 
 | 94 | 	.mode		= SH_KEYSC_MODE_6, | 
 | 95 | 	.scan_timing	= 3, | 
 | 96 | 	.delay		= 100, | 
 | 97 | 	.keycodes	= { | 
 | 98 | 		KEY_NUMERIC_STAR, KEY_NUMERIC_0, KEY_NUMERIC_POUND, | 
 | 99 | 		0, 0, 0, 0, 0, | 
 | 100 | 		KEY_NUMERIC_7, KEY_NUMERIC_8, KEY_NUMERIC_9, | 
 | 101 | 		0, KEY_DOWN, 0, 0, 0, | 
 | 102 | 		KEY_NUMERIC_4, KEY_NUMERIC_5, KEY_NUMERIC_6, | 
 | 103 | 		KEY_LEFT, KEY_ENTER, KEY_RIGHT, 0, 0, | 
 | 104 | 		KEY_NUMERIC_1, KEY_NUMERIC_2, KEY_NUMERIC_3, | 
 | 105 | 		0, KEY_UP, 0, 0, 0, | 
 | 106 | 		0, 0, 0, 0, 0, 0, 0, 0, | 
 | 107 | 		0, 0, 0, 0, 0, 0, 0, 0, | 
 | 108 | 		0, 0, 0, 0, 0, 0, 0, 0, | 
 | 109 | 		0, 0, 0, 0, 0, 0, 0, 0, | 
 | 110 | 	}, | 
 | 111 | }; | 
 | 112 |  | 
 | 113 | static struct resource keysc_resources[] = { | 
 | 114 | 	[0] = { | 
 | 115 | 		.name	= "KEYSC", | 
 | 116 | 		.start	= 0xe61b0000, | 
 | 117 | 		.end	= 0xe61b0098 - 1, | 
 | 118 | 		.flags	= IORESOURCE_MEM, | 
 | 119 | 	}, | 
 | 120 | 	[1] = { | 
 | 121 | 		.start	= gic_spi(71), | 
 | 122 | 		.flags	= IORESOURCE_IRQ, | 
 | 123 | 	}, | 
 | 124 | }; | 
 | 125 |  | 
 | 126 | static struct platform_device keysc_device = { | 
 | 127 | 	.name		= "sh_keysc", | 
 | 128 | 	.id		= 0, | 
 | 129 | 	.num_resources	= ARRAY_SIZE(keysc_resources), | 
 | 130 | 	.resource	= keysc_resources, | 
 | 131 | 	.dev		= { | 
 | 132 | 		.platform_data	= &keysc_platdata, | 
 | 133 | 	}, | 
 | 134 | }; | 
 | 135 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 136 | /* GPIO KEY */ | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 137 | #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } | 
 | 138 |  | 
 | 139 | static struct gpio_keys_button gpio_buttons[] = { | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 140 | 	GPIO_KEY(KEY_VOLUMEUP, 56, "+"), /* S2: VOL+ [IRQ9] */ | 
 | 141 | 	GPIO_KEY(KEY_VOLUMEDOWN, 54, "-"), /* S3: VOL- [IRQ10] */ | 
 | 142 | 	GPIO_KEY(KEY_MENU, 27, "Menu"), /* S4: MENU [IRQ30] */ | 
 | 143 | 	GPIO_KEY(KEY_HOMEPAGE, 26, "Home"), /* S5: HOME [IRQ31] */ | 
 | 144 | 	GPIO_KEY(KEY_BACK, 11, "Back"), /* S6: BACK [IRQ0] */ | 
 | 145 | 	GPIO_KEY(KEY_PHONE, 238, "Tel"), /* S7: TEL [IRQ11] */ | 
 | 146 | 	GPIO_KEY(KEY_POWER, 239, "C1"), /* S8: CAM [IRQ13] */ | 
 | 147 | 	GPIO_KEY(KEY_MAIL, 224, "Mail"), /* S9: MAIL [IRQ3] */ | 
 | 148 | 	/* Omitted button "C3?": 223 - S10: CUST [IRQ8] */ | 
 | 149 | 	GPIO_KEY(KEY_CAMERA, 164, "C2"), /* S11: CAM_HALF [IRQ25] */ | 
 | 150 | 	/* Omitted button "?": 152 - S12: CAM_FULL [No IRQ] */ | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 151 | }; | 
 | 152 |  | 
 | 153 | static struct gpio_keys_platform_data gpio_key_info = { | 
 | 154 | 	.buttons        = gpio_buttons, | 
 | 155 | 	.nbuttons       = ARRAY_SIZE(gpio_buttons), | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 156 | }; | 
 | 157 |  | 
 | 158 | static struct platform_device gpio_keys_device = { | 
| Magnus Damm | 2fde109 | 2012-01-17 20:14:07 +0900 | [diff] [blame] | 159 | 	.name   = "gpio-keys", | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 160 | 	.id     = -1, | 
 | 161 | 	.dev    = { | 
 | 162 | 		.platform_data  = &gpio_key_info, | 
 | 163 | 	}, | 
 | 164 | }; | 
 | 165 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 166 | /* GPIO LED */ | 
| Magnus Damm | ae6e708 | 2011-08-18 05:44:33 +0000 | [diff] [blame] | 167 | #define GPIO_LED(n, g) { .name = n, .gpio = g } | 
 | 168 |  | 
 | 169 | static struct gpio_led gpio_leds[] = { | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 170 | 	GPIO_LED("G", 20), /* PORT20 [GPO0] -> LED7 -> "G" */ | 
 | 171 | 	GPIO_LED("H", 21), /* PORT21 [GPO1] -> LED8 -> "H" */ | 
 | 172 | 	GPIO_LED("J", 22), /* PORT22 [GPO2] -> LED9 -> "J" */ | 
| Magnus Damm | ae6e708 | 2011-08-18 05:44:33 +0000 | [diff] [blame] | 173 | }; | 
 | 174 |  | 
 | 175 | static struct gpio_led_platform_data gpio_leds_info = { | 
 | 176 | 	.leds		= gpio_leds, | 
 | 177 | 	.num_leds	= ARRAY_SIZE(gpio_leds), | 
 | 178 | }; | 
 | 179 |  | 
 | 180 | static struct platform_device gpio_leds_device = { | 
 | 181 | 	.name   = "leds-gpio", | 
 | 182 | 	.id     = -1, | 
 | 183 | 	.dev    = { | 
 | 184 | 		.platform_data  = &gpio_leds_info, | 
 | 185 | 	}, | 
 | 186 | }; | 
 | 187 |  | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 188 | /* TPU LED */ | 
 | 189 | static struct led_renesas_tpu_config led_renesas_tpu12_pdata = { | 
 | 190 | 	.name		= "V2513", | 
 | 191 | 	.pin_gpio_fn	= GPIO_FN_TPU1TO2, | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 192 | 	.pin_gpio	= 153, | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 193 | 	.channel_offset = 0x90, | 
 | 194 | 	.timer_bit = 2, | 
 | 195 | 	.max_brightness = 1000, | 
 | 196 | }; | 
 | 197 |  | 
 | 198 | static struct resource tpu12_resources[] = { | 
 | 199 | 	[0] = { | 
 | 200 | 		.name	= "TPU12", | 
 | 201 | 		.start	= 0xe6610090, | 
 | 202 | 		.end	= 0xe66100b5, | 
 | 203 | 		.flags	= IORESOURCE_MEM, | 
 | 204 | 	}, | 
 | 205 | }; | 
 | 206 |  | 
 | 207 | static struct platform_device leds_tpu12_device = { | 
 | 208 | 	.name = "leds-renesas-tpu", | 
 | 209 | 	.id = 12, | 
 | 210 | 	.dev = { | 
 | 211 | 		.platform_data  = &led_renesas_tpu12_pdata, | 
 | 212 | 	}, | 
 | 213 | 	.num_resources	= ARRAY_SIZE(tpu12_resources), | 
 | 214 | 	.resource	= tpu12_resources, | 
 | 215 | }; | 
 | 216 |  | 
 | 217 | static struct led_renesas_tpu_config led_renesas_tpu41_pdata = { | 
 | 218 | 	.name		= "V2514", | 
 | 219 | 	.pin_gpio_fn	= GPIO_FN_TPU4TO1, | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 220 | 	.pin_gpio	= 199, | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 221 | 	.channel_offset = 0x50, | 
 | 222 | 	.timer_bit = 1, | 
 | 223 | 	.max_brightness = 1000, | 
 | 224 | }; | 
 | 225 |  | 
 | 226 | static struct resource tpu41_resources[] = { | 
 | 227 | 	[0] = { | 
 | 228 | 		.name	= "TPU41", | 
 | 229 | 		.start	= 0xe6640050, | 
 | 230 | 		.end	= 0xe6640075, | 
 | 231 | 		.flags	= IORESOURCE_MEM, | 
 | 232 | 	}, | 
 | 233 | }; | 
 | 234 |  | 
 | 235 | static struct platform_device leds_tpu41_device = { | 
 | 236 | 	.name = "leds-renesas-tpu", | 
 | 237 | 	.id = 41, | 
 | 238 | 	.dev = { | 
 | 239 | 		.platform_data  = &led_renesas_tpu41_pdata, | 
 | 240 | 	}, | 
 | 241 | 	.num_resources	= ARRAY_SIZE(tpu41_resources), | 
 | 242 | 	.resource	= tpu41_resources, | 
 | 243 | }; | 
 | 244 |  | 
 | 245 | static struct led_renesas_tpu_config led_renesas_tpu21_pdata = { | 
 | 246 | 	.name		= "V2515", | 
 | 247 | 	.pin_gpio_fn	= GPIO_FN_TPU2TO1, | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 248 | 	.pin_gpio	= 197, | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 249 | 	.channel_offset = 0x50, | 
 | 250 | 	.timer_bit = 1, | 
 | 251 | 	.max_brightness = 1000, | 
 | 252 | }; | 
 | 253 |  | 
 | 254 | static struct resource tpu21_resources[] = { | 
 | 255 | 	[0] = { | 
 | 256 | 		.name	= "TPU21", | 
 | 257 | 		.start	= 0xe6620050, | 
 | 258 | 		.end	= 0xe6620075, | 
 | 259 | 		.flags	= IORESOURCE_MEM, | 
 | 260 | 	}, | 
 | 261 | }; | 
 | 262 |  | 
 | 263 | static struct platform_device leds_tpu21_device = { | 
 | 264 | 	.name = "leds-renesas-tpu", | 
 | 265 | 	.id = 21, | 
 | 266 | 	.dev = { | 
 | 267 | 		.platform_data  = &led_renesas_tpu21_pdata, | 
 | 268 | 	}, | 
 | 269 | 	.num_resources	= ARRAY_SIZE(tpu21_resources), | 
 | 270 | 	.resource	= tpu21_resources, | 
 | 271 | }; | 
 | 272 |  | 
 | 273 | static struct led_renesas_tpu_config led_renesas_tpu30_pdata = { | 
 | 274 | 	.name		= "KEYLED", | 
 | 275 | 	.pin_gpio_fn	= GPIO_FN_TPU3TO0, | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 276 | 	.pin_gpio	= 163, | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 277 | 	.channel_offset = 0x10, | 
 | 278 | 	.timer_bit = 0, | 
 | 279 | 	.max_brightness = 1000, | 
 | 280 | }; | 
 | 281 |  | 
 | 282 | static struct resource tpu30_resources[] = { | 
 | 283 | 	[0] = { | 
 | 284 | 		.name	= "TPU30", | 
 | 285 | 		.start	= 0xe6630010, | 
 | 286 | 		.end	= 0xe6630035, | 
 | 287 | 		.flags	= IORESOURCE_MEM, | 
 | 288 | 	}, | 
 | 289 | }; | 
 | 290 |  | 
 | 291 | static struct platform_device leds_tpu30_device = { | 
 | 292 | 	.name = "leds-renesas-tpu", | 
 | 293 | 	.id = 30, | 
 | 294 | 	.dev = { | 
 | 295 | 		.platform_data  = &led_renesas_tpu30_pdata, | 
 | 296 | 	}, | 
 | 297 | 	.num_resources	= ARRAY_SIZE(tpu30_resources), | 
 | 298 | 	.resource	= tpu30_resources, | 
 | 299 | }; | 
 | 300 |  | 
| Guennadi Liakhovetski | f185c21 | 2012-06-27 00:32:29 +0200 | [diff] [blame] | 301 | /* Fixed 1.8V regulator to be used by MMCIF */ | 
 | 302 | static struct regulator_consumer_supply fixed1v8_power_consumers[] = | 
 | 303 | { | 
 | 304 | 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), | 
 | 305 | 	REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"), | 
 | 306 | }; | 
 | 307 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 308 | /* MMCIF */ | 
| Magnus Damm | 4e92794 | 2011-08-18 05:44:42 +0000 | [diff] [blame] | 309 | static struct resource mmcif_resources[] = { | 
 | 310 | 	[0] = { | 
 | 311 | 		.name   = "MMCIF", | 
 | 312 | 		.start  = 0xe6bd0000, | 
 | 313 | 		.end    = 0xe6bd00ff, | 
 | 314 | 		.flags  = IORESOURCE_MEM, | 
 | 315 | 	}, | 
 | 316 | 	[1] = { | 
 | 317 | 		.start  = gic_spi(140), | 
 | 318 | 		.flags  = IORESOURCE_IRQ, | 
 | 319 | 	}, | 
 | 320 | 	[2] = { | 
 | 321 | 		.start  = gic_spi(141), | 
 | 322 | 		.flags  = IORESOURCE_IRQ, | 
 | 323 | 	}, | 
 | 324 | }; | 
 | 325 |  | 
 | 326 | static struct sh_mmcif_plat_data mmcif_info = { | 
 | 327 | 	.ocr            = MMC_VDD_165_195, | 
 | 328 | 	.caps           = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | 
 | 329 | }; | 
 | 330 |  | 
 | 331 | static struct platform_device mmcif_device = { | 
 | 332 | 	.name           = "sh_mmcif", | 
 | 333 | 	.id             = 0, | 
 | 334 | 	.dev            = { | 
 | 335 | 		.platform_data          = &mmcif_info, | 
 | 336 | 	}, | 
 | 337 | 	.num_resources  = ARRAY_SIZE(mmcif_resources), | 
 | 338 | 	.resource       = mmcif_resources, | 
 | 339 | }; | 
 | 340 |  | 
| Guennadi Liakhovetski | f185c21 | 2012-06-27 00:32:29 +0200 | [diff] [blame] | 341 | /* Fixed 3.3V regulator to be used by SDHI0 and SDHI1 */ | 
 | 342 | static struct regulator_consumer_supply fixed3v3_power_consumers[] = | 
 | 343 | { | 
 | 344 | 	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), | 
 | 345 | 	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), | 
 | 346 | 	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), | 
 | 347 | 	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), | 
 | 348 | }; | 
 | 349 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 350 | /* SDHI0 */ | 
| Magnus Damm | 8722c99 | 2011-08-18 05:45:00 +0000 | [diff] [blame] | 351 | static struct sh_mobile_sdhi_info sdhi0_info = { | 
 | 352 | 	.tmio_caps      = MMC_CAP_SD_HIGHSPEED, | 
 | 353 | 	.tmio_flags     = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, | 
 | 354 | }; | 
 | 355 |  | 
 | 356 | static struct resource sdhi0_resources[] = { | 
 | 357 | 	[0] = { | 
 | 358 | 		.name   = "SDHI0", | 
 | 359 | 		.start  = 0xee100000, | 
 | 360 | 		.end    = 0xee1000ff, | 
 | 361 | 		.flags  = IORESOURCE_MEM, | 
 | 362 | 	}, | 
 | 363 | 	[1] = { | 
 | 364 | 		.start  = gic_spi(83), | 
 | 365 | 		.flags  = IORESOURCE_IRQ, | 
 | 366 | 	}, | 
 | 367 | 	[2] = { | 
 | 368 | 		.start  = gic_spi(84), | 
 | 369 | 		.flags  = IORESOURCE_IRQ, | 
 | 370 | 	}, | 
 | 371 | 	[3] = { | 
 | 372 | 		.start	= gic_spi(85), | 
 | 373 | 		.flags	= IORESOURCE_IRQ, | 
 | 374 | 	}, | 
 | 375 | }; | 
 | 376 |  | 
 | 377 | static struct platform_device sdhi0_device = { | 
 | 378 | 	.name           = "sh_mobile_sdhi", | 
 | 379 | 	.id             = 0, | 
 | 380 | 	.num_resources  = ARRAY_SIZE(sdhi0_resources), | 
 | 381 | 	.resource       = sdhi0_resources, | 
 | 382 | 	.dev    = { | 
 | 383 | 		.platform_data  = &sdhi0_info, | 
 | 384 | 	}, | 
 | 385 | }; | 
 | 386 |  | 
| Kuninori Morimoto | c5e7bcd | 2011-11-10 18:44:43 -0800 | [diff] [blame] | 387 | /* SDHI1 */ | 
| Magnus Damm | 8722c99 | 2011-08-18 05:45:00 +0000 | [diff] [blame] | 388 | static struct sh_mobile_sdhi_info sdhi1_info = { | 
 | 389 | 	.tmio_caps      = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ, | 
 | 390 | 	.tmio_flags     = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, | 
 | 391 | }; | 
 | 392 |  | 
 | 393 | static struct resource sdhi1_resources[] = { | 
 | 394 | 	[0] = { | 
 | 395 | 		.name   = "SDHI1", | 
 | 396 | 		.start  = 0xee120000, | 
 | 397 | 		.end    = 0xee1200ff, | 
 | 398 | 		.flags  = IORESOURCE_MEM, | 
 | 399 | 	}, | 
 | 400 | 	[1] = { | 
 | 401 | 		.start  = gic_spi(87), | 
 | 402 | 		.flags  = IORESOURCE_IRQ, | 
 | 403 | 	}, | 
 | 404 | 	[2] = { | 
 | 405 | 		.start  = gic_spi(88), | 
 | 406 | 		.flags  = IORESOURCE_IRQ, | 
 | 407 | 	}, | 
 | 408 | 	[3] = { | 
 | 409 | 		.start	= gic_spi(89), | 
 | 410 | 		.flags	= IORESOURCE_IRQ, | 
 | 411 | 	}, | 
 | 412 | }; | 
 | 413 |  | 
 | 414 | static struct platform_device sdhi1_device = { | 
 | 415 | 	.name           = "sh_mobile_sdhi", | 
 | 416 | 	.id             = 1, | 
 | 417 | 	.num_resources  = ARRAY_SIZE(sdhi1_resources), | 
 | 418 | 	.resource       = sdhi1_resources, | 
 | 419 | 	.dev    = { | 
 | 420 | 		.platform_data  = &sdhi1_info, | 
 | 421 | 	}, | 
 | 422 | }; | 
 | 423 |  | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 424 | static struct platform_device *kota2_devices[] __initdata = { | 
 | 425 | 	ð_device, | 
| Magnus Damm | ef4f994 | 2011-08-18 05:44:16 +0000 | [diff] [blame] | 426 | 	&keysc_device, | 
| Magnus Damm | 6b7c0ea | 2011-08-18 05:44:25 +0000 | [diff] [blame] | 427 | 	&gpio_keys_device, | 
| Magnus Damm | ae6e708 | 2011-08-18 05:44:33 +0000 | [diff] [blame] | 428 | 	&gpio_leds_device, | 
| Magnus Damm | 33661c9 | 2011-11-22 15:44:58 +0900 | [diff] [blame] | 429 | 	&leds_tpu12_device, | 
 | 430 | 	&leds_tpu41_device, | 
 | 431 | 	&leds_tpu21_device, | 
 | 432 | 	&leds_tpu30_device, | 
| Magnus Damm | 4e92794 | 2011-08-18 05:44:42 +0000 | [diff] [blame] | 433 | 	&mmcif_device, | 
| Magnus Damm | 8722c99 | 2011-08-18 05:45:00 +0000 | [diff] [blame] | 434 | 	&sdhi0_device, | 
 | 435 | 	&sdhi1_device, | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 436 | }; | 
 | 437 |  | 
| Laurent Pinchart | d1436d1 | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 438 | static unsigned long pin_pullup_conf[] = { | 
 | 439 | 	PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0), | 
 | 440 | }; | 
 | 441 |  | 
| Laurent Pinchart | ff11e87 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 442 | static const struct pinctrl_map kota2_pinctrl_map[] = { | 
| Laurent Pinchart | 67ee2fd | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 443 | 	/* KEYSC */ | 
 | 444 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 445 | 				  "keysc_in8", "keysc"), | 
 | 446 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 447 | 				  "keysc_out04", "keysc"), | 
 | 448 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 449 | 				  "keysc_out5", "keysc"), | 
 | 450 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 451 | 				  "keysc_out6_0", "keysc"), | 
 | 452 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 453 | 				  "keysc_out7_0", "keysc"), | 
 | 454 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 455 | 				  "keysc_out8_0", "keysc"), | 
 | 456 | 	PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0", | 
 | 457 | 				      "keysc_in8", pin_pullup_conf), | 
| Laurent Pinchart | d1436d1 | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 458 | 	/* MMCIF */ | 
 | 459 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", | 
 | 460 | 				  "mmc0_data8_0", "mmc0"), | 
 | 461 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", | 
 | 462 | 				  "mmc0_ctrl_0", "mmc0"), | 
 | 463 | 	PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0", | 
 | 464 | 				    "PORT279", pin_pullup_conf), | 
 | 465 | 	PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0", | 
 | 466 | 				      "mmc0_data8_0", pin_pullup_conf), | 
| Laurent Pinchart | ff11e87 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 467 | 	/* SCIFA2 (UART2) */ | 
 | 468 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0", | 
 | 469 | 				  "scifa2_data_0", "scifa2"), | 
 | 470 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0", | 
 | 471 | 				  "scifa2_ctrl_0", "scifa2"), | 
 | 472 | 	/* SCIFA4 (UART1) */ | 
 | 473 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", | 
 | 474 | 				  "scifa4_data", "scifa4"), | 
 | 475 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", | 
 | 476 | 				  "scifa4_ctrl", "scifa4"), | 
 | 477 | 	/* SCIFB (BT) */ | 
 | 478 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0", | 
 | 479 | 				  "scifb_data_0", "scifb"), | 
 | 480 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0", | 
 | 481 | 				  "scifb_clk_0", "scifb"), | 
 | 482 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0", | 
 | 483 | 				  "scifb_ctrl_0", "scifb"), | 
| Laurent Pinchart | d1436d1 | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 484 | 	/* SDHI0 (microSD) */ | 
 | 485 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 486 | 				  "sdhi0_data4", "sdhi0"), | 
 | 487 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 488 | 				  "sdhi0_ctrl", "sdhi0"), | 
 | 489 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 490 | 				  "sdhi0_cd", "sdhi0"), | 
 | 491 | 	PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 492 | 				      "sdhi0_data4", pin_pullup_conf), | 
 | 493 | 	PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 494 | 				    "PORT256", pin_pullup_conf), | 
 | 495 | 	PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0", | 
 | 496 | 				    "PORT251", pin_pullup_conf), | 
 | 497 | 	/* SDHI1 (BCM4330) */ | 
 | 498 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0", | 
 | 499 | 				  "sdhi1_data4", "sdhi1"), | 
 | 500 | 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0", | 
 | 501 | 				  "sdhi1_ctrl", "sdhi1"), | 
 | 502 | 	PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0", | 
 | 503 | 				      "sdhi1_data4", pin_pullup_conf), | 
 | 504 | 	PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0", | 
 | 505 | 				    "PORT263", pin_pullup_conf), | 
| Laurent Pinchart | b5ee0e1 | 2013-03-13 03:52:31 +0100 | [diff] [blame] | 506 | 	/* SMSC911X */ | 
 | 507 | 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", | 
 | 508 | 				  "bsc_data_0_7", "bsc"), | 
 | 509 | 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", | 
 | 510 | 				  "bsc_data_8_15", "bsc"), | 
 | 511 | 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", | 
 | 512 | 				  "bsc_cs5_a", "bsc"), | 
 | 513 | 	PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", | 
 | 514 | 				  "bsc_we0", "bsc"), | 
| Laurent Pinchart | ff11e87 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 515 | }; | 
 | 516 |  | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 517 | static void __init kota2_init(void) | 
 | 518 | { | 
| Guennadi Liakhovetski | f185c21 | 2012-06-27 00:32:29 +0200 | [diff] [blame] | 519 | 	regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, | 
 | 520 | 				     ARRAY_SIZE(fixed1v8_power_consumers), 1800000); | 
 | 521 | 	regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers, | 
 | 522 | 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000); | 
 | 523 | 	regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | 
 | 524 |  | 
| Laurent Pinchart | ff11e87 | 2013-01-03 12:54:28 +0100 | [diff] [blame] | 525 | 	pinctrl_register_mappings(kota2_pinctrl_map, | 
 | 526 | 				  ARRAY_SIZE(kota2_pinctrl_map)); | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 527 | 	sh73a0_pinmux_init(); | 
 | 528 |  | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 529 | 	/* SMSC911X */ | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 530 | 	gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */ | 
 | 531 | 	gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */ | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 532 |  | 
| Magnus Damm | 4e92794 | 2011-08-18 05:44:42 +0000 | [diff] [blame] | 533 | 	/* MMCIF */ | 
| Guennadi Liakhovetski | b58e5fa | 2013-02-12 16:50:02 +0100 | [diff] [blame] | 534 | 	gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */ | 
| Magnus Damm | 4e92794 | 2011-08-18 05:44:42 +0000 | [diff] [blame] | 535 |  | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 536 | #ifdef CONFIG_CACHE_L2X0 | 
 | 537 | 	/* Early BRESP enable, Shared attribute override enable, 64K*8way */ | 
| Rob Herring | a2a47ca | 2012-03-09 17:16:40 -0600 | [diff] [blame] | 538 | 	l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 539 | #endif | 
 | 540 | 	sh73a0_add_standard_devices(); | 
 | 541 | 	platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); | 
 | 542 | } | 
 | 543 |  | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 544 | MACHINE_START(KOTA2, "kota2") | 
| Marc Zyngier | a62580e | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 545 | 	.smp		= smp_ops(sh73a0_smp_ops), | 
| Magnus Damm | 50e15c3 | 2012-02-29 21:37:27 +0900 | [diff] [blame] | 546 | 	.map_io		= sh73a0_map_io, | 
 | 547 | 	.init_early	= sh73a0_add_early_devices, | 
| Magnus Damm | dcb4ea8 | 2011-11-22 15:29:54 +0900 | [diff] [blame] | 548 | 	.nr_irqs	= NR_IRQS_LEGACY, | 
| Magnus Damm | 1b6cec8 | 2011-11-22 15:15:57 +0900 | [diff] [blame] | 549 | 	.init_irq	= sh73a0_init_irq, | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 550 | 	.init_machine	= kota2_init, | 
| Shawn Guo | 21cc1b7 | 2012-04-26 21:58:41 +0800 | [diff] [blame] | 551 | 	.init_late	= shmobile_init_late, | 
| Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 552 | 	.init_time	= sh73a0_earlytimer_init, | 
| Magnus Damm | 2862663 | 2011-08-18 05:44:07 +0000 | [diff] [blame] | 553 | MACHINE_END |