|
@@ -696,3 +696,62 @@ static struct resource rtt_resources[] = {
|
|
|
static struct platform_device at91sam9rl_rtt_device = {
|
|
|
.name = "at91_rtt",
|
|
|
.id = 0,
|
|
|
+ .resource = rtt_resources,
|
|
|
+};
|
|
|
+
|
|
|
+#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
|
|
|
+static void __init at91_add_device_rtt_rtc(void)
|
|
|
+{
|
|
|
+ at91sam9rl_rtt_device.name = "rtc-at91sam9";
|
|
|
+ /*
|
|
|
+ * The second resource is needed:
|
|
|
+ * GPBR will serve as the storage for RTC time offset
|
|
|
+ */
|
|
|
+ at91sam9rl_rtt_device.num_resources = 3;
|
|
|
+ rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +
|
|
|
+ 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
|
|
|
+ rtt_resources[1].end = rtt_resources[1].start + 3;
|
|
|
+ rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
|
|
|
+ rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
|
|
|
+}
|
|
|
+#else
|
|
|
+static void __init at91_add_device_rtt_rtc(void)
|
|
|
+{
|
|
|
+ /* Only one resource is needed: RTT not used as RTC */
|
|
|
+ at91sam9rl_rtt_device.num_resources = 1;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+static void __init at91_add_device_rtt(void)
|
|
|
+{
|
|
|
+ at91_add_device_rtt_rtc();
|
|
|
+ platform_device_register(&at91sam9rl_rtt_device);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * Watchdog
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
|
|
|
+static struct resource wdt_resources[] = {
|
|
|
+ {
|
|
|
+ .start = AT91SAM9RL_BASE_WDT,
|
|
|
+ .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9rl_wdt_device = {
|
|
|
+ .name = "at91_wdt",
|
|
|
+ .id = -1,
|
|
|
+ .resource = wdt_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(wdt_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static void __init at91_add_device_watchdog(void)
|
|
|
+{
|
|
|
+ platform_device_register(&at91sam9rl_wdt_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+static void __init at91_add_device_watchdog(void) {}
|