aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/at32ap700x.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2008-02-08 07:21:21 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:38 -0500
commit9a1e8eb1f0b76b5e72a2343ad881c81b08dd6410 (patch)
treef844d0e1316b49fd66cf773009ba2c3d46fcd18f /arch/avr32/mach-at32ap/at32ap700x.c
parentc8cece84c9f36410de5164735e909603426e4d5f (diff)
Basic PWM driver for AVR32 and AT91
PWM device setup, and a simple PWM driver exposing a programming interface giving access to each channel's full capabilities. Note that this doesn't support starting several channels in synch. [hskinnemoen@atmel.com: allocate platform device dynamically] [hskinnemoen@atmel.com: Kconfig fix] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Cc: Andrew Victor <linux@maxim.org.za> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 14e61f05e1f6..7678fee9a885 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1186,6 +1186,59 @@ err_dup_modedb:
1186#endif 1186#endif
1187 1187
1188/* -------------------------------------------------------------------- 1188/* --------------------------------------------------------------------
1189 * PWM
1190 * -------------------------------------------------------------------- */
1191static struct resource atmel_pwm0_resource[] __initdata = {
1192 PBMEM(0xfff01400),
1193 IRQ(24),
1194};
1195static struct clk atmel_pwm0_mck = {
1196 .name = "mck",
1197 .parent = &pbb_clk,
1198 .mode = pbb_clk_mode,
1199 .get_rate = pbb_clk_get_rate,
1200 .index = 5,
1201};
1202
1203struct platform_device *__init at32_add_device_pwm(u32 mask)
1204{
1205 struct platform_device *pdev;
1206
1207 if (!mask)
1208 return NULL;
1209
1210 pdev = platform_device_alloc("atmel_pwm", 0);
1211 if (!pdev)
1212 return NULL;
1213
1214 if (platform_device_add_resources(pdev, atmel_pwm0_resource,
1215 ARRAY_SIZE(atmel_pwm0_resource)))
1216 goto out_free_pdev;
1217
1218 if (platform_device_add_data(pdev, &mask, sizeof(mask)))
1219 goto out_free_pdev;
1220
1221 if (mask & (1 << 0))
1222 select_peripheral(PA(28), PERIPH_A, 0);
1223 if (mask & (1 << 1))
1224 select_peripheral(PA(29), PERIPH_A, 0);
1225 if (mask & (1 << 2))
1226 select_peripheral(PA(21), PERIPH_B, 0);
1227 if (mask & (1 << 3))
1228 select_peripheral(PA(22), PERIPH_B, 0);
1229
1230 atmel_pwm0_mck.dev = &pdev->dev;
1231
1232 platform_device_add(pdev);
1233
1234 return pdev;
1235
1236out_free_pdev:
1237 platform_device_put(pdev);
1238 return NULL;
1239}
1240
1241/* --------------------------------------------------------------------
1189 * SSC 1242 * SSC
1190 * -------------------------------------------------------------------- */ 1243 * -------------------------------------------------------------------- */
1191static struct resource ssc0_resource[] = { 1244static struct resource ssc0_resource[] = {
@@ -1646,6 +1699,7 @@ struct clk *at32_clock_list[] = {
1646 &atmel_usart1_usart, 1699 &atmel_usart1_usart,
1647 &atmel_usart2_usart, 1700 &atmel_usart2_usart,
1648 &atmel_usart3_usart, 1701 &atmel_usart3_usart,
1702 &atmel_pwm0_mck,
1649#if defined(CONFIG_CPU_AT32AP7000) 1703#if defined(CONFIG_CPU_AT32AP7000)
1650 &macb0_hclk, 1704 &macb0_hclk,
1651 &macb0_pclk, 1705 &macb0_pclk,