]> err.no Git - linux-2.6/commitdiff
[ARM] 4752/1: [AT91] RTT, RTC and WDT peripherals on SAM9
authorAndrew Victor <linux@maxim.org.za>
Wed, 23 Jan 2008 08:11:13 +0000 (09:11 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 26 Jan 2008 15:00:31 +0000 (15:00 +0000)
Add platform_device and initialization for the RTT (Real Time Timer)
and WDT (Watchdog) integrated in the Atmel AT91SAM9 processors.

For SAM9263, register both RTT peripherals.
   [From: David Brownell <dbrownell@users.sourceforge.net>]

Provide platform_resources for RTT peripherals
  [From: David Brownell <dbrownell@users.sourceforge.net>]

Add support for RTC peripheral on AT91SAM9RL (same RTC peripherals as
AT91RM9200)
  [From: David Brownell <dbrownell@users.sourceforge.net>]

Signed-off-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
include/asm-arm/arch-at91/at91_rtt.h

index 3091bf47d8c96dafb90e694005c3d2f99df7e1df..1533556fb8730bc7948cf63b986e15ba256e8090 100644 (file)
@@ -538,6 +538,51 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
 #endif
 
 
+/* --------------------------------------------------------------------
+ *  RTT
+ * -------------------------------------------------------------------- */
+
+static struct resource rtt_resources[] = {
+       {
+               .start  = AT91_BASE_SYS + AT91_RTT,
+               .end    = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device at91sam9260_rtt_device = {
+       .name           = "at91_rtt",
+       .id             = -1,
+       .resource       = rtt_resources,
+       .num_resources  = ARRAY_SIZE(rtt_resources),
+};
+
+static void __init at91_add_device_rtt(void)
+{
+       platform_device_register(&at91sam9260_rtt_device);
+}
+
+
+/* --------------------------------------------------------------------
+ *  Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+static struct platform_device at91sam9260_wdt_device = {
+       .name           = "at91_wdt",
+       .id             = -1,
+       .num_resources  = 0,
+};
+
+static void __init at91_add_device_watchdog(void)
+{
+       platform_device_register(&at91sam9260_wdt_device);
+}
+#else
+static void __init at91_add_device_watchdog(void) {}
+#endif
+
+
 /* --------------------------------------------------------------------
  *  LEDs
  * -------------------------------------------------------------------- */
@@ -898,6 +943,8 @@ void __init at91_add_device_serial(void) {}
  */
 static int __init at91_add_standard_devices(void)
 {
+       at91_add_device_rtt();
+       at91_add_device_watchdog();
        return 0;
 }
 
index 1d03844a607a802ca9e0ab31feb4ae8225376ca4..17f3f6a2479692e93eb5f7433c295eedcaceb5fb 100644 (file)
@@ -550,6 +550,51 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
 #endif
 
 
+/* --------------------------------------------------------------------
+ *  RTT
+ * -------------------------------------------------------------------- */
+
+static struct resource rtt_resources[] = {
+       {
+               .start  = AT91_BASE_SYS + AT91_RTT,
+               .end    = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device at91sam9261_rtt_device = {
+       .name           = "at91_rtt",
+       .id             = -1,
+       .resource       = rtt_resources,
+       .num_resources  = ARRAY_SIZE(rtt_resources),
+};
+
+static void __init at91_add_device_rtt(void)
+{
+       platform_device_register(&at91sam9261_rtt_device);
+}
+
+
+/* --------------------------------------------------------------------
+ *  Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+static struct platform_device at91sam9261_wdt_device = {
+       .name           = "at91_wdt",
+       .id             = -1,
+       .num_resources  = 0,
+};
+
+static void __init at91_add_device_watchdog(void)
+{
+       platform_device_register(&at91sam9261_wdt_device);
+}
+#else
+static void __init at91_add_device_watchdog(void) {}
+#endif
+
+
 /* --------------------------------------------------------------------
  *  LEDs
  * -------------------------------------------------------------------- */
@@ -786,6 +831,8 @@ void __init at91_add_device_serial(void) {}
  */
 static int __init at91_add_standard_devices(void)
 {
+       at91_add_device_rtt();
+       at91_add_device_watchdog();
        return 0;
 }
 
index d50a8dfb916dd7bdb3b03fc2ad08d2aa67140a62..b4eb21769db917421c5e173989768fa0cfdc19b5 100644 (file)
@@ -781,6 +781,67 @@ void __init at91_add_device_isi(void) {}
 #endif
 
 
+/* --------------------------------------------------------------------
+ *  RTT
+ * -------------------------------------------------------------------- */
+
+static struct resource rtt0_resources[] = {
+       {
+               .start  = AT91_BASE_SYS + AT91_RTT0,
+               .end    = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device at91sam9263_rtt0_device = {
+       .name           = "at91_rtt",
+       .id             = 0,
+       .resource       = rtt0_resources,
+       .num_resources  = ARRAY_SIZE(rtt0_resources),
+};
+
+static struct resource rtt1_resources[] = {
+       {
+               .start  = AT91_BASE_SYS + AT91_RTT1,
+               .end    = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device at91sam9263_rtt1_device = {
+       .name           = "at91_rtt",
+       .id             = 1,
+       .resource       = rtt1_resources,
+       .num_resources  = ARRAY_SIZE(rtt1_resources),
+};
+
+static void __init at91_add_device_rtt(void)
+{
+       platform_device_register(&at91sam9263_rtt0_device);
+       platform_device_register(&at91sam9263_rtt1_device);
+}
+
+
+/* --------------------------------------------------------------------
+ *  Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+static struct platform_device at91sam9263_wdt_device = {
+       .name           = "at91_wdt",
+       .id             = -1,
+       .num_resources  = 0,
+};
+
+static void __init at91_add_device_watchdog(void)
+{
+       platform_device_register(&at91sam9263_wdt_device);
+}
+#else
+static void __init at91_add_device_watchdog(void) {}
+#endif
+
+
 /* --------------------------------------------------------------------
  *  LEDs
  * -------------------------------------------------------------------- */
@@ -1021,6 +1082,8 @@ void __init at91_add_device_serial(void) {}
  */
 static int __init at91_add_standard_devices(void)
 {
+       at91_add_device_rtt();
+       at91_add_device_watchdog();
        return 0;
 }
 
index 2bd60a3dc6233cac740694121785f8edac22f81a..19ca71d3faab94f7a29e7c8975c9d5cdde5d9ac0 100644 (file)
@@ -383,6 +383,71 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
 #endif
 
 
+/* --------------------------------------------------------------------
+ *  RTC
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
+static struct platform_device at91sam9rl_rtc_device = {
+       .name           = "at91_rtc",
+       .id             = -1,
+       .num_resources  = 0,
+};
+
+static void __init at91_add_device_rtc(void)
+{
+       platform_device_register(&at91sam9rl_rtc_device);
+}
+#else
+static void __init at91_add_device_rtc(void) {}
+#endif
+
+
+/* --------------------------------------------------------------------
+ *  RTT
+ * -------------------------------------------------------------------- */
+
+static struct resource rtt_resources[] = {
+       {
+               .start  = AT91_BASE_SYS + AT91_RTT,
+               .end    = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device at91sam9rl_rtt_device = {
+       .name           = "at91_rtt",
+       .id             = -1,
+       .resource       = rtt_resources,
+       .num_resources  = ARRAY_SIZE(rtt_resources),
+};
+
+static void __init at91_add_device_rtt(void)
+{
+       platform_device_register(&at91sam9rl_rtt_device);
+}
+
+
+/* --------------------------------------------------------------------
+ *  Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+static struct platform_device at91sam9rl_wdt_device = {
+       .name           = "at91_wdt",
+       .id             = -1,
+       .num_resources  = 0,
+};
+
+static void __init at91_add_device_watchdog(void)
+{
+       platform_device_register(&at91sam9rl_wdt_device);
+}
+#else
+static void __init at91_add_device_watchdog(void) {}
+#endif
+
+
 /* --------------------------------------------------------------------
  *  LEDs
  * -------------------------------------------------------------------- */
@@ -659,6 +724,9 @@ void __init at91_add_device_serial(void) {}
  */
 static int __init at91_add_standard_devices(void)
 {
+       at91_add_device_rtc();
+       at91_add_device_rtt();
+       at91_add_device_watchdog();
        return 0;
 }
 
index bae1103fbbb29e0f1e0b0b5020da0246b213319b..39a32633b275a3913a1d971ef74e19d64028ba07 100644 (file)
 #ifndef AT91_RTT_H
 #define AT91_RTT_H
 
-#define AT91_RTT_MR            (AT91_RTT + 0x00)       /* Real-time Mode Register */
+#define AT91_RTT_MR            0x00                    /* Real-time Mode Register */
 #define                AT91_RTT_RTPRES         (0xffff << 0)           /* Real-time Timer Prescaler Value */
 #define                AT91_RTT_ALMIEN         (1 << 16)               /* Alarm Interrupt Enable */
 #define                AT91_RTT_RTTINCIEN      (1 << 17)               /* Real Time Timer Increment Interrupt Enable */
 #define                AT91_RTT_RTTRST         (1 << 18)               /* Real Time Timer Restart */
 
-#define AT91_RTT_AR            (AT91_RTT + 0x04)       /* Real-time Alarm Register */
+#define AT91_RTT_AR            0x04                    /* Real-time Alarm Register */
 #define                AT91_RTT_ALMV           (0xffffffff)            /* Alarm Value */
 
-#define AT91_RTT_VR            (AT91_RTT + 0x08)       /* Real-time Value Register */
+#define AT91_RTT_VR            0x08                    /* Real-time Value Register */
 #define                AT91_RTT_CRTV           (0xffffffff)            /* Current Real-time Value */
 
-#define AT91_RTT_SR            (AT91_RTT + 0x0c)       /* Real-time Status Register */
+#define AT91_RTT_SR            0x0c                    /* Real-time Status Register */
 #define                AT91_RTT_ALMS           (1 << 0)                /* Real-time Alarm Status */
 #define                AT91_RTT_RTTINC         (1 << 1)                /* Real-time Timer Increment */