aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-08-14 03:33:54 -0400
committerOlof Johansson <olof@lixom.net>2013-08-14 03:33:54 -0400
commit13b837999f5cff1b0f40842704a18a2357dc22b2 (patch)
treec375369e2fdbacd784aaebcc8360ccffd0da1199
parent4ddbed9618724d52a7a79c1e10ef5adb46fcccf7 (diff)
parentae3e4c277669e16093f0e71ca927cf33e7dde053 (diff)
Merge tag 'renesas-tpu-pwm-for-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/boards
From Simon Horman: Renesas TPU PWM support for v3.12 Add Renesas TPU PWM unit support * tag 'renesas-tpu-pwm-for-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: leds: Remove leds-renesas-tpu driver ARM: shmobile: sh73a0: Remove all GPIOs ARM: shmobile: kota2: Use leds-pwm + pwm-rmob ARM: shmobile: armadillo800eva: Add backlight support Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c54
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c169
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c12
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h373
-rw-r--r--drivers/leds/Kconfig12
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-renesas-tpu.c337
-rw-r--r--include/linux/platform_data/leds-renesas-tpu.h14
8 files changed, 143 insertions, 829 deletions
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index e115f6742107..9457c763b797 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -31,6 +31,8 @@
31#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
32#include <linux/regulator/driver.h> 32#include <linux/regulator/driver.h>
33#include <linux/pinctrl/machine.h> 33#include <linux/pinctrl/machine.h>
34#include <linux/platform_data/pwm-renesas-tpu.h>
35#include <linux/pwm_backlight.h>
34#include <linux/regulator/fixed.h> 36#include <linux/regulator/fixed.h>
35#include <linux/regulator/gpio-regulator.h> 37#include <linux/regulator/gpio-regulator.h>
36#include <linux/regulator/machine.h> 38#include <linux/regulator/machine.h>
@@ -387,7 +389,50 @@ static struct platform_device sh_eth_device = {
387 .num_resources = ARRAY_SIZE(sh_eth_resources), 389 .num_resources = ARRAY_SIZE(sh_eth_resources),
388}; 390};
389 391
390/* LCDC */ 392/* PWM */
393static struct resource pwm_resources[] = {
394 [0] = {
395 .start = 0xe6600000,
396 .end = 0xe66000ff,
397 .flags = IORESOURCE_MEM,
398 },
399};
400
401static struct tpu_pwm_platform_data pwm_device_data = {
402 .channels[2] = {
403 .polarity = PWM_POLARITY_INVERSED,
404 }
405};
406
407static struct platform_device pwm_device = {
408 .name = "renesas-tpu-pwm",
409 .id = -1,
410 .dev = {
411 .platform_data = &pwm_device_data,
412 },
413 .num_resources = ARRAY_SIZE(pwm_resources),
414 .resource = pwm_resources,
415};
416
417static struct pwm_lookup pwm_lookup[] = {
418 PWM_LOOKUP("renesas-tpu-pwm", 2, "pwm-backlight.0", NULL),
419};
420
421/* LCDC and backlight */
422static struct platform_pwm_backlight_data pwm_backlight_data = {
423 .lth_brightness = 50,
424 .max_brightness = 255,
425 .dft_brightness = 255,
426 .pwm_period_ns = 33333, /* 30kHz */
427};
428
429static struct platform_device pwm_backlight_device = {
430 .name = "pwm-backlight",
431 .dev = {
432 .platform_data = &pwm_backlight_data,
433 },
434};
435
391static struct fb_videomode lcdc0_mode = { 436static struct fb_videomode lcdc0_mode = {
392 .name = "AMPIER/AM-800480", 437 .name = "AMPIER/AM-800480",
393 .xres = 800, 438 .xres = 800,
@@ -1030,6 +1075,8 @@ static struct i2c_board_info i2c2_devices[] = {
1030 */ 1075 */
1031static struct platform_device *eva_devices[] __initdata = { 1076static struct platform_device *eva_devices[] __initdata = {
1032 &lcdc0_device, 1077 &lcdc0_device,
1078 &pwm_device,
1079 &pwm_backlight_device,
1033 &gpio_keys_device, 1080 &gpio_keys_device,
1034 &sh_eth_device, 1081 &sh_eth_device,
1035 &vcc_sdhi0, 1082 &vcc_sdhi0,
@@ -1101,6 +1148,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
1101 /* ST1232 */ 1148 /* ST1232 */
1102 PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740", 1149 PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
1103 "intc_irq10", "intc"), 1150 "intc_irq10", "intc"),
1151 /* TPU0 */
1152 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm", "pfc-r8a7740",
1153 "tpu0_to2_1", "tpu0"),
1104 /* USBHS */ 1154 /* USBHS */
1105 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740", 1155 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
1106 "intc_irq7_1", "intc"), 1156 "intc_irq7_1", "intc"),
@@ -1154,13 +1204,13 @@ static void __init eva_init(void)
1154 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 1204 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1155 1205
1156 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map)); 1206 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
1207 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
1157 1208
1158 r8a7740_pinmux_init(); 1209 r8a7740_pinmux_init();
1159 r8a7740_meram_workaround(); 1210 r8a7740_meram_workaround();
1160 1211
1161 /* LCDC0 */ 1212 /* LCDC0 */
1162 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1213 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1163 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
1164 1214
1165 /* Touchscreen */ 1215 /* Touchscreen */
1166 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */ 1216 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index ef5ca0ef0cb5..6af20d909bdb 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -26,6 +26,7 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h> 27#include <linux/pinctrl/machine.h>
28#include <linux/pinctrl/pinconf-generic.h> 28#include <linux/pinctrl/pinconf-generic.h>
29#include <linux/platform_data/pwm-renesas-tpu.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
30#include <linux/delay.h> 31#include <linux/delay.h>
31#include <linux/io.h> 32#include <linux/io.h>
@@ -37,8 +38,8 @@
37#include <linux/input/sh_keysc.h> 38#include <linux/input/sh_keysc.h>
38#include <linux/gpio_keys.h> 39#include <linux/gpio_keys.h>
39#include <linux/leds.h> 40#include <linux/leds.h>
41#include <linux/leds_pwm.h>
40#include <linux/irqchip/arm-gic.h> 42#include <linux/irqchip/arm-gic.h>
41#include <linux/platform_data/leds-renesas-tpu.h>
42#include <linux/mmc/host.h> 43#include <linux/mmc/host.h>
43#include <linux/mmc/sh_mmcif.h> 44#include <linux/mmc/sh_mmcif.h>
44#include <linux/mfd/tmio.h> 45#include <linux/mfd/tmio.h>
@@ -186,116 +187,100 @@ static struct platform_device gpio_leds_device = {
186}; 187};
187 188
188/* TPU LED */ 189/* TPU LED */
189static struct led_renesas_tpu_config led_renesas_tpu12_pdata = { 190static struct resource tpu1_pwm_resources[] = {
190 .name = "V2513",
191 .pin_gpio_fn = GPIO_FN_TPU1TO2,
192 .pin_gpio = 153,
193 .channel_offset = 0x90,
194 .timer_bit = 2,
195 .max_brightness = 1000,
196};
197
198static struct resource tpu12_resources[] = {
199 [0] = { 191 [0] = {
200 .name = "TPU12", 192 .start = 0xe6610000,
201 .start = 0xe6610090, 193 .end = 0xe66100ff,
202 .end = 0xe66100b5,
203 .flags = IORESOURCE_MEM, 194 .flags = IORESOURCE_MEM,
204 }, 195 },
205}; 196};
206 197
207static struct platform_device leds_tpu12_device = { 198static struct platform_device tpu1_pwm_device = {
208 .name = "leds-renesas-tpu", 199 .name = "renesas-tpu-pwm",
209 .id = 12, 200 .id = 1,
210 .dev = { 201 .num_resources = ARRAY_SIZE(tpu1_pwm_resources),
211 .platform_data = &led_renesas_tpu12_pdata, 202 .resource = tpu1_pwm_resources,
212 },
213 .num_resources = ARRAY_SIZE(tpu12_resources),
214 .resource = tpu12_resources,
215}; 203};
216 204
217static struct led_renesas_tpu_config led_renesas_tpu41_pdata = { 205static struct resource tpu2_pwm_resources[] = {
218 .name = "V2514",
219 .pin_gpio_fn = GPIO_FN_TPU4TO1,
220 .pin_gpio = 199,
221 .channel_offset = 0x50,
222 .timer_bit = 1,
223 .max_brightness = 1000,
224};
225
226static struct resource tpu41_resources[] = {
227 [0] = { 206 [0] = {
228 .name = "TPU41", 207 .start = 0xe6620000,
229 .start = 0xe6640050, 208 .end = 0xe66200ff,
230 .end = 0xe6640075,
231 .flags = IORESOURCE_MEM, 209 .flags = IORESOURCE_MEM,
232 }, 210 },
233}; 211};
234 212
235static struct platform_device leds_tpu41_device = { 213static struct platform_device tpu2_pwm_device = {
236 .name = "leds-renesas-tpu", 214 .name = "renesas-tpu-pwm",
237 .id = 41, 215 .id = 2,
238 .dev = { 216 .num_resources = ARRAY_SIZE(tpu2_pwm_resources),
239 .platform_data = &led_renesas_tpu41_pdata, 217 .resource = tpu2_pwm_resources,
218};
219
220static struct resource tpu3_pwm_resources[] = {
221 [0] = {
222 .start = 0xe6630000,
223 .end = 0xe66300ff,
224 .flags = IORESOURCE_MEM,
240 }, 225 },
241 .num_resources = ARRAY_SIZE(tpu41_resources),
242 .resource = tpu41_resources,
243}; 226};
244 227
245static struct led_renesas_tpu_config led_renesas_tpu21_pdata = { 228static struct platform_device tpu3_pwm_device = {
246 .name = "V2515", 229 .name = "renesas-tpu-pwm",
247 .pin_gpio_fn = GPIO_FN_TPU2TO1, 230 .id = 3,
248 .pin_gpio = 197, 231 .num_resources = ARRAY_SIZE(tpu3_pwm_resources),
249 .channel_offset = 0x50, 232 .resource = tpu3_pwm_resources,
250 .timer_bit = 1,
251 .max_brightness = 1000,
252}; 233};
253 234
254static struct resource tpu21_resources[] = { 235static struct resource tpu4_pwm_resources[] = {
255 [0] = { 236 [0] = {
256 .name = "TPU21", 237 .start = 0xe6640000,
257 .start = 0xe6620050, 238 .end = 0xe66400ff,
258 .end = 0xe6620075,
259 .flags = IORESOURCE_MEM, 239 .flags = IORESOURCE_MEM,
260 }, 240 },
261}; 241};
262 242
263static struct platform_device leds_tpu21_device = { 243static struct platform_device tpu4_pwm_device = {
264 .name = "leds-renesas-tpu", 244 .name = "renesas-tpu-pwm",
265 .id = 21, 245 .id = 4,
266 .dev = { 246 .num_resources = ARRAY_SIZE(tpu4_pwm_resources),
267 .platform_data = &led_renesas_tpu21_pdata, 247 .resource = tpu4_pwm_resources,
248};
249
250static struct pwm_lookup pwm_lookup[] = {
251 PWM_LOOKUP("renesas-tpu-pwm.1", 2, "leds-pwm.0", "V2513"),
252 PWM_LOOKUP("renesas-tpu-pwm.2", 1, "leds-pwm.0", "V2515"),
253 PWM_LOOKUP("renesas-tpu-pwm.3", 0, "leds-pwm.0", "KEYLED"),
254 PWM_LOOKUP("renesas-tpu-pwm.4", 1, "leds-pwm.0", "V2514"),
255};
256
257static struct led_pwm tpu_pwm_leds[] = {
258 {
259 .name = "V2513",
260 .max_brightness = 1000,
261 }, {
262 .name = "V2515",
263 .max_brightness = 1000,
264 }, {
265 .name = "KEYLED",
266 .max_brightness = 1000,
267 }, {
268 .name = "V2514",
269 .max_brightness = 1000,
268 }, 270 },
269 .num_resources = ARRAY_SIZE(tpu21_resources),
270 .resource = tpu21_resources,
271}; 271};
272 272
273static struct led_renesas_tpu_config led_renesas_tpu30_pdata = { 273static struct led_pwm_platform_data leds_pwm_pdata = {
274 .name = "KEYLED", 274 .num_leds = ARRAY_SIZE(tpu_pwm_leds),
275 .pin_gpio_fn = GPIO_FN_TPU3TO0, 275 .leds = tpu_pwm_leds,
276 .pin_gpio = 163,
277 .channel_offset = 0x10,
278 .timer_bit = 0,
279 .max_brightness = 1000,
280}; 276};
281 277
282static struct resource tpu30_resources[] = { 278static struct platform_device leds_pwm_device = {
283 [0] = { 279 .name = "leds-pwm",
284 .name = "TPU30", 280 .id = 0,
285 .start = 0xe6630010,
286 .end = 0xe6630035,
287 .flags = IORESOURCE_MEM,
288 },
289};
290
291static struct platform_device leds_tpu30_device = {
292 .name = "leds-renesas-tpu",
293 .id = 30,
294 .dev = { 281 .dev = {
295 .platform_data = &led_renesas_tpu30_pdata, 282 .platform_data = &leds_pwm_pdata,
296 }, 283 },
297 .num_resources = ARRAY_SIZE(tpu30_resources),
298 .resource = tpu30_resources,
299}; 284};
300 285
301/* Fixed 1.8V regulator to be used by MMCIF */ 286/* Fixed 1.8V regulator to be used by MMCIF */
@@ -426,10 +411,11 @@ static struct platform_device *kota2_devices[] __initdata = {
426 &keysc_device, 411 &keysc_device,
427 &gpio_keys_device, 412 &gpio_keys_device,
428 &gpio_leds_device, 413 &gpio_leds_device,
429 &leds_tpu12_device, 414 &tpu1_pwm_device,
430 &leds_tpu41_device, 415 &tpu2_pwm_device,
431 &leds_tpu21_device, 416 &tpu3_pwm_device,
432 &leds_tpu30_device, 417 &tpu4_pwm_device,
418 &leds_pwm_device,
433 &mmcif_device, 419 &mmcif_device,
434 &sdhi0_device, 420 &sdhi0_device,
435 &sdhi1_device, 421 &sdhi1_device,
@@ -512,6 +498,15 @@ static const struct pinctrl_map kota2_pinctrl_map[] = {
512 "bsc_cs5_a", "bsc"), 498 "bsc_cs5_a", "bsc"),
513 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0", 499 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
514 "bsc_we0", "bsc"), 500 "bsc_we0", "bsc"),
501 /* TPU */
502 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm.1", "pfc-sh73a0",
503 "tpu1_to2", "tpu1"),
504 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm.2", "pfc-sh73a0",
505 "tpu2_to1", "tpu2"),
506 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm.3", "pfc-sh73a0",
507 "tpu3_to0", "tpu3"),
508 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm.4", "pfc-sh73a0",
509 "tpu4_to1", "tpu4"),
515}; 510};
516 511
517static void __init kota2_init(void) 512static void __init kota2_init(void)
@@ -524,6 +519,8 @@ static void __init kota2_init(void)
524 519
525 pinctrl_register_mappings(kota2_pinctrl_map, 520 pinctrl_register_mappings(kota2_pinctrl_map,
526 ARRAY_SIZE(kota2_pinctrl_map)); 521 ARRAY_SIZE(kota2_pinctrl_map));
522 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
523
527 sh73a0_pinmux_init(); 524 sh73a0_pinmux_init();
528 525
529 /* SMSC911X */ 526 /* SMSC911X */
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index d9fd0336b910..1942eaef5181 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -555,7 +555,7 @@ enum { MSTP001,
555 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 555 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
556 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322, 556 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
557 MSTP314, MSTP313, MSTP312, MSTP311, 557 MSTP314, MSTP313, MSTP312, MSTP311,
558 MSTP303, MSTP302, MSTP301, MSTP300, 558 MSTP304, MSTP303, MSTP302, MSTP301, MSTP300,
559 MSTP411, MSTP410, MSTP403, 559 MSTP411, MSTP410, MSTP403,
560 MSTP_NR }; 560 MSTP_NR };
561 561
@@ -593,6 +593,7 @@ static struct clk mstp_clks[MSTP_NR] = {
593 [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ 593 [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */
594 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ 594 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */
595 [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */ 595 [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */
596 [MSTP304] = MSTP(&main_div2_clk, SMSTPCR3, 4, 0), /* TPU0 */
596 [MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */ 597 [MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */
597 [MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */ 598 [MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */
598 [MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */ 599 [MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */
@@ -669,10 +670,11 @@ static struct clk_lookup lookups[] = {
669 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ 670 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */
670 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ 671 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
671 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */ 672 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */
672 CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ 673 CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */
673 CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ 674 CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */
674 CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ 675 CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */
675 CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */ 676 CLKDEV_DEV_ID("renesas-tpu-pwm.3", &mstp_clks[MSTP301]), /* TPU3 */
677 CLKDEV_DEV_ID("renesas-tpu-pwm.4", &mstp_clks[MSTP300]), /* TPU4 */
676 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ 678 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
677 CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */ 679 CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */
678 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ 680 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index eb7a4320d487..680dc5f1655a 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -1,378 +1,7 @@
1#ifndef __ASM_SH73A0_H__ 1#ifndef __ASM_SH73A0_H__
2#define __ASM_SH73A0_H__ 2#define __ASM_SH73A0_H__
3 3
4/* Pin Function Controller: 4#define GPIO_NR 310
5 * GPIO_FN_xx - GPIO used to select pin function and MSEL switch
6 * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
7 */
8enum {
9 /* Hardware manual Table 25-1 (GPIO) */
10 GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
11 GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
12
13 GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
14 GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
15
16 GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
17 GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
18
19 GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
20 GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
21
22 GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
23 GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
24
25 GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
26 GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
27
28 GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
29 GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
30
31 GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
32 GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
33
34 GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
35 GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
36
37 GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
38 GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
39
40 GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
41 GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
42
43 GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
44 GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118,
45
46 GPIO_PORT128, GPIO_PORT129,
47
48 GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
49 GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
50
51 GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
52 GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
53
54 GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
55 GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
56
57 GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
58
59 GPIO_PORT192, GPIO_PORT193, GPIO_PORT194,
60 GPIO_PORT195, GPIO_PORT196, GPIO_PORT197, GPIO_PORT198, GPIO_PORT199,
61
62 GPIO_PORT200, GPIO_PORT201, GPIO_PORT202, GPIO_PORT203, GPIO_PORT204,
63 GPIO_PORT205, GPIO_PORT206, GPIO_PORT207, GPIO_PORT208, GPIO_PORT209,
64
65 GPIO_PORT210, GPIO_PORT211, GPIO_PORT212, GPIO_PORT213, GPIO_PORT214,
66 GPIO_PORT215, GPIO_PORT216, GPIO_PORT217, GPIO_PORT218, GPIO_PORT219,
67
68 GPIO_PORT220, GPIO_PORT221, GPIO_PORT222, GPIO_PORT223, GPIO_PORT224,
69 GPIO_PORT225, GPIO_PORT226, GPIO_PORT227, GPIO_PORT228, GPIO_PORT229,
70
71 GPIO_PORT230, GPIO_PORT231, GPIO_PORT232, GPIO_PORT233, GPIO_PORT234,
72 GPIO_PORT235, GPIO_PORT236, GPIO_PORT237, GPIO_PORT238, GPIO_PORT239,
73
74 GPIO_PORT240, GPIO_PORT241, GPIO_PORT242, GPIO_PORT243, GPIO_PORT244,
75 GPIO_PORT245, GPIO_PORT246, GPIO_PORT247, GPIO_PORT248, GPIO_PORT249,
76
77 GPIO_PORT250, GPIO_PORT251, GPIO_PORT252, GPIO_PORT253, GPIO_PORT254,
78 GPIO_PORT255, GPIO_PORT256, GPIO_PORT257, GPIO_PORT258, GPIO_PORT259,
79
80 GPIO_PORT260, GPIO_PORT261, GPIO_PORT262, GPIO_PORT263, GPIO_PORT264,
81 GPIO_PORT265, GPIO_PORT266, GPIO_PORT267, GPIO_PORT268, GPIO_PORT269,
82
83 GPIO_PORT270, GPIO_PORT271, GPIO_PORT272, GPIO_PORT273, GPIO_PORT274,
84 GPIO_PORT275, GPIO_PORT276, GPIO_PORT277, GPIO_PORT278, GPIO_PORT279,
85
86 GPIO_PORT280, GPIO_PORT281, GPIO_PORT282,
87
88 GPIO_PORT288, GPIO_PORT289,
89
90 GPIO_PORT290, GPIO_PORT291, GPIO_PORT292, GPIO_PORT293, GPIO_PORT294,
91 GPIO_PORT295, GPIO_PORT296, GPIO_PORT297, GPIO_PORT298, GPIO_PORT299,
92
93 GPIO_PORT300, GPIO_PORT301, GPIO_PORT302, GPIO_PORT303, GPIO_PORT304,
94 GPIO_PORT305, GPIO_PORT306, GPIO_PORT307, GPIO_PORT308, GPIO_PORT309,
95
96 /* Table 25-1 (Function 0-7) */
97 GPIO_FN_GPI0 = 310,
98 GPIO_FN_GPI1,
99 GPIO_FN_GPI2,
100 GPIO_FN_GPI3,
101 GPIO_FN_GPI4,
102 GPIO_FN_GPI5,
103 GPIO_FN_GPI6,
104 GPIO_FN_GPI7,
105 GPIO_FN_GPO7, GPIO_FN_MFG0_OUT2,
106 GPIO_FN_GPO6, GPIO_FN_MFG1_OUT2,
107 GPIO_FN_GPO5,
108 GPIO_FN_PORT16_VIO_CKOR,
109 GPIO_FN_PORT19_VIO_CKO2,
110 GPIO_FN_GPO0,
111 GPIO_FN_GPO1,
112 GPIO_FN_GPO2, GPIO_FN_STATUS0,
113 GPIO_FN_GPO3, GPIO_FN_STATUS1,
114 GPIO_FN_GPO4, GPIO_FN_STATUS2,
115 GPIO_FN_VINT,
116 GPIO_FN_TCKON,
117 GPIO_FN_XDVFS1,
118 GPIO_FN_MFG0_OUT1, GPIO_FN_PORT27_IROUT,
119 GPIO_FN_XDVFS2,
120 GPIO_FN_PORT28_TPU1TO1,
121 GPIO_FN_SIM_RST, GPIO_FN_PORT29_TPU1TO1,
122 GPIO_FN_SIM_CLK, GPIO_FN_PORT30_VIO_CKOR,
123 GPIO_FN_SIM_D, GPIO_FN_PORT31_IROUT,
124 GPIO_FN_XWUP,
125 GPIO_FN_VACK,
126 GPIO_FN_XTAL1L,
127 GPIO_FN_PORT49_IROUT,
128 GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2,
129
130 GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3,
131 GPIO_FN_BBIF2_TXD2,
132 GPIO_FN_TPU3TO3,
133 GPIO_FN_TPU3TO2,
134 GPIO_FN_TPU0TO0,
135 GPIO_FN_A0, GPIO_FN_BS_,
136 GPIO_FN_A12, GPIO_FN_TPU4TO2,
137 GPIO_FN_A13, GPIO_FN_TPU0TO1,
138 GPIO_FN_A14,
139 GPIO_FN_A15,
140 GPIO_FN_A16, GPIO_FN_MSIOF0_SS1,
141 GPIO_FN_A17, GPIO_FN_MSIOF0_TSYNC,
142 GPIO_FN_A18, GPIO_FN_MSIOF0_TSCK,
143 GPIO_FN_A19, GPIO_FN_MSIOF0_TXD,
144 GPIO_FN_A20, GPIO_FN_MSIOF0_RSCK,
145 GPIO_FN_A21, GPIO_FN_MSIOF0_RSYNC,
146 GPIO_FN_A22, GPIO_FN_MSIOF0_MCK0,
147 GPIO_FN_A23, GPIO_FN_MSIOF0_MCK1,
148 GPIO_FN_A24, GPIO_FN_MSIOF0_RXD,
149 GPIO_FN_A25, GPIO_FN_MSIOF0_SS2,
150 GPIO_FN_A26,
151 GPIO_FN_FCE1_,
152 GPIO_FN_DACK0,
153 GPIO_FN_FCE0_,
154 GPIO_FN_WAIT_, GPIO_FN_DREQ0,
155 GPIO_FN_FRB,
156 GPIO_FN_CKO,
157 GPIO_FN_NBRSTOUT_,
158 GPIO_FN_NBRST_,
159 GPIO_FN_BBIF2_TXD,
160 GPIO_FN_BBIF2_RXD,
161 GPIO_FN_BBIF2_SYNC,
162 GPIO_FN_BBIF2_SCK,
163 GPIO_FN_MFG3_IN2,
164 GPIO_FN_MFG3_IN1,
165 GPIO_FN_BBIF1_SS2, GPIO_FN_MFG3_OUT1,
166 GPIO_FN_HSI_RX_DATA, GPIO_FN_BBIF1_RXD,
167 GPIO_FN_HSI_TX_WAKE, GPIO_FN_BBIF1_TSCK,
168 GPIO_FN_HSI_TX_DATA, GPIO_FN_BBIF1_TSYNC,
169 GPIO_FN_HSI_TX_READY, GPIO_FN_BBIF1_TXD,
170 GPIO_FN_HSI_RX_READY, GPIO_FN_BBIF1_RSCK,
171 GPIO_FN_HSI_RX_WAKE, GPIO_FN_BBIF1_RSYNC,
172 GPIO_FN_HSI_RX_FLAG, GPIO_FN_BBIF1_SS1, GPIO_FN_BBIF1_FLOW,
173 GPIO_FN_HSI_TX_FLAG,
174 GPIO_FN_VIO_VD, GPIO_FN_VIO2_VD,
175
176 GPIO_FN_VIO_HD,
177 GPIO_FN_VIO2_HD,
178 GPIO_FN_VIO_D0, GPIO_FN_PORT130_MSIOF2_RXD,
179 GPIO_FN_VIO_D1, GPIO_FN_PORT131_MSIOF2_SS1,
180 GPIO_FN_VIO_D2, GPIO_FN_PORT132_MSIOF2_SS2,
181 GPIO_FN_VIO_D3, GPIO_FN_MSIOF2_TSYNC,
182 GPIO_FN_VIO_D4, GPIO_FN_MSIOF2_TXD,
183 GPIO_FN_VIO_D5, GPIO_FN_MSIOF2_TSCK,
184 GPIO_FN_VIO_D6,
185 GPIO_FN_VIO_D7,
186 GPIO_FN_VIO_D8, GPIO_FN_VIO2_D0,
187 GPIO_FN_VIO_D9, GPIO_FN_VIO2_D1,
188 GPIO_FN_VIO_D10, GPIO_FN_TPU0TO2, GPIO_FN_VIO2_D2,
189 GPIO_FN_VIO_D11, GPIO_FN_TPU0TO3, GPIO_FN_VIO2_D3,
190 GPIO_FN_VIO_D12, GPIO_FN_VIO2_D4,
191 GPIO_FN_VIO_D13,
192 GPIO_FN_VIO2_D5,
193 GPIO_FN_VIO_D14, GPIO_FN_VIO2_D6,
194 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3,
195 GPIO_FN_VIO2_D7,
196 GPIO_FN_VIO_CLK,
197 GPIO_FN_VIO2_CLK,
198 GPIO_FN_VIO_FIELD, GPIO_FN_VIO2_FIELD,
199 GPIO_FN_VIO_CKO,
200 GPIO_FN_A27, GPIO_FN_MFG0_IN1,
201 GPIO_FN_MFG0_IN2,
202 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK,
203 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC,
204 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1,
205 GPIO_FN_MSIOF2_MCK0,
206 GPIO_FN_MSIOF2_MCK1,
207 GPIO_FN_PORT156_MSIOF2_SS2,
208 GPIO_FN_PORT157_MSIOF2_RXD,
209 GPIO_FN_DINT_, GPIO_FN_TS_SCK3,
210 GPIO_FN_NMI,
211 GPIO_FN_TPU3TO0,
212 GPIO_FN_BBIF2_TSYNC1,
213 GPIO_FN_BBIF2_TSCK1,
214 GPIO_FN_BBIF2_TXD1,
215 GPIO_FN_MFG2_OUT2,
216 GPIO_FN_TPU2TO1,
217 GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2,
218 GPIO_FN_D16,
219 GPIO_FN_D17,
220 GPIO_FN_D18,
221 GPIO_FN_D19,
222 GPIO_FN_D20,
223 GPIO_FN_D21,
224 GPIO_FN_D22,
225 GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_D23,
226 GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_D24,
227 GPIO_FN_D25,
228 GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26,
229 GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27,
230 GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28,
231 GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29,
232 GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30,
233 GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31,
234 GPIO_FN_DACK2,
235 GPIO_FN_MSIOF0L_TSYNC, GPIO_FN_VIO2_FIELD3,
236 GPIO_FN_DACK3,
237 GPIO_FN_PORT218_VIO_CKOR,
238 GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK, GPIO_FN_VIO2_CLK3, \
239 GPIO_FN_DREQ1,
240 GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD, GPIO_FN_VIO2_HD3, \
241 GPIO_FN_DACK1, GPIO_FN_OVCN,
242 GPIO_FN_MSIOF0L_TXD, GPIO_FN_VIO2_VD3,
243
244 GPIO_FN_OVCN2,
245 GPIO_FN_EXTLP, GPIO_FN_PORT226_VIO_CKO2,
246 GPIO_FN_IDIN,
247 GPIO_FN_MFG1_IN1,
248 GPIO_FN_MSIOF1_TXD,
249 GPIO_FN_MSIOF1_TSYNC,
250 GPIO_FN_MSIOF1_TSCK,
251 GPIO_FN_MSIOF1_RXD,
252 GPIO_FN_MSIOF1_RSCK, GPIO_FN_VIO2_CLK2,
253 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_MFG1_IN2, GPIO_FN_VIO2_VD2, \
254 GPIO_FN_MSIOF1_MCK0,
255 GPIO_FN_MSIOF1_MCK1,
256 GPIO_FN_MSIOF1_SS1, GPIO_FN_VIO2_FIELD2,
257 GPIO_FN_MSIOF1_SS2, GPIO_FN_VIO2_HD2,
258 GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1, \
259 GPIO_FN_TPU4TO0,
260 GPIO_FN_MFG4_IN2,
261 GPIO_FN_PORT243_VIO_CKO2,
262 GPIO_FN_MFG2_IN1,
263 GPIO_FN_MSIOF2R_RXD,
264 GPIO_FN_MFG2_IN2,
265 GPIO_FN_MSIOF2R_TXD,
266 GPIO_FN_MFG1_OUT1,
267 GPIO_FN_TPU1TO0,
268 GPIO_FN_MFG3_OUT2,
269 GPIO_FN_TPU3TO1,
270 GPIO_FN_MFG2_OUT1,
271 GPIO_FN_TPU2TO0,
272 GPIO_FN_MSIOF2R_TSCK,
273 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, \
274 GPIO_FN_MSIOF2R_TSYNC,
275 GPIO_FN_SDHICLK0,
276 GPIO_FN_SDHICD0,
277 GPIO_FN_SDHID0_0,
278 GPIO_FN_SDHID0_1,
279 GPIO_FN_SDHID0_2,
280 GPIO_FN_SDHID0_3,
281 GPIO_FN_SDHICMD0,
282 GPIO_FN_SDHIWP0,
283 GPIO_FN_SDHICLK1,
284 GPIO_FN_SDHID1_0, GPIO_FN_TS_SPSYNC2,
285 GPIO_FN_SDHID1_1, GPIO_FN_TS_SDAT2,
286 GPIO_FN_SDHID1_2, GPIO_FN_TS_SDEN2,
287 GPIO_FN_SDHID1_3, GPIO_FN_TS_SCK2,
288 GPIO_FN_SDHICMD1,
289 GPIO_FN_SDHICLK2,
290 GPIO_FN_SDHID2_0, GPIO_FN_TS_SPSYNC4,
291 GPIO_FN_SDHID2_1, GPIO_FN_TS_SDAT4,
292 GPIO_FN_SDHID2_2, GPIO_FN_TS_SDEN4,
293 GPIO_FN_SDHID2_3, GPIO_FN_TS_SCK4,
294 GPIO_FN_SDHICMD2,
295 GPIO_FN_MMCCLK0,
296 GPIO_FN_MMCD0_0,
297 GPIO_FN_MMCD0_1,
298 GPIO_FN_MMCD0_2,
299 GPIO_FN_MMCD0_3,
300 GPIO_FN_MMCD0_4, GPIO_FN_TS_SPSYNC5,
301 GPIO_FN_MMCD0_5, GPIO_FN_TS_SDAT5,
302 GPIO_FN_MMCD0_6, GPIO_FN_TS_SDEN5,
303 GPIO_FN_MMCD0_7, GPIO_FN_TS_SCK5,
304 GPIO_FN_MMCCMD0,
305 GPIO_FN_RESETOUTS_, GPIO_FN_EXTAL2OUT,
306 GPIO_FN_MCP_WAIT__MCP_FRB,
307 GPIO_FN_MCP_CKO, GPIO_FN_MMCCLK1,
308 GPIO_FN_MCP_D15_MCP_NAF15,
309 GPIO_FN_MCP_D14_MCP_NAF14,
310 GPIO_FN_MCP_D13_MCP_NAF13,
311 GPIO_FN_MCP_D12_MCP_NAF12,
312 GPIO_FN_MCP_D11_MCP_NAF11,
313 GPIO_FN_MCP_D10_MCP_NAF10,
314 GPIO_FN_MCP_D9_MCP_NAF9,
315 GPIO_FN_MCP_D8_MCP_NAF8, GPIO_FN_MMCCMD1,
316 GPIO_FN_MCP_D7_MCP_NAF7, GPIO_FN_MMCD1_7,
317
318 GPIO_FN_MCP_D6_MCP_NAF6, GPIO_FN_MMCD1_6,
319 GPIO_FN_MCP_D5_MCP_NAF5, GPIO_FN_MMCD1_5,
320 GPIO_FN_MCP_D4_MCP_NAF4, GPIO_FN_MMCD1_4,
321 GPIO_FN_MCP_D3_MCP_NAF3, GPIO_FN_MMCD1_3,
322 GPIO_FN_MCP_D2_MCP_NAF2, GPIO_FN_MMCD1_2,
323 GPIO_FN_MCP_D1_MCP_NAF1, GPIO_FN_MMCD1_1,
324 GPIO_FN_MCP_D0_MCP_NAF0, GPIO_FN_MMCD1_0,
325 GPIO_FN_MCP_NBRSTOUT_,
326 GPIO_FN_MCP_WE0__MCP_FWE, GPIO_FN_MCP_RDWR_MCP_FWE,
327
328 /* MSEL2 special case */
329 GPIO_FN_TSIF2_TS_XX1,
330 GPIO_FN_TSIF2_TS_XX2,
331 GPIO_FN_TSIF2_TS_XX3,
332 GPIO_FN_TSIF2_TS_XX4,
333 GPIO_FN_TSIF2_TS_XX5,
334 GPIO_FN_TSIF1_TS_XX1,
335 GPIO_FN_TSIF1_TS_XX2,
336 GPIO_FN_TSIF1_TS_XX3,
337 GPIO_FN_TSIF1_TS_XX4,
338 GPIO_FN_TSIF1_TS_XX5,
339 GPIO_FN_TSIF0_TS_XX1,
340 GPIO_FN_TSIF0_TS_XX2,
341 GPIO_FN_TSIF0_TS_XX3,
342 GPIO_FN_TSIF0_TS_XX4,
343 GPIO_FN_TSIF0_TS_XX5,
344 GPIO_FN_MST1_TS_XX1,
345 GPIO_FN_MST1_TS_XX2,
346 GPIO_FN_MST1_TS_XX3,
347 GPIO_FN_MST1_TS_XX4,
348 GPIO_FN_MST1_TS_XX5,
349 GPIO_FN_MST0_TS_XX1,
350 GPIO_FN_MST0_TS_XX2,
351 GPIO_FN_MST0_TS_XX3,
352 GPIO_FN_MST0_TS_XX4,
353 GPIO_FN_MST0_TS_XX5,
354
355 /* MSEL3 special cases */
356 GPIO_FN_SDHI0_VCCQ_MC0_ON,
357 GPIO_FN_SDHI0_VCCQ_MC0_OFF,
358 GPIO_FN_DEBUG_MON_VIO,
359 GPIO_FN_DEBUG_MON_LCDD,
360 GPIO_FN_LCDC_LCDC0,
361 GPIO_FN_LCDC_LCDC1,
362
363 /* MSEL4 special cases */
364 GPIO_FN_IRQ9_MEM_INT,
365 GPIO_FN_IRQ9_MCP_INT,
366 GPIO_FN_A11,
367 GPIO_FN_TPU4TO3,
368 GPIO_FN_RESETA_N_PU_ON,
369 GPIO_FN_RESETA_N_PU_OFF,
370 GPIO_FN_EDBGREQ_PD,
371 GPIO_FN_EDBGREQ_PU,
372
373 /* end of GPIO */
374 GPIO_NR,
375};
376 5
377/* DMA slave IDs */ 6/* DMA slave IDs */
378enum { 7enum {
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index e43402dd1dea..074bcb3892b5 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -429,18 +429,6 @@ config LEDS_ASIC3
429 cannot be used. This driver supports hardware blinking with an on+off 429 cannot be used. This driver supports hardware blinking with an on+off
430 period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700. 430 period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700.
431 431
432config LEDS_RENESAS_TPU
433 bool "LED support for Renesas TPU"
434 depends on LEDS_CLASS=y && HAVE_CLK && GPIOLIB
435 help
436 This option enables build of the LED TPU platform driver,
437 suitable to drive any TPU channel on newer Renesas SoCs.
438 The driver controls the GPIO pin connected to the LED via
439 the GPIO framework and expects the LED to be connected to
440 a pin that can be driven in both GPIO mode and using TPU
441 pin function. The latter to support brightness control.
442 Brightness control is supported but hardware blinking is not.
443
444config LEDS_TCA6507 432config LEDS_TCA6507
445 tristate "LED Support for TCA6507 I2C chip" 433 tristate "LED Support for TCA6507 I2C chip"
446 depends on LEDS_CLASS && I2C 434 depends on LEDS_CLASS && I2C
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index ac2897732b02..ae4b6135f665 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -49,7 +49,6 @@ obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
49obj-$(CONFIG_LEDS_NS2) += leds-ns2.o 49obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
50obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o 50obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
51obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o 51obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
52obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o
53obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o 52obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
54obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o 53obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o
55obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o 54obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c
deleted file mode 100644
index adebf4931e1e..000000000000
--- a/drivers/leds/leds-renesas-tpu.c
+++ /dev/null
@@ -1,337 +0,0 @@
1/*
2 * LED control using Renesas TPU
3 *
4 * Copyright (C) 2011 Magnus Damm
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; either 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23#include <linux/spinlock.h>
24#include <linux/printk.h>
25#include <linux/ioport.h>
26#include <linux/io.h>
27#include <linux/clk.h>
28#include <linux/leds.h>
29#include <linux/platform_data/leds-renesas-tpu.h>
30#include <linux/gpio.h>
31#include <linux/err.h>
32#include <linux/slab.h>
33#include <linux/pm_runtime.h>
34#include <linux/workqueue.h>
35
36enum r_tpu_pin { R_TPU_PIN_UNUSED, R_TPU_PIN_GPIO, R_TPU_PIN_GPIO_FN };
37enum r_tpu_timer { R_TPU_TIMER_UNUSED, R_TPU_TIMER_ON };
38
39struct r_tpu_priv {
40 struct led_classdev ldev;
41 void __iomem *mapbase;
42 struct clk *clk;
43 struct platform_device *pdev;
44 enum r_tpu_pin pin_state;
45 enum r_tpu_timer timer_state;
46 unsigned long min_rate;
47 unsigned int refresh_rate;
48 struct work_struct work;
49 enum led_brightness new_brightness;
50};
51
52static DEFINE_SPINLOCK(r_tpu_lock);
53
54#define TSTR -1 /* Timer start register (shared register) */
55#define TCR 0 /* Timer control register (+0x00) */
56#define TMDR 1 /* Timer mode register (+0x04) */
57#define TIOR 2 /* Timer I/O control register (+0x08) */
58#define TIER 3 /* Timer interrupt enable register (+0x0c) */
59#define TSR 4 /* Timer status register (+0x10) */
60#define TCNT 5 /* Timer counter (+0x14) */
61#define TGRA 6 /* Timer general register A (+0x18) */
62#define TGRB 7 /* Timer general register B (+0x1c) */
63#define TGRC 8 /* Timer general register C (+0x20) */
64#define TGRD 9 /* Timer general register D (+0x24) */
65
66static inline u16 r_tpu_read(struct r_tpu_priv *p, int reg_nr)
67{
68 struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
69 void __iomem *base = p->mapbase;
70 unsigned long offs = reg_nr << 2;
71
72 if (reg_nr == TSTR)
73 return ioread16(base - cfg->channel_offset);
74
75 return ioread16(base + offs);
76}
77
78static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr, u16 value)
79{
80 struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
81 void __iomem *base = p->mapbase;
82 unsigned long offs = reg_nr << 2;
83
84 if (reg_nr == TSTR) {
85 iowrite16(value, base - cfg->channel_offset);
86 return;
87 }
88
89 iowrite16(value, base + offs);
90}
91
92static void r_tpu_start_stop_ch(struct r_tpu_priv *p, int start)
93{
94 struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
95 unsigned long flags;
96 u16 value;
97
98 /* start stop register shared by multiple timer channels */
99 spin_lock_irqsave(&r_tpu_lock, flags);
100 value = r_tpu_read(p, TSTR);
101
102 if (start)
103 value |= 1 << cfg->timer_bit;
104 else
105 value &= ~(1 << cfg->timer_bit);
106
107 r_tpu_write(p, TSTR, value);
108 spin_unlock_irqrestore(&r_tpu_lock, flags);
109}
110
111static int r_tpu_enable(struct r_tpu_priv *p, enum led_brightness brightness)
112{
113 struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
114 int prescaler[] = { 1, 4, 16, 64 };
115 int k, ret;
116 unsigned long rate, tmp;
117
118 if (p->timer_state == R_TPU_TIMER_ON)
119 return 0;
120
121 /* wake up device and enable clock */
122 pm_runtime_get_sync(&p->pdev->dev);
123 ret = clk_enable(p->clk);
124 if (ret) {
125 dev_err(&p->pdev->dev, "cannot enable clock\n");
126 return ret;
127 }
128
129 /* make sure channel is disabled */
130 r_tpu_start_stop_ch(p, 0);
131
132 /* get clock rate after enabling it */
133 rate = clk_get_rate(p->clk);
134
135 /* pick the lowest acceptable rate */
136 for (k = ARRAY_SIZE(prescaler) - 1; k >= 0; k--)
137 if ((rate / prescaler[k]) >= p->min_rate)
138 break;
139
140 if (k < 0) {
141 dev_err(&p->pdev->dev, "clock rate mismatch\n");
142 goto err0;
143 }
144 dev_dbg(&p->pdev->dev, "rate = %lu, prescaler %u\n",
145 rate, prescaler[k]);
146
147 /* clear TCNT on TGRB match, count on rising edge, set prescaler */
148 r_tpu_write(p, TCR, 0x0040 | k);
149
150 /* output 0 until TGRA, output 1 until TGRB */
151 r_tpu_write(p, TIOR, 0x0002);
152
153 rate /= prescaler[k] * p->refresh_rate;
154 r_tpu_write(p, TGRB, rate);
155 dev_dbg(&p->pdev->dev, "TRGB = 0x%04lx\n", rate);
156
157 tmp = (cfg->max_brightness - brightness) * rate;
158 r_tpu_write(p, TGRA, tmp / cfg->max_brightness);
159 dev_dbg(&p->pdev->dev, "TRGA = 0x%04lx\n", tmp / cfg->max_brightness);
160
161 /* PWM mode */
162 r_tpu_write(p, TMDR, 0x0002);
163
164 /* enable channel */
165 r_tpu_start_stop_ch(p, 1);
166
167 p->timer_state = R_TPU_TIMER_ON;
168 return 0;
169 err0:
170 clk_disable(p->clk);
171 pm_runtime_put_sync(&p->pdev->dev);
172 return -ENOTSUPP;
173}
174
175static void r_tpu_disable(struct r_tpu_priv *p)
176{
177 if (p->timer_state == R_TPU_TIMER_UNUSED)
178 return;
179
180 /* disable channel */
181 r_tpu_start_stop_ch(p, 0);
182
183 /* stop clock and mark device as idle */
184 clk_disable(p->clk);
185 pm_runtime_put_sync(&p->pdev->dev);
186
187 p->timer_state = R_TPU_TIMER_UNUSED;
188}
189
190static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state,
191 enum led_brightness brightness)
192{
193 struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
194
195 if (p->pin_state == new_state) {
196 if (p->pin_state == R_TPU_PIN_GPIO)
197 gpio_set_value(cfg->pin_gpio, brightness);
198 return;
199 }
200
201 if (p->pin_state == R_TPU_PIN_GPIO)
202 gpio_free(cfg->pin_gpio);
203
204 if (p->pin_state == R_TPU_PIN_GPIO_FN)
205 gpio_free(cfg->pin_gpio_fn);
206
207 if (new_state == R_TPU_PIN_GPIO)
208 gpio_request_one(cfg->pin_gpio, !!brightness ?
209 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
210 cfg->name);
211
212 if (new_state == R_TPU_PIN_GPIO_FN)
213 gpio_request(cfg->pin_gpio_fn, cfg->name);
214
215 p->pin_state = new_state;
216}
217
218static void r_tpu_work(struct work_struct *work)
219{
220 struct r_tpu_priv *p = container_of(work, struct r_tpu_priv, work);
221 enum led_brightness brightness = p->new_brightness;
222
223 r_tpu_disable(p);
224
225 /* off and maximum are handled as GPIO pins, in between PWM */
226 if ((brightness == 0) || (brightness == p->ldev.max_brightness))
227 r_tpu_set_pin(p, R_TPU_PIN_GPIO, brightness);
228 else {
229 r_tpu_set_pin(p, R_TPU_PIN_GPIO_FN, 0);
230 r_tpu_enable(p, brightness);
231 }
232}
233
234static void r_tpu_set_brightness(struct led_classdev *ldev,
235 enum led_brightness brightness)
236{
237 struct r_tpu_priv *p = container_of(ldev, struct r_tpu_priv, ldev);
238 p->new_brightness = brightness;
239 schedule_work(&p->work);
240}
241
242static int r_tpu_probe(struct platform_device *pdev)
243{
244 struct led_renesas_tpu_config *cfg = pdev->dev.platform_data;
245 struct r_tpu_priv *p;
246 struct resource *res;
247 int ret;
248
249 if (!cfg) {
250 dev_err(&pdev->dev, "missing platform data\n");
251 return -ENODEV;
252 }
253
254 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
255 if (p == NULL) {
256 dev_err(&pdev->dev, "failed to allocate driver data\n");
257 return -ENOMEM;
258 }
259
260 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
261 if (!res) {
262 dev_err(&pdev->dev, "failed to get I/O memory\n");
263 return -ENXIO;
264 }
265
266 /* map memory, let mapbase point to our channel */
267 p->mapbase = devm_ioremap_nocache(&pdev->dev, res->start,
268 resource_size(res));
269 if (p->mapbase == NULL) {
270 dev_err(&pdev->dev, "failed to remap I/O memory\n");
271 return -ENXIO;
272 }
273
274 /* get hold of clock */
275 p->clk = devm_clk_get(&pdev->dev, NULL);
276 if (IS_ERR(p->clk)) {
277 dev_err(&pdev->dev, "cannot get clock\n");
278 return PTR_ERR(p->clk);
279 }
280
281 p->pdev = pdev;
282 p->pin_state = R_TPU_PIN_UNUSED;
283 p->timer_state = R_TPU_TIMER_UNUSED;
284 p->refresh_rate = cfg->refresh_rate ? cfg->refresh_rate : 100;
285 r_tpu_set_pin(p, R_TPU_PIN_GPIO, LED_OFF);
286 platform_set_drvdata(pdev, p);
287
288 INIT_WORK(&p->work, r_tpu_work);
289
290 p->ldev.name = cfg->name;
291 p->ldev.brightness = LED_OFF;
292 p->ldev.max_brightness = cfg->max_brightness;
293 p->ldev.brightness_set = r_tpu_set_brightness;
294 p->ldev.flags |= LED_CORE_SUSPENDRESUME;
295 ret = led_classdev_register(&pdev->dev, &p->ldev);
296 if (ret < 0)
297 goto err0;
298
299 /* max_brightness may be updated by the LED core code */
300 p->min_rate = p->ldev.max_brightness * p->refresh_rate;
301
302 pm_runtime_enable(&pdev->dev);
303 return 0;
304
305 err0:
306 r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
307 return ret;
308}
309
310static int r_tpu_remove(struct platform_device *pdev)
311{
312 struct r_tpu_priv *p = platform_get_drvdata(pdev);
313
314 r_tpu_set_brightness(&p->ldev, LED_OFF);
315 led_classdev_unregister(&p->ldev);
316 cancel_work_sync(&p->work);
317 r_tpu_disable(p);
318 r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
319
320 pm_runtime_disable(&pdev->dev);
321
322 return 0;
323}
324
325static struct platform_driver r_tpu_device_driver = {
326 .probe = r_tpu_probe,
327 .remove = r_tpu_remove,
328 .driver = {
329 .name = "leds-renesas-tpu",
330 }
331};
332
333module_platform_driver(r_tpu_device_driver);
334
335MODULE_AUTHOR("Magnus Damm");
336MODULE_DESCRIPTION("Renesas TPU LED Driver");
337MODULE_LICENSE("GPL v2");
diff --git a/include/linux/platform_data/leds-renesas-tpu.h b/include/linux/platform_data/leds-renesas-tpu.h
deleted file mode 100644
index 055387086fc1..000000000000
--- a/include/linux/platform_data/leds-renesas-tpu.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LEDS_RENESAS_TPU_H__
2#define __LEDS_RENESAS_TPU_H__
3
4struct led_renesas_tpu_config {
5 char *name;
6 unsigned pin_gpio_fn;
7 unsigned pin_gpio;
8 unsigned int channel_offset;
9 unsigned int timer_bit;
10 unsigned int max_brightness;
11 unsigned int refresh_rate;
12};
13
14#endif /* __LEDS_RENESAS_TPU_H__ */