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/at91sam9263_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/at91sam9263_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index c93992f55dc9..8b884083f76d 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -886,6 +886,59 @@ static void __init at91_add_device_watchdog(void) {} | |||
886 | 886 | ||
887 | 887 | ||
888 | /* -------------------------------------------------------------------- | 888 | /* -------------------------------------------------------------------- |
889 | * PWM | ||
890 | * --------------------------------------------------------------------*/ | ||
891 | |||
892 | #if defined(CONFIG_ATMEL_PWM) | ||
893 | static u32 pwm_mask; | ||
894 | |||
895 | static struct resource pwm_resources[] = { | ||
896 | [0] = { | ||
897 | .start = AT91SAM9263_BASE_PWMC, | ||
898 | .end = AT91SAM9263_BASE_PWMC + SZ_16K - 1, | ||
899 | .flags = IORESOURCE_MEM, | ||
900 | }, | ||
901 | [1] = { | ||
902 | .start = AT91SAM9263_ID_PWMC, | ||
903 | .end = AT91SAM9263_ID_PWMC, | ||
904 | .flags = IORESOURCE_IRQ, | ||
905 | }, | ||
906 | }; | ||
907 | |||
908 | static struct platform_device at91sam9263_pwm0_device = { | ||
909 | .name = "atmel_pwm", | ||
910 | .id = -1, | ||
911 | .dev = { | ||
912 | .platform_data = &pwm_mask, | ||
913 | }, | ||
914 | .resource = pwm_resources, | ||
915 | .num_resources = ARRAY_SIZE(pwm_resources), | ||
916 | }; | ||
917 | |||
918 | void __init at91_add_device_pwm(u32 mask) | ||
919 | { | ||
920 | if (mask & (1 << AT91_PWM0)) | ||
921 | at91_set_B_periph(AT91_PIN_PB7, 1); /* enable PWM0 */ | ||
922 | |||
923 | if (mask & (1 << AT91_PWM1)) | ||
924 | at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */ | ||
925 | |||
926 | if (mask & (1 << AT91_PWM2)) | ||
927 | at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */ | ||
928 | |||
929 | if (mask & (1 << AT91_PWM3)) | ||
930 | at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */ | ||
931 | |||
932 | pwm_mask = mask; | ||
933 | |||
934 | platform_device_register(&at91sam9263_pwm0_device); | ||
935 | } | ||
936 | #else | ||
937 | void __init at91_add_device_pwm(u32 mask) {} | ||
938 | #endif | ||
939 | |||
940 | |||
941 | /* -------------------------------------------------------------------- | ||
889 | * SSC -- Synchronous Serial Controller | 942 | * SSC -- Synchronous Serial Controller |
890 | * -------------------------------------------------------------------- */ | 943 | * -------------------------------------------------------------------- */ |
891 | 944 | ||