diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-09-18 14:42:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-21 17:58:37 -0400 |
commit | bb1ad68b96a68e577a87ad62fe1aa26d052a52b5 (patch) | |
tree | a98d65d54a4f441329f83988ffb9bea16e7d396e /arch/arm/mach-at91/at91sam9rl_devices.c | |
parent | e505240b6a6fd47b84cfeb1272ffeacd3e0874b3 (diff) |
[ARM] 5258/1: [AT91] PWM controller initialization
Add platform_devices and configuration of the PWM controller found on
Atmel AT91CAP9, SAM9263 and SAM9RL processors.
SAM9263 support by Sedji Gaouaou.
Signed-off-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 620886341fb5..3f9fed4902b8 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -592,6 +592,59 @@ static void __init at91_add_device_watchdog(void) {} | |||
592 | 592 | ||
593 | 593 | ||
594 | /* -------------------------------------------------------------------- | 594 | /* -------------------------------------------------------------------- |
595 | * PWM | ||
596 | * --------------------------------------------------------------------*/ | ||
597 | |||
598 | #if defined(CONFIG_ATMEL_PWM) | ||
599 | static u32 pwm_mask; | ||
600 | |||
601 | static struct resource pwm_resources[] = { | ||
602 | [0] = { | ||
603 | .start = AT91SAM9RL_BASE_PWMC, | ||
604 | .end = AT91SAM9RL_BASE_PWMC + SZ_16K - 1, | ||
605 | .flags = IORESOURCE_MEM, | ||
606 | }, | ||
607 | [1] = { | ||
608 | .start = AT91SAM9RL_ID_PWMC, | ||
609 | .end = AT91SAM9RL_ID_PWMC, | ||
610 | .flags = IORESOURCE_IRQ, | ||
611 | }, | ||
612 | }; | ||
613 | |||
614 | static struct platform_device at91sam9rl_pwm0_device = { | ||
615 | .name = "atmel_pwm", | ||
616 | .id = -1, | ||
617 | .dev = { | ||
618 | .platform_data = &pwm_mask, | ||
619 | }, | ||
620 | .resource = pwm_resources, | ||
621 | .num_resources = ARRAY_SIZE(pwm_resources), | ||
622 | }; | ||
623 | |||
624 | void __init at91_add_device_pwm(u32 mask) | ||
625 | { | ||
626 | if (mask & (1 << AT91_PWM0)) | ||
627 | at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM0 */ | ||
628 | |||
629 | if (mask & (1 << AT91_PWM1)) | ||
630 | at91_set_B_periph(AT91_PIN_PB9, 1); /* enable PWM1 */ | ||
631 | |||
632 | if (mask & (1 << AT91_PWM2)) | ||
633 | at91_set_B_periph(AT91_PIN_PD5, 1); /* enable PWM2 */ | ||
634 | |||
635 | if (mask & (1 << AT91_PWM3)) | ||
636 | at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */ | ||
637 | |||
638 | pwm_mask = mask; | ||
639 | |||
640 | platform_device_register(&at91sam9rl_pwm0_device); | ||
641 | } | ||
642 | #else | ||
643 | void __init at91_add_device_pwm(u32 mask) {} | ||
644 | #endif | ||
645 | |||
646 | |||
647 | /* -------------------------------------------------------------------- | ||
595 | * SSC -- Synchronous Serial Controller | 648 | * SSC -- Synchronous Serial Controller |
596 | * -------------------------------------------------------------------- */ | 649 | * -------------------------------------------------------------------- */ |
597 | 650 | ||