|
@@ -659,3 +659,171 @@ static struct platform_device at91sam9260_rtt_device = {
|
|
.name = "at91_rtt",
|
|
.name = "at91_rtt",
|
|
.id = 0,
|
|
.id = 0,
|
|
.resource = rtt_resources,
|
|
.resource = rtt_resources,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
|
|
|
|
+static void __init at91_add_device_rtt_rtc(void)
|
|
|
|
+{
|
|
|
|
+ at91sam9260_rtt_device.name = "rtc-at91sam9";
|
|
|
|
+ /*
|
|
|
|
+ * The second resource is needed:
|
|
|
|
+ * GPBR will serve as the storage for RTC time offset
|
|
|
|
+ */
|
|
|
|
+ at91sam9260_rtt_device.num_resources = 3;
|
|
|
|
+ rtt_resources[1].start = AT91SAM9260_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 */
|
|
|
|
+ at91sam9260_rtt_device.num_resources = 1;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+static void __init at91_add_device_rtt(void)
|
|
|
|
+{
|
|
|
|
+ at91_add_device_rtt_rtc();
|
|
|
|
+ platform_device_register(&at91sam9260_rtt_device);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * Watchdog
|
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
|
+
|
|
|
|
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
|
|
|
|
+static struct resource wdt_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = AT91SAM9260_BASE_WDT,
|
|
|
|
+ .end = AT91SAM9260_BASE_WDT + SZ_16 - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9260_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(&at91sam9260_wdt_device);
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static void __init at91_add_device_watchdog(void) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * SSC -- Synchronous Serial Controller
|
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
|
+
|
|
|
|
+#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
|
|
|
|
+static u64 ssc_dmamask = DMA_BIT_MASK(32);
|
|
|
|
+
|
|
|
|
+static struct resource ssc_resources[] = {
|
|
|
|
+ [0] = {
|
|
|
|
+ .start = AT91SAM9260_BASE_SSC,
|
|
|
|
+ .end = AT91SAM9260_BASE_SSC + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9260_ssc_device = {
|
|
|
|
+ .name = "at91rm9200_ssc",
|
|
|
|
+ .id = 0,
|
|
|
|
+ .dev = {
|
|
|
|
+ .dma_mask = &ssc_dmamask,
|
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
|
+ },
|
|
|
|
+ .resource = ssc_resources,
|
|
|
|
+ .num_resources = ARRAY_SIZE(ssc_resources),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static inline void configure_ssc_pins(unsigned pins)
|
|
|
|
+{
|
|
|
|
+ if (pins & ATMEL_SSC_TF)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB17, 1);
|
|
|
|
+ if (pins & ATMEL_SSC_TK)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB16, 1);
|
|
|
|
+ if (pins & ATMEL_SSC_TD)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB18, 1);
|
|
|
|
+ if (pins & ATMEL_SSC_RD)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB19, 1);
|
|
|
|
+ if (pins & ATMEL_SSC_RK)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB20, 1);
|
|
|
|
+ if (pins & ATMEL_SSC_RF)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB21, 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * SSC controllers are accessed through library code, instead of any
|
|
|
|
+ * kind of all-singing/all-dancing driver. For example one could be
|
|
|
|
+ * used by a particular I2S audio codec's driver, while another one
|
|
|
|
+ * on the same system might be used by a custom data capture driver.
|
|
|
|
+ */
|
|
|
|
+void __init at91_add_device_ssc(unsigned id, unsigned pins)
|
|
|
|
+{
|
|
|
|
+ struct platform_device *pdev;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * NOTE: caller is responsible for passing information matching
|
|
|
|
+ * "pins" to whatever will be using each particular controller.
|
|
|
|
+ */
|
|
|
|
+ switch (id) {
|
|
|
|
+ case AT91SAM9260_ID_SSC:
|
|
|
|
+ pdev = &at91sam9260_ssc_device;
|
|
|
|
+ configure_ssc_pins(pins);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ platform_device_register(pdev);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#else
|
|
|
|
+void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * UART
|
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
|
+#if defined(CONFIG_SERIAL_ATMEL)
|
|
|
|
+static struct resource dbgu_resources[] = {
|
|
|
|
+ [0] = {
|
|
|
|
+ .start = AT91SAM9260_BASE_DBGU,
|
|
|
|
+ .end = AT91SAM9260_BASE_DBGU + SZ_512 - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91_ID_SYS,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91_ID_SYS,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct atmel_uart_data dbgu_data = {
|
|
|
|
+ .use_dma_tx = 0,
|
|
|
|
+ .use_dma_rx = 0, /* DBGU not capable of receive DMA */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static u64 dbgu_dmamask = DMA_BIT_MASK(32);
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9260_dbgu_device = {
|
|
|
|
+ .name = "atmel_usart",
|
|
|
|
+ .id = 0,
|
|
|
|
+ .dev = {
|