aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-07-16 06:32:06 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-07-18 22:22:47 -0400
commitb885966f61b349baccf5c8c266f03407cfcea5ea (patch)
tree4d547bfb1c4982eb0d028b52eb50a83e3fb92b1f
parentd58226a21a7b84a3f82265821f24ce2aad267f1c (diff)
ARM: shmobile: kota2: Use leds-pwm + pwm-rmob
Instead of using the LED-specific TPU PWM driver, switch to the generic TPU PWM driver with leds-pwm. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c169
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c12
2 files changed, 90 insertions, 91 deletions
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 */