aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9rl_devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c53
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)
599static u32 pwm_mask;
600
601static 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
614static 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
624void __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
643void __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