2 * arch/arm/mach-at91/at91sam9260_devices.c
4 * Copyright (C) 2006 Atmel
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <asm/mach/arch.h>
13 #include <asm/mach/map.h>
15 #include <linux/platform_device.h>
16 #include <linux/i2c-gpio.h>
18 #include <asm/arch/board.h>
19 #include <asm/arch/gpio.h>
20 #include <asm/arch/at91sam9260.h>
21 #include <asm/arch/at91sam926x_mc.h>
22 #include <asm/arch/at91sam9260_matrix.h>
27 /* --------------------------------------------------------------------
29 * -------------------------------------------------------------------- */
31 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
32 static u64 ohci_dmamask = 0xffffffffUL;
33 static struct at91_usbh_data usbh_data;
35 static struct resource usbh_resources[] = {
37 .start = AT91SAM9260_UHP_BASE,
38 .end = AT91SAM9260_UHP_BASE + SZ_1M - 1,
39 .flags = IORESOURCE_MEM,
42 .start = AT91SAM9260_ID_UHP,
43 .end = AT91SAM9260_ID_UHP,
44 .flags = IORESOURCE_IRQ,
48 static struct platform_device at91_usbh_device = {
52 .dma_mask = &ohci_dmamask,
53 .coherent_dma_mask = 0xffffffff,
54 .platform_data = &usbh_data,
56 .resource = usbh_resources,
57 .num_resources = ARRAY_SIZE(usbh_resources),
60 void __init at91_add_device_usbh(struct at91_usbh_data *data)
66 platform_device_register(&at91_usbh_device);
69 void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
73 /* --------------------------------------------------------------------
75 * -------------------------------------------------------------------- */
77 #ifdef CONFIG_USB_GADGET_AT91
78 static struct at91_udc_data udc_data;
80 static struct resource udc_resources[] = {
82 .start = AT91SAM9260_BASE_UDP,
83 .end = AT91SAM9260_BASE_UDP + SZ_16K - 1,
84 .flags = IORESOURCE_MEM,
87 .start = AT91SAM9260_ID_UDP,
88 .end = AT91SAM9260_ID_UDP,
89 .flags = IORESOURCE_IRQ,
93 static struct platform_device at91_udc_device = {
97 .platform_data = &udc_data,
99 .resource = udc_resources,
100 .num_resources = ARRAY_SIZE(udc_resources),
103 void __init at91_add_device_udc(struct at91_udc_data *data)
108 if (data->vbus_pin) {
109 at91_set_gpio_input(data->vbus_pin, 0);
110 at91_set_deglitch(data->vbus_pin, 1);
113 /* Pullup pin is handled internally by USB device peripheral */
116 platform_device_register(&at91_udc_device);
119 void __init at91_add_device_udc(struct at91_udc_data *data) {}
123 /* --------------------------------------------------------------------
125 * -------------------------------------------------------------------- */
127 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
128 static u64 eth_dmamask = 0xffffffffUL;
129 static struct at91_eth_data eth_data;
131 static struct resource eth_resources[] = {
133 .start = AT91SAM9260_BASE_EMAC,
134 .end = AT91SAM9260_BASE_EMAC + SZ_16K - 1,
135 .flags = IORESOURCE_MEM,
138 .start = AT91SAM9260_ID_EMAC,
139 .end = AT91SAM9260_ID_EMAC,
140 .flags = IORESOURCE_IRQ,
144 static struct platform_device at91sam9260_eth_device = {
148 .dma_mask = ð_dmamask,
149 .coherent_dma_mask = 0xffffffff,
150 .platform_data = ð_data,
152 .resource = eth_resources,
153 .num_resources = ARRAY_SIZE(eth_resources),
156 void __init at91_add_device_eth(struct at91_eth_data *data)
161 if (data->phy_irq_pin) {
162 at91_set_gpio_input(data->phy_irq_pin, 0);
163 at91_set_deglitch(data->phy_irq_pin, 1);
166 /* Pins used for MII and RMII */
167 at91_set_A_periph(AT91_PIN_PA19, 0); /* ETXCK_EREFCK */
168 at91_set_A_periph(AT91_PIN_PA17, 0); /* ERXDV */
169 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERX0 */
170 at91_set_A_periph(AT91_PIN_PA15, 0); /* ERX1 */
171 at91_set_A_periph(AT91_PIN_PA18, 0); /* ERXER */
172 at91_set_A_periph(AT91_PIN_PA16, 0); /* ETXEN */
173 at91_set_A_periph(AT91_PIN_PA12, 0); /* ETX0 */
174 at91_set_A_periph(AT91_PIN_PA13, 0); /* ETX1 */
175 at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
176 at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
178 if (!data->is_rmii) {
179 at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
180 at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
181 at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
182 at91_set_B_periph(AT91_PIN_PA26, 0); /* ERX3 */
183 at91_set_B_periph(AT91_PIN_PA27, 0); /* ERXCK */
184 at91_set_B_periph(AT91_PIN_PA23, 0); /* ETX2 */
185 at91_set_B_periph(AT91_PIN_PA24, 0); /* ETX3 */
186 at91_set_B_periph(AT91_PIN_PA22, 0); /* ETXER */
190 platform_device_register(&at91sam9260_eth_device);
193 void __init at91_add_device_eth(struct at91_eth_data *data) {}
197 /* --------------------------------------------------------------------
199 * -------------------------------------------------------------------- */
201 #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
202 static u64 mmc_dmamask = 0xffffffffUL;
203 static struct at91_mmc_data mmc_data;
205 static struct resource mmc_resources[] = {
207 .start = AT91SAM9260_BASE_MCI,
208 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
209 .flags = IORESOURCE_MEM,
212 .start = AT91SAM9260_ID_MCI,
213 .end = AT91SAM9260_ID_MCI,
214 .flags = IORESOURCE_IRQ,
218 static struct platform_device at91sam9260_mmc_device = {
222 .dma_mask = &mmc_dmamask,
223 .coherent_dma_mask = 0xffffffff,
224 .platform_data = &mmc_data,
226 .resource = mmc_resources,
227 .num_resources = ARRAY_SIZE(mmc_resources),
230 void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
237 at91_set_gpio_input(data->det_pin, 1);
238 at91_set_deglitch(data->det_pin, 1);
241 at91_set_gpio_input(data->wp_pin, 1);
243 at91_set_gpio_output(data->vcc_pin, 0);
246 at91_set_A_periph(AT91_PIN_PA8, 0);
250 at91_set_B_periph(AT91_PIN_PA1, 1);
252 /* DAT0, maybe DAT1..DAT3 */
253 at91_set_B_periph(AT91_PIN_PA0, 1);
255 at91_set_B_periph(AT91_PIN_PA5, 1);
256 at91_set_B_periph(AT91_PIN_PA4, 1);
257 at91_set_B_periph(AT91_PIN_PA3, 1);
261 at91_set_A_periph(AT91_PIN_PA7, 1);
263 /* DAT0, maybe DAT1..DAT3 */
264 at91_set_A_periph(AT91_PIN_PA6, 1);
266 at91_set_A_periph(AT91_PIN_PA9, 1);
267 at91_set_A_periph(AT91_PIN_PA10, 1);
268 at91_set_A_periph(AT91_PIN_PA11, 1);
273 platform_device_register(&at91sam9260_mmc_device);
276 void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
280 /* --------------------------------------------------------------------
282 * -------------------------------------------------------------------- */
284 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
285 static struct at91_nand_data nand_data;
287 #define NAND_BASE AT91_CHIPSELECT_3
289 static struct resource nand_resources[] = {
292 .end = NAND_BASE + SZ_8M - 1,
293 .flags = IORESOURCE_MEM,
297 static struct platform_device at91sam9260_nand_device = {
301 .platform_data = &nand_data,
303 .resource = nand_resources,
304 .num_resources = ARRAY_SIZE(nand_resources),
307 void __init at91_add_device_nand(struct at91_nand_data *data)
309 unsigned long csa, mode;
314 csa = at91_sys_read(AT91_MATRIX_EBICSA);
315 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC);
317 /* set the bus interface characteristics */
318 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
319 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
321 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
322 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
324 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
326 if (data->bus_width_16)
327 mode = AT91_SMC_DBW_16;
329 mode = AT91_SMC_DBW_8;
330 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
333 if (data->enable_pin)
334 at91_set_gpio_output(data->enable_pin, 1);
338 at91_set_gpio_input(data->rdy_pin, 1);
340 /* card detect pin */
342 at91_set_gpio_input(data->det_pin, 1);
345 platform_device_register(&at91sam9260_nand_device);
348 void __init at91_add_device_nand(struct at91_nand_data *data) {}
352 /* --------------------------------------------------------------------
354 * -------------------------------------------------------------------- */
357 * Prefer the GPIO code since the TWI controller isn't robust
358 * (gets overruns and underruns under load) and can only issue
359 * repeated STARTs in one scenario (the driver doesn't yet handle them).
362 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
364 static struct i2c_gpio_platform_data pdata = {
365 .sda_pin = AT91_PIN_PA23,
366 .sda_is_open_drain = 1,
367 .scl_pin = AT91_PIN_PA24,
368 .scl_is_open_drain = 1,
369 .udelay = 2, /* ~100 kHz */
372 static struct platform_device at91sam9260_twi_device = {
375 .dev.platform_data = &pdata,
378 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
380 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
381 at91_set_multi_drive(AT91_PIN_PA23, 1);
383 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
384 at91_set_multi_drive(AT91_PIN_PA24, 1);
386 i2c_register_board_info(0, devices, nr_devices);
387 platform_device_register(&at91sam9260_twi_device);
390 #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
392 static struct resource twi_resources[] = {
394 .start = AT91SAM9260_BASE_TWI,
395 .end = AT91SAM9260_BASE_TWI + SZ_16K - 1,
396 .flags = IORESOURCE_MEM,
399 .start = AT91SAM9260_ID_TWI,
400 .end = AT91SAM9260_ID_TWI,
401 .flags = IORESOURCE_IRQ,
405 static struct platform_device at91sam9260_twi_device = {
408 .resource = twi_resources,
409 .num_resources = ARRAY_SIZE(twi_resources),
412 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
414 /* pins used for TWI interface */
415 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
416 at91_set_multi_drive(AT91_PIN_PA23, 1);
418 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
419 at91_set_multi_drive(AT91_PIN_PA24, 1);
421 i2c_register_board_info(0, devices, nr_devices);
422 platform_device_register(&at91sam9260_twi_device);
425 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
429 /* --------------------------------------------------------------------
431 * -------------------------------------------------------------------- */
433 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
434 static u64 spi_dmamask = 0xffffffffUL;
436 static struct resource spi0_resources[] = {
438 .start = AT91SAM9260_BASE_SPI0,
439 .end = AT91SAM9260_BASE_SPI0 + SZ_16K - 1,
440 .flags = IORESOURCE_MEM,
443 .start = AT91SAM9260_ID_SPI0,
444 .end = AT91SAM9260_ID_SPI0,
445 .flags = IORESOURCE_IRQ,
449 static struct platform_device at91sam9260_spi0_device = {
453 .dma_mask = &spi_dmamask,
454 .coherent_dma_mask = 0xffffffff,
456 .resource = spi0_resources,
457 .num_resources = ARRAY_SIZE(spi0_resources),
460 static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PC11, AT91_PIN_PC16, AT91_PIN_PC17 };
462 static struct resource spi1_resources[] = {
464 .start = AT91SAM9260_BASE_SPI1,
465 .end = AT91SAM9260_BASE_SPI1 + SZ_16K - 1,
466 .flags = IORESOURCE_MEM,
469 .start = AT91SAM9260_ID_SPI1,
470 .end = AT91SAM9260_ID_SPI1,
471 .flags = IORESOURCE_IRQ,
475 static struct platform_device at91sam9260_spi1_device = {
479 .dma_mask = &spi_dmamask,
480 .coherent_dma_mask = 0xffffffff,
482 .resource = spi1_resources,
483 .num_resources = ARRAY_SIZE(spi1_resources),
486 static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB3, AT91_PIN_PC5, AT91_PIN_PC4, AT91_PIN_PC3 };
488 void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
491 unsigned long cs_pin;
492 short enable_spi0 = 0;
493 short enable_spi1 = 0;
495 /* Choose SPI chip-selects */
496 for (i = 0; i < nr_devices; i++) {
497 if (devices[i].controller_data)
498 cs_pin = (unsigned long) devices[i].controller_data;
499 else if (devices[i].bus_num == 0)
500 cs_pin = spi0_standard_cs[devices[i].chip_select];
502 cs_pin = spi1_standard_cs[devices[i].chip_select];
504 if (devices[i].bus_num == 0)
509 /* enable chip-select pin */
510 at91_set_gpio_output(cs_pin, 1);
512 /* pass chip-select pin to driver */
513 devices[i].controller_data = (void *) cs_pin;
516 spi_register_board_info(devices, nr_devices);
518 /* Configure SPI bus(es) */
520 at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
521 at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
522 at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI1_SPCK */
524 at91_clock_associate("spi0_clk", &at91sam9260_spi0_device.dev, "spi_clk");
525 platform_device_register(&at91sam9260_spi0_device);
528 at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI1_MISO */
529 at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI1_MOSI */
530 at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI1_SPCK */
532 at91_clock_associate("spi1_clk", &at91sam9260_spi1_device.dev, "spi_clk");
533 platform_device_register(&at91sam9260_spi1_device);
537 void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
541 /* --------------------------------------------------------------------
543 * -------------------------------------------------------------------- */
545 #if defined(CONFIG_LEDS)
549 void __init at91_init_leds(u8 cpu_led, u8 timer_led)
551 /* Enable GPIO to access the LEDs */
552 at91_set_gpio_output(cpu_led, 1);
553 at91_set_gpio_output(timer_led, 1);
555 at91_leds_cpu = cpu_led;
556 at91_leds_timer = timer_led;
559 void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
563 /* --------------------------------------------------------------------
565 * -------------------------------------------------------------------- */
566 #if defined(CONFIG_SERIAL_ATMEL)
567 static struct resource dbgu_resources[] = {
569 .start = AT91_VA_BASE_SYS + AT91_DBGU,
570 .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1,
571 .flags = IORESOURCE_MEM,
574 .start = AT91_ID_SYS,
576 .flags = IORESOURCE_IRQ,
580 static struct atmel_uart_data dbgu_data = {
582 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
583 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
586 static struct platform_device at91sam9260_dbgu_device = {
587 .name = "atmel_usart",
590 .platform_data = &dbgu_data,
591 .coherent_dma_mask = 0xffffffff,
593 .resource = dbgu_resources,
594 .num_resources = ARRAY_SIZE(dbgu_resources),
597 static inline void configure_dbgu_pins(void)
599 at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
600 at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
603 static struct resource uart0_resources[] = {
605 .start = AT91SAM9260_BASE_US0,
606 .end = AT91SAM9260_BASE_US0 + SZ_16K - 1,
607 .flags = IORESOURCE_MEM,
610 .start = AT91SAM9260_ID_US0,
611 .end = AT91SAM9260_ID_US0,
612 .flags = IORESOURCE_IRQ,
616 static struct atmel_uart_data uart0_data = {
621 static struct platform_device at91sam9260_uart0_device = {
622 .name = "atmel_usart",
625 .platform_data = &uart0_data,
626 .coherent_dma_mask = 0xffffffff,
628 .resource = uart0_resources,
629 .num_resources = ARRAY_SIZE(uart0_resources),
632 static inline void configure_usart0_pins(void)
634 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
635 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
636 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
637 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
638 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
639 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
640 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
641 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
644 static struct resource uart1_resources[] = {
646 .start = AT91SAM9260_BASE_US1,
647 .end = AT91SAM9260_BASE_US1 + SZ_16K - 1,
648 .flags = IORESOURCE_MEM,
651 .start = AT91SAM9260_ID_US1,
652 .end = AT91SAM9260_ID_US1,
653 .flags = IORESOURCE_IRQ,
657 static struct atmel_uart_data uart1_data = {
662 static struct platform_device at91sam9260_uart1_device = {
663 .name = "atmel_usart",
666 .platform_data = &uart1_data,
667 .coherent_dma_mask = 0xffffffff,
669 .resource = uart1_resources,
670 .num_resources = ARRAY_SIZE(uart1_resources),
673 static inline void configure_usart1_pins(void)
675 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
676 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
677 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
678 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
681 static struct resource uart2_resources[] = {
683 .start = AT91SAM9260_BASE_US2,
684 .end = AT91SAM9260_BASE_US2 + SZ_16K - 1,
685 .flags = IORESOURCE_MEM,
688 .start = AT91SAM9260_ID_US2,
689 .end = AT91SAM9260_ID_US2,
690 .flags = IORESOURCE_IRQ,
694 static struct atmel_uart_data uart2_data = {
699 static struct platform_device at91sam9260_uart2_device = {
700 .name = "atmel_usart",
703 .platform_data = &uart2_data,
704 .coherent_dma_mask = 0xffffffff,
706 .resource = uart2_resources,
707 .num_resources = ARRAY_SIZE(uart2_resources),
710 static inline void configure_usart2_pins(void)
712 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
713 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
716 static struct resource uart3_resources[] = {
718 .start = AT91SAM9260_BASE_US3,
719 .end = AT91SAM9260_BASE_US3 + SZ_16K - 1,
720 .flags = IORESOURCE_MEM,
723 .start = AT91SAM9260_ID_US3,
724 .end = AT91SAM9260_ID_US3,
725 .flags = IORESOURCE_IRQ,
729 static struct atmel_uart_data uart3_data = {
734 static struct platform_device at91sam9260_uart3_device = {
735 .name = "atmel_usart",
738 .platform_data = &uart3_data,
739 .coherent_dma_mask = 0xffffffff,
741 .resource = uart3_resources,
742 .num_resources = ARRAY_SIZE(uart3_resources),
745 static inline void configure_usart3_pins(void)
747 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
748 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
751 static struct resource uart4_resources[] = {
753 .start = AT91SAM9260_BASE_US4,
754 .end = AT91SAM9260_BASE_US4 + SZ_16K - 1,
755 .flags = IORESOURCE_MEM,
758 .start = AT91SAM9260_ID_US4,
759 .end = AT91SAM9260_ID_US4,
760 .flags = IORESOURCE_IRQ,
764 static struct atmel_uart_data uart4_data = {
769 static struct platform_device at91sam9260_uart4_device = {
770 .name = "atmel_usart",
773 .platform_data = &uart4_data,
774 .coherent_dma_mask = 0xffffffff,
776 .resource = uart4_resources,
777 .num_resources = ARRAY_SIZE(uart4_resources),
780 static inline void configure_usart4_pins(void)
782 at91_set_B_periph(AT91_PIN_PA31, 1); /* TXD4 */
783 at91_set_B_periph(AT91_PIN_PA30, 0); /* RXD4 */
786 static struct resource uart5_resources[] = {
788 .start = AT91SAM9260_BASE_US5,
789 .end = AT91SAM9260_BASE_US5 + SZ_16K - 1,
790 .flags = IORESOURCE_MEM,
793 .start = AT91SAM9260_ID_US5,
794 .end = AT91SAM9260_ID_US5,
795 .flags = IORESOURCE_IRQ,
799 static struct atmel_uart_data uart5_data = {
804 static struct platform_device at91sam9260_uart5_device = {
805 .name = "atmel_usart",
808 .platform_data = &uart5_data,
809 .coherent_dma_mask = 0xffffffff,
811 .resource = uart5_resources,
812 .num_resources = ARRAY_SIZE(uart5_resources),
815 static inline void configure_usart5_pins(void)
817 at91_set_A_periph(AT91_PIN_PB12, 1); /* TXD5 */
818 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
821 struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
822 struct platform_device *atmel_default_console_device; /* the serial console device */
824 void __init at91_init_serial(struct at91_uart_config *config)
828 /* Fill in list of supported UARTs */
829 for (i = 0; i < config->nr_tty; i++) {
830 switch (config->tty_map[i]) {
832 configure_usart0_pins();
833 at91_uarts[i] = &at91sam9260_uart0_device;
834 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart");
837 configure_usart1_pins();
838 at91_uarts[i] = &at91sam9260_uart1_device;
839 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart");
842 configure_usart2_pins();
843 at91_uarts[i] = &at91sam9260_uart2_device;
844 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart");
847 configure_usart3_pins();
848 at91_uarts[i] = &at91sam9260_uart3_device;
849 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart");
852 configure_usart4_pins();
853 at91_uarts[i] = &at91sam9260_uart4_device;
854 at91_clock_associate("usart4_clk", &at91sam9260_uart4_device.dev, "usart");
857 configure_usart5_pins();
858 at91_uarts[i] = &at91sam9260_uart5_device;
859 at91_clock_associate("usart5_clk", &at91sam9260_uart5_device.dev, "usart");
862 configure_dbgu_pins();
863 at91_uarts[i] = &at91sam9260_dbgu_device;
864 at91_clock_associate("mck", &at91sam9260_dbgu_device.dev, "usart");
869 at91_uarts[i]->id = i; /* update ID number to mapped ID */
872 /* Set serial console device */
873 if (config->console_tty < ATMEL_MAX_UART)
874 atmel_default_console_device = at91_uarts[config->console_tty];
875 if (!atmel_default_console_device)
876 printk(KERN_INFO "AT91: No default serial console defined.\n");
879 void __init at91_add_device_serial(void)
883 for (i = 0; i < ATMEL_MAX_UART; i++) {
885 platform_device_register(at91_uarts[i]);
889 void __init at91_init_serial(struct at91_uart_config *config) {}
890 void __init at91_add_device_serial(void) {}
894 /* -------------------------------------------------------------------- */
896 * These devices are always present and don't need any board-specific
899 static int __init at91_add_standard_devices(void)
904 arch_initcall(at91_add_standard_devices);