|
@@ -1683,3 +1683,184 @@ static struct platform_device at91sam9g45_uart1_device = {
|
|
static inline void configure_usart1_pins(unsigned pins)
|
|
static inline void configure_usart1_pins(unsigned pins)
|
|
{
|
|
{
|
|
at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD1 */
|
|
at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD1 */
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD1 */
|
|
|
|
+
|
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PD16, 0); /* RTS1 */
|
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PD17, 0); /* CTS1 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct resource uart2_resources[] = {
|
|
|
|
+ [0] = {
|
|
|
|
+ .start = AT91SAM9G45_BASE_US2,
|
|
|
|
+ .end = AT91SAM9G45_BASE_US2 + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US2,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_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 at91sam9g45_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_PB6, 1); /* TXD2 */
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD2 */
|
|
|
|
+
|
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
|
+ at91_set_B_periph(AT91_PIN_PC9, 0); /* RTS2 */
|
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
|
+ at91_set_B_periph(AT91_PIN_PC11, 0); /* CTS2 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct resource uart3_resources[] = {
|
|
|
|
+ [0] = {
|
|
|
|
+ .start = AT91SAM9G45_BASE_US3,
|
|
|
|
+ .end = AT91SAM9G45_BASE_US3 + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US3,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_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 at91sam9g45_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_PB8, 1); /* TXD3 */
|
|
|
|
+ at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD3 */
|
|
|
|
+
|
|
|
|
+ if (pins & ATMEL_UART_RTS)
|
|
|
|
+ at91_set_B_periph(AT91_PIN_PA23, 0); /* RTS3 */
|
|
|
|
+ if (pins & ATMEL_UART_CTS)
|
|
|
|
+ at91_set_B_periph(AT91_PIN_PA24, 0); /* CTS3 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
|
|
|
|
+
|
|
|
|
+void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
|
|
|
|
+{
|
|
|
|
+ struct platform_device *pdev;
|
|
|
|
+ struct atmel_uart_data *pdata;
|
|
|
|
+
|
|
|
|
+ switch (id) {
|
|
|
|
+ case 0: /* DBGU */
|
|
|
|
+ pdev = &at91sam9g45_dbgu_device;
|
|
|
|
+ configure_dbgu_pins();
|
|
|
|
+ break;
|
|
|
|
+ case AT91SAM9G45_ID_US0:
|
|
|
|
+ pdev = &at91sam9g45_uart0_device;
|
|
|
|
+ configure_usart0_pins(pins);
|
|
|
|
+ break;
|
|
|
|
+ case AT91SAM9G45_ID_US1:
|
|
|
|
+ pdev = &at91sam9g45_uart1_device;
|
|
|
|
+ configure_usart1_pins(pins);
|
|
|
|
+ break;
|
|
|
|
+ case AT91SAM9G45_ID_US2:
|
|
|
|
+ pdev = &at91sam9g45_uart2_device;
|
|
|
|
+ configure_usart2_pins(pins);
|
|
|
|
+ break;
|
|
|
|
+ case AT91SAM9G45_ID_US3:
|
|
|
|
+ pdev = &at91sam9g45_uart3_device;
|
|
|
|
+ configure_usart3_pins(pins);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ pdata = pdev->dev.platform_data;
|
|
|
|
+ pdata->num = portnr; /* update to mapped ID */
|
|
|
|
+
|
|
|
|
+ if (portnr < ATMEL_MAX_UART)
|
|
|
|
+ at91_uarts[portnr] = pdev;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void __init at91_add_device_serial(void)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < ATMEL_MAX_UART; i++) {
|
|
|
|
+ if (at91_uarts[i])
|
|
|
|
+ platform_device_register(at91_uarts[i]);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
|
|
|
|
+void __init at91_add_device_serial(void) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * SHA1/SHA256
|
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
|
+
|
|
|
|
+#if defined(CONFIG_CRYPTO_DEV_ATMEL_SHA) || defined(CONFIG_CRYPTO_DEV_ATMEL_SHA_MODULE)
|
|
|
|
+static struct resource sha_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = AT91SAM9G45_BASE_SHA,
|
|
|
|
+ .end = AT91SAM9G45_BASE_SHA + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9g45_sha_device = {
|
|
|
|
+ .name = "atmel_sha",
|
|
|
|
+ .id = -1,
|
|
|
|
+ .resource = sha_resources,
|
|
|
|
+ .num_resources = ARRAY_SIZE(sha_resources),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void __init at91_add_device_sha(void)
|
|
|
|
+{
|
|
|
|
+ platform_device_register(&at91sam9g45_sha_device);
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static void __init at91_add_device_sha(void) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * DES/TDES
|