|
@@ -827,3 +827,200 @@ static struct platform_device at91sam9260_dbgu_device = {
|
|
|
.name = "atmel_usart",
|
|
|
.id = 0,
|
|
|
.dev = {
|
|
|
+ .dma_mask = &dbgu_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &dbgu_data,
|
|
|
+ },
|
|
|
+ .resource = dbgu_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(dbgu_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static inline void configure_dbgu_pins(void)
|
|
|
+{
|
|
|
+ at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource uart0_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9260_BASE_US0,
|
|
|
+ .end = AT91SAM9260_BASE_US0 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct atmel_uart_data uart0_data = {
|
|
|
+ .use_dma_tx = 1,
|
|
|
+ .use_dma_rx = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static u64 uart0_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|
|
|
+static struct platform_device at91sam9260_uart0_device = {
|
|
|
+ .name = "atmel_usart",
|
|
|
+ .id = 1,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &uart0_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &uart0_data,
|
|
|
+ },
|
|
|
+ .resource = uart0_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(uart0_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static inline void configure_usart0_pins(unsigned pins)
|
|
|
+{
|
|
|
+ at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
|
|
|
+
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
|
|
|
+ if (pins & ATMEL_UART_DTR)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
|
|
|
+ if (pins & ATMEL_UART_DSR)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
|
|
|
+ if (pins & ATMEL_UART_DCD)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
|
|
|
+ if (pins & ATMEL_UART_RI)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource uart1_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9260_BASE_US1,
|
|
|
+ .end = AT91SAM9260_BASE_US1 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct atmel_uart_data uart1_data = {
|
|
|
+ .use_dma_tx = 1,
|
|
|
+ .use_dma_rx = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static u64 uart1_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|
|
|
+static struct platform_device at91sam9260_uart1_device = {
|
|
|
+ .name = "atmel_usart",
|
|
|
+ .id = 2,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &uart1_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &uart1_data,
|
|
|
+ },
|
|
|
+ .resource = uart1_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(uart1_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static inline void configure_usart1_pins(unsigned pins)
|
|
|
+{
|
|
|
+ at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
|
|
|
+
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource uart2_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9260_BASE_US2,
|
|
|
+ .end = AT91SAM9260_BASE_US2 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct atmel_uart_data uart2_data = {
|
|
|
+ .use_dma_tx = 1,
|
|
|
+ .use_dma_rx = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static u64 uart2_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|
|
|
+static struct platform_device at91sam9260_uart2_device = {
|
|
|
+ .name = "atmel_usart",
|
|
|
+ .id = 3,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &uart2_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &uart2_data,
|
|
|
+ },
|
|
|
+ .resource = uart2_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(uart2_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static inline void configure_usart2_pins(unsigned pins)
|
|
|
+{
|
|
|
+ at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
|
|
|
+
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
+ at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource uart3_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9260_BASE_US3,
|
|
|
+ .end = AT91SAM9260_BASE_US3 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct atmel_uart_data uart3_data = {
|
|
|
+ .use_dma_tx = 1,
|
|
|
+ .use_dma_rx = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static u64 uart3_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|
|
|
+static struct platform_device at91sam9260_uart3_device = {
|
|
|
+ .name = "atmel_usart",
|
|
|
+ .id = 4,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &uart3_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &uart3_data,
|
|
|
+ },
|
|
|
+ .resource = uart3_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(uart3_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static inline void configure_usart3_pins(unsigned pins)
|
|
|
+{
|
|
|
+ at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
|
|
|
+
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
+ at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
+ at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource uart4_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9260_BASE_US4,
|