X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fmach-at91%2Fat91rm9200_devices.c;h=70d3a0018530e5f8ba29f3dd56513e4e7363a269;hb=e5f40bfaf309ec4cc27b717d48fb0824313e5ef8;hp=ef6aeb86e9805ba402c58cc70afdece13b009419;hpb=f4798748dee00c807a63f5518f08b3df161e0f6d;p=linux-2.6-omap-h63xx.git diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index ef6aeb86e98..70d3a001853 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c @@ -576,6 +576,90 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) #endif +/* -------------------------------------------------------------------- + * Timer/Counter blocks + * -------------------------------------------------------------------- */ + +#ifdef CONFIG_ATMEL_TCLIB + +static struct resource tcb0_resources[] = { + [0] = { + .start = AT91RM9200_BASE_TCB0, + .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AT91RM9200_ID_TC0, + .end = AT91RM9200_ID_TC0, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = AT91RM9200_ID_TC1, + .end = AT91RM9200_ID_TC1, + .flags = IORESOURCE_IRQ, + }, + [3] = { + .start = AT91RM9200_ID_TC2, + .end = AT91RM9200_ID_TC2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device at91rm9200_tcb0_device = { + .name = "atmel_tcb", + .id = 0, + .resource = tcb0_resources, + .num_resources = ARRAY_SIZE(tcb0_resources), +}; + +static struct resource tcb1_resources[] = { + [0] = { + .start = AT91RM9200_BASE_TCB1, + .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AT91RM9200_ID_TC3, + .end = AT91RM9200_ID_TC3, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = AT91RM9200_ID_TC4, + .end = AT91RM9200_ID_TC4, + .flags = IORESOURCE_IRQ, + }, + [3] = { + .start = AT91RM9200_ID_TC5, + .end = AT91RM9200_ID_TC5, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device at91rm9200_tcb1_device = { + .name = "atmel_tcb", + .id = 1, + .resource = tcb1_resources, + .num_resources = ARRAY_SIZE(tcb1_resources), +}; + +static void __init at91_add_device_tc(void) +{ + /* this chip has a separate clock and irq for each TC channel */ + at91_clock_associate("tc0_clk", &at91rm9200_tcb0_device.dev, "t0_clk"); + at91_clock_associate("tc1_clk", &at91rm9200_tcb0_device.dev, "t1_clk"); + at91_clock_associate("tc2_clk", &at91rm9200_tcb0_device.dev, "t2_clk"); + platform_device_register(&at91rm9200_tcb0_device); + + at91_clock_associate("tc3_clk", &at91rm9200_tcb1_device.dev, "t0_clk"); + at91_clock_associate("tc4_clk", &at91rm9200_tcb1_device.dev, "t1_clk"); + at91_clock_associate("tc5_clk", &at91rm9200_tcb1_device.dev, "t2_clk"); + platform_device_register(&at91rm9200_tcb1_device); +} +#else +static void __init at91_add_device_tc(void) { } +#endif + + /* -------------------------------------------------------------------- * RTC * -------------------------------------------------------------------- */ @@ -1141,6 +1225,7 @@ static int __init at91_add_standard_devices(void) { at91_add_device_rtc(); at91_add_device_watchdog(); + at91_add_device_tc(); return 0; }