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>
17 #include <asm/arch/board.h>
18 #include <asm/arch/gpio.h>
19 #include <asm/arch/at91sam9260.h>
20 #include <asm/arch/at91sam926x_mc.h>
21 #include <asm/arch/at91sam9260_matrix.h>
26 /* --------------------------------------------------------------------
28 * -------------------------------------------------------------------- */
30 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
31 static u64 ohci_dmamask
= 0xffffffffUL
;
32 static struct at91_usbh_data usbh_data
;
34 static struct resource usbh_resources
[] = {
36 .start
= AT91SAM9260_UHP_BASE
,
37 .end
= AT91SAM9260_UHP_BASE
+ SZ_1M
- 1,
38 .flags
= IORESOURCE_MEM
,
41 .start
= AT91SAM9260_ID_UHP
,
42 .end
= AT91SAM9260_ID_UHP
,
43 .flags
= IORESOURCE_IRQ
,
47 static struct platform_device at91_usbh_device
= {
51 .dma_mask
= &ohci_dmamask
,
52 .coherent_dma_mask
= 0xffffffff,
53 .platform_data
= &usbh_data
,
55 .resource
= usbh_resources
,
56 .num_resources
= ARRAY_SIZE(usbh_resources
),
59 void __init
at91_add_device_usbh(struct at91_usbh_data
*data
)
65 platform_device_register(&at91_usbh_device
);
68 void __init
at91_add_device_usbh(struct at91_usbh_data
*data
) {}
72 /* --------------------------------------------------------------------
74 * -------------------------------------------------------------------- */
76 #ifdef CONFIG_USB_GADGET_AT91
77 static struct at91_udc_data udc_data
;
79 static struct resource udc_resources
[] = {
81 .start
= AT91SAM9260_BASE_UDP
,
82 .end
= AT91SAM9260_BASE_UDP
+ SZ_16K
- 1,
83 .flags
= IORESOURCE_MEM
,
86 .start
= AT91SAM9260_ID_UDP
,
87 .end
= AT91SAM9260_ID_UDP
,
88 .flags
= IORESOURCE_IRQ
,
92 static struct platform_device at91_udc_device
= {
96 .platform_data
= &udc_data
,
98 .resource
= udc_resources
,
99 .num_resources
= ARRAY_SIZE(udc_resources
),
102 void __init
at91_add_device_udc(struct at91_udc_data
*data
)
107 if (data
->vbus_pin
) {
108 at91_set_gpio_input(data
->vbus_pin
, 0);
109 at91_set_deglitch(data
->vbus_pin
, 1);
112 /* Pullup pin is handled internally by USB device peripheral */
115 platform_device_register(&at91_udc_device
);
118 void __init
at91_add_device_udc(struct at91_udc_data
*data
) {}
122 /* --------------------------------------------------------------------
124 * -------------------------------------------------------------------- */
126 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
127 static u64 eth_dmamask
= 0xffffffffUL
;
128 static struct at91_eth_data eth_data
;
130 static struct resource eth_resources
[] = {
132 .start
= AT91SAM9260_BASE_EMAC
,
133 .end
= AT91SAM9260_BASE_EMAC
+ SZ_16K
- 1,
134 .flags
= IORESOURCE_MEM
,
137 .start
= AT91SAM9260_ID_EMAC
,
138 .end
= AT91SAM9260_ID_EMAC
,
139 .flags
= IORESOURCE_IRQ
,
143 static struct platform_device at91sam9260_eth_device
= {
147 .dma_mask
= ð_dmamask
,
148 .coherent_dma_mask
= 0xffffffff,
149 .platform_data
= ð_data
,
151 .resource
= eth_resources
,
152 .num_resources
= ARRAY_SIZE(eth_resources
),
155 void __init
at91_add_device_eth(struct at91_eth_data
*data
)
160 if (data
->phy_irq_pin
) {
161 at91_set_gpio_input(data
->phy_irq_pin
, 0);
162 at91_set_deglitch(data
->phy_irq_pin
, 1);
165 /* Pins used for MII and RMII */
166 at91_set_A_periph(AT91_PIN_PA19
, 0); /* ETXCK_EREFCK */
167 at91_set_A_periph(AT91_PIN_PA17
, 0); /* ERXDV */
168 at91_set_A_periph(AT91_PIN_PA14
, 0); /* ERX0 */
169 at91_set_A_periph(AT91_PIN_PA15
, 0); /* ERX1 */
170 at91_set_A_periph(AT91_PIN_PA18
, 0); /* ERXER */
171 at91_set_A_periph(AT91_PIN_PA16
, 0); /* ETXEN */
172 at91_set_A_periph(AT91_PIN_PA12
, 0); /* ETX0 */
173 at91_set_A_periph(AT91_PIN_PA13
, 0); /* ETX1 */
174 at91_set_A_periph(AT91_PIN_PA21
, 0); /* EMDIO */
175 at91_set_A_periph(AT91_PIN_PA20
, 0); /* EMDC */
177 if (!data
->is_rmii
) {
178 at91_set_B_periph(AT91_PIN_PA28
, 0); /* ECRS */
179 at91_set_B_periph(AT91_PIN_PA29
, 0); /* ECOL */
180 at91_set_B_periph(AT91_PIN_PA25
, 0); /* ERX2 */
181 at91_set_B_periph(AT91_PIN_PA26
, 0); /* ERX3 */
182 at91_set_B_periph(AT91_PIN_PA27
, 0); /* ERXCK */
183 at91_set_B_periph(AT91_PIN_PA23
, 0); /* ETX2 */
184 at91_set_B_periph(AT91_PIN_PA24
, 0); /* ETX3 */
185 at91_set_B_periph(AT91_PIN_PA22
, 0); /* ETXER */
189 platform_device_register(&at91sam9260_eth_device
);
192 void __init
at91_add_device_eth(struct at91_eth_data
*data
) {}
196 /* --------------------------------------------------------------------
198 * -------------------------------------------------------------------- */
200 #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
201 static u64 mmc_dmamask
= 0xffffffffUL
;
202 static struct at91_mmc_data mmc_data
;
204 static struct resource mmc_resources
[] = {
206 .start
= AT91SAM9260_BASE_MCI
,
207 .end
= AT91SAM9260_BASE_MCI
+ SZ_16K
- 1,
208 .flags
= IORESOURCE_MEM
,
211 .start
= AT91SAM9260_ID_MCI
,
212 .end
= AT91SAM9260_ID_MCI
,
213 .flags
= IORESOURCE_IRQ
,
217 static struct platform_device at91sam9260_mmc_device
= {
221 .dma_mask
= &mmc_dmamask
,
222 .coherent_dma_mask
= 0xffffffff,
223 .platform_data
= &mmc_data
,
225 .resource
= mmc_resources
,
226 .num_resources
= ARRAY_SIZE(mmc_resources
),
229 void __init
at91_add_device_mmc(short mmc_id
, struct at91_mmc_data
*data
)
236 at91_set_gpio_input(data
->det_pin
, 1);
237 at91_set_deglitch(data
->det_pin
, 1);
240 at91_set_gpio_input(data
->wp_pin
, 1);
242 at91_set_gpio_output(data
->vcc_pin
, 0);
245 at91_set_A_periph(AT91_PIN_PA8
, 0);
249 at91_set_B_periph(AT91_PIN_PA1
, 1);
251 /* DAT0, maybe DAT1..DAT3 */
252 at91_set_B_periph(AT91_PIN_PA0
, 1);
254 at91_set_B_periph(AT91_PIN_PA5
, 1);
255 at91_set_B_periph(AT91_PIN_PA4
, 1);
256 at91_set_B_periph(AT91_PIN_PA3
, 1);
260 at91_set_A_periph(AT91_PIN_PA7
, 1);
262 /* DAT0, maybe DAT1..DAT3 */
263 at91_set_A_periph(AT91_PIN_PA6
, 1);
265 at91_set_A_periph(AT91_PIN_PA9
, 1);
266 at91_set_A_periph(AT91_PIN_PA10
, 1);
267 at91_set_A_periph(AT91_PIN_PA11
, 1);
272 platform_device_register(&at91sam9260_mmc_device
);
275 void __init
at91_add_device_mmc(short mmc_id
, struct at91_mmc_data
*data
) {}
279 /* --------------------------------------------------------------------
281 * -------------------------------------------------------------------- */
283 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
284 static struct at91_nand_data nand_data
;
286 #define NAND_BASE AT91_CHIPSELECT_3
288 static struct resource nand_resources
[] = {
291 .end
= NAND_BASE
+ SZ_8M
- 1,
292 .flags
= IORESOURCE_MEM
,
296 static struct platform_device at91sam9260_nand_device
= {
300 .platform_data
= &nand_data
,
302 .resource
= nand_resources
,
303 .num_resources
= ARRAY_SIZE(nand_resources
),
306 void __init
at91_add_device_nand(struct at91_nand_data
*data
)
308 unsigned long csa
, mode
;
313 csa
= at91_sys_read(AT91_MATRIX_EBICSA
);
314 at91_sys_write(AT91_MATRIX_EBICSA
, csa
| AT91_MATRIX_CS3A_SMC
);
316 /* set the bus interface characteristics */
317 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
318 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
320 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
321 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
323 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
325 if (data
->bus_width_16
)
326 mode
= AT91_SMC_DBW_16
;
328 mode
= AT91_SMC_DBW_8
;
329 at91_sys_write(AT91_SMC_MODE(3), mode
| AT91_SMC_READMODE
| AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE
| AT91_SMC_TDF_(2));
332 if (data
->enable_pin
)
333 at91_set_gpio_output(data
->enable_pin
, 1);
337 at91_set_gpio_input(data
->rdy_pin
, 1);
339 /* card detect pin */
341 at91_set_gpio_input(data
->det_pin
, 1);
344 platform_device_register(&at91sam9260_nand_device
);
347 void __init
at91_add_device_nand(struct at91_nand_data
*data
) {}
351 /* --------------------------------------------------------------------
353 * -------------------------------------------------------------------- */
355 #if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
357 static struct resource twi_resources
[] = {
359 .start
= AT91SAM9260_BASE_TWI
,
360 .end
= AT91SAM9260_BASE_TWI
+ SZ_16K
- 1,
361 .flags
= IORESOURCE_MEM
,
364 .start
= AT91SAM9260_ID_TWI
,
365 .end
= AT91SAM9260_ID_TWI
,
366 .flags
= IORESOURCE_IRQ
,
370 static struct platform_device at91sam9260_twi_device
= {
373 .resource
= twi_resources
,
374 .num_resources
= ARRAY_SIZE(twi_resources
),
377 void __init
at91_add_device_i2c(void)
379 /* pins used for TWI interface */
380 at91_set_A_periph(AT91_PIN_PA23
, 0); /* TWD */
381 at91_set_multi_drive(AT91_PIN_PA23
, 1);
383 at91_set_A_periph(AT91_PIN_PA24
, 0); /* TWCK */
384 at91_set_multi_drive(AT91_PIN_PA24
, 1);
386 platform_device_register(&at91sam9260_twi_device
);
389 void __init
at91_add_device_i2c(void) {}
393 /* --------------------------------------------------------------------
395 * -------------------------------------------------------------------- */
397 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
398 static u64 spi_dmamask
= 0xffffffffUL
;
400 static struct resource spi0_resources
[] = {
402 .start
= AT91SAM9260_BASE_SPI0
,
403 .end
= AT91SAM9260_BASE_SPI0
+ SZ_16K
- 1,
404 .flags
= IORESOURCE_MEM
,
407 .start
= AT91SAM9260_ID_SPI0
,
408 .end
= AT91SAM9260_ID_SPI0
,
409 .flags
= IORESOURCE_IRQ
,
413 static struct platform_device at91sam9260_spi0_device
= {
417 .dma_mask
= &spi_dmamask
,
418 .coherent_dma_mask
= 0xffffffff,
420 .resource
= spi0_resources
,
421 .num_resources
= ARRAY_SIZE(spi0_resources
),
424 static const unsigned spi0_standard_cs
[4] = { AT91_PIN_PA3
, AT91_PIN_PC11
, AT91_PIN_PC16
, AT91_PIN_PC17
};
426 static struct resource spi1_resources
[] = {
428 .start
= AT91SAM9260_BASE_SPI1
,
429 .end
= AT91SAM9260_BASE_SPI1
+ SZ_16K
- 1,
430 .flags
= IORESOURCE_MEM
,
433 .start
= AT91SAM9260_ID_SPI1
,
434 .end
= AT91SAM9260_ID_SPI1
,
435 .flags
= IORESOURCE_IRQ
,
439 static struct platform_device at91sam9260_spi1_device
= {
443 .dma_mask
= &spi_dmamask
,
444 .coherent_dma_mask
= 0xffffffff,
446 .resource
= spi1_resources
,
447 .num_resources
= ARRAY_SIZE(spi1_resources
),
450 static const unsigned spi1_standard_cs
[4] = { AT91_PIN_PB3
, AT91_PIN_PC5
, AT91_PIN_PC4
, AT91_PIN_PC3
};
452 void __init
at91_add_device_spi(struct spi_board_info
*devices
, int nr_devices
)
455 unsigned long cs_pin
;
456 short enable_spi0
= 0;
457 short enable_spi1
= 0;
459 /* Choose SPI chip-selects */
460 for (i
= 0; i
< nr_devices
; i
++) {
461 if (devices
[i
].controller_data
)
462 cs_pin
= (unsigned long) devices
[i
].controller_data
;
463 else if (devices
[i
].bus_num
== 0)
464 cs_pin
= spi0_standard_cs
[devices
[i
].chip_select
];
466 cs_pin
= spi1_standard_cs
[devices
[i
].chip_select
];
468 if (devices
[i
].bus_num
== 0)
473 /* enable chip-select pin */
474 at91_set_gpio_output(cs_pin
, 1);
476 /* pass chip-select pin to driver */
477 devices
[i
].controller_data
= (void *) cs_pin
;
480 spi_register_board_info(devices
, nr_devices
);
482 /* Configure SPI bus(es) */
484 at91_set_A_periph(AT91_PIN_PA0
, 0); /* SPI0_MISO */
485 at91_set_A_periph(AT91_PIN_PA1
, 0); /* SPI0_MOSI */
486 at91_set_A_periph(AT91_PIN_PA2
, 0); /* SPI1_SPCK */
488 at91_clock_associate("spi0_clk", &at91sam9260_spi0_device
.dev
, "spi_clk");
489 platform_device_register(&at91sam9260_spi0_device
);
492 at91_set_A_periph(AT91_PIN_PB0
, 0); /* SPI1_MISO */
493 at91_set_A_periph(AT91_PIN_PB1
, 0); /* SPI1_MOSI */
494 at91_set_A_periph(AT91_PIN_PB2
, 0); /* SPI1_SPCK */
496 at91_clock_associate("spi1_clk", &at91sam9260_spi1_device
.dev
, "spi_clk");
497 platform_device_register(&at91sam9260_spi1_device
);
501 void __init
at91_add_device_spi(struct spi_board_info
*devices
, int nr_devices
) {}
505 /* --------------------------------------------------------------------
507 * -------------------------------------------------------------------- */
509 #if defined(CONFIG_LEDS)
513 void __init
at91_init_leds(u8 cpu_led
, u8 timer_led
)
515 /* Enable GPIO to access the LEDs */
516 at91_set_gpio_output(cpu_led
, 1);
517 at91_set_gpio_output(timer_led
, 1);
519 at91_leds_cpu
= cpu_led
;
520 at91_leds_timer
= timer_led
;
523 void __init
at91_init_leds(u8 cpu_led
, u8 timer_led
) {}
527 /* --------------------------------------------------------------------
529 * -------------------------------------------------------------------- */
530 #if defined(CONFIG_SERIAL_ATMEL)
531 static struct resource dbgu_resources
[] = {
533 .start
= AT91_VA_BASE_SYS
+ AT91_DBGU
,
534 .end
= AT91_VA_BASE_SYS
+ AT91_DBGU
+ SZ_512
- 1,
535 .flags
= IORESOURCE_MEM
,
538 .start
= AT91_ID_SYS
,
540 .flags
= IORESOURCE_IRQ
,
544 static struct atmel_uart_data dbgu_data
= {
546 .use_dma_rx
= 0, /* DBGU not capable of receive DMA */
547 .regs
= (void __iomem
*)(AT91_VA_BASE_SYS
+ AT91_DBGU
),
550 static struct platform_device at91sam9260_dbgu_device
= {
551 .name
= "atmel_usart",
554 .platform_data
= &dbgu_data
,
555 .coherent_dma_mask
= 0xffffffff,
557 .resource
= dbgu_resources
,
558 .num_resources
= ARRAY_SIZE(dbgu_resources
),
561 static inline void configure_dbgu_pins(void)
563 at91_set_A_periph(AT91_PIN_PB14
, 0); /* DRXD */
564 at91_set_A_periph(AT91_PIN_PB15
, 1); /* DTXD */
567 static struct resource uart0_resources
[] = {
569 .start
= AT91SAM9260_BASE_US0
,
570 .end
= AT91SAM9260_BASE_US0
+ SZ_16K
- 1,
571 .flags
= IORESOURCE_MEM
,
574 .start
= AT91SAM9260_ID_US0
,
575 .end
= AT91SAM9260_ID_US0
,
576 .flags
= IORESOURCE_IRQ
,
580 static struct atmel_uart_data uart0_data
= {
585 static struct platform_device at91sam9260_uart0_device
= {
586 .name
= "atmel_usart",
589 .platform_data
= &uart0_data
,
590 .coherent_dma_mask
= 0xffffffff,
592 .resource
= uart0_resources
,
593 .num_resources
= ARRAY_SIZE(uart0_resources
),
596 static inline void configure_usart0_pins(void)
598 at91_set_A_periph(AT91_PIN_PB4
, 1); /* TXD0 */
599 at91_set_A_periph(AT91_PIN_PB5
, 0); /* RXD0 */
600 at91_set_A_periph(AT91_PIN_PB26
, 0); /* RTS0 */
601 at91_set_A_periph(AT91_PIN_PB27
, 0); /* CTS0 */
602 at91_set_A_periph(AT91_PIN_PB24
, 0); /* DTR0 */
603 at91_set_A_periph(AT91_PIN_PB22
, 0); /* DSR0 */
604 at91_set_A_periph(AT91_PIN_PB23
, 0); /* DCD0 */
605 at91_set_A_periph(AT91_PIN_PB25
, 0); /* RI0 */
608 static struct resource uart1_resources
[] = {
610 .start
= AT91SAM9260_BASE_US1
,
611 .end
= AT91SAM9260_BASE_US1
+ SZ_16K
- 1,
612 .flags
= IORESOURCE_MEM
,
615 .start
= AT91SAM9260_ID_US1
,
616 .end
= AT91SAM9260_ID_US1
,
617 .flags
= IORESOURCE_IRQ
,
621 static struct atmel_uart_data uart1_data
= {
626 static struct platform_device at91sam9260_uart1_device
= {
627 .name
= "atmel_usart",
630 .platform_data
= &uart1_data
,
631 .coherent_dma_mask
= 0xffffffff,
633 .resource
= uart1_resources
,
634 .num_resources
= ARRAY_SIZE(uart1_resources
),
637 static inline void configure_usart1_pins(void)
639 at91_set_A_periph(AT91_PIN_PB6
, 1); /* TXD1 */
640 at91_set_A_periph(AT91_PIN_PB7
, 0); /* RXD1 */
641 at91_set_A_periph(AT91_PIN_PB28
, 0); /* RTS1 */
642 at91_set_A_periph(AT91_PIN_PB29
, 0); /* CTS1 */
645 static struct resource uart2_resources
[] = {
647 .start
= AT91SAM9260_BASE_US2
,
648 .end
= AT91SAM9260_BASE_US2
+ SZ_16K
- 1,
649 .flags
= IORESOURCE_MEM
,
652 .start
= AT91SAM9260_ID_US2
,
653 .end
= AT91SAM9260_ID_US2
,
654 .flags
= IORESOURCE_IRQ
,
658 static struct atmel_uart_data uart2_data
= {
663 static struct platform_device at91sam9260_uart2_device
= {
664 .name
= "atmel_usart",
667 .platform_data
= &uart2_data
,
668 .coherent_dma_mask
= 0xffffffff,
670 .resource
= uart2_resources
,
671 .num_resources
= ARRAY_SIZE(uart2_resources
),
674 static inline void configure_usart2_pins(void)
676 at91_set_A_periph(AT91_PIN_PB8
, 1); /* TXD2 */
677 at91_set_A_periph(AT91_PIN_PB9
, 0); /* RXD2 */
680 static struct resource uart3_resources
[] = {
682 .start
= AT91SAM9260_BASE_US3
,
683 .end
= AT91SAM9260_BASE_US3
+ SZ_16K
- 1,
684 .flags
= IORESOURCE_MEM
,
687 .start
= AT91SAM9260_ID_US3
,
688 .end
= AT91SAM9260_ID_US3
,
689 .flags
= IORESOURCE_IRQ
,
693 static struct atmel_uart_data uart3_data
= {
698 static struct platform_device at91sam9260_uart3_device
= {
699 .name
= "atmel_usart",
702 .platform_data
= &uart3_data
,
703 .coherent_dma_mask
= 0xffffffff,
705 .resource
= uart3_resources
,
706 .num_resources
= ARRAY_SIZE(uart3_resources
),
709 static inline void configure_usart3_pins(void)
711 at91_set_A_periph(AT91_PIN_PB10
, 1); /* TXD3 */
712 at91_set_A_periph(AT91_PIN_PB11
, 0); /* RXD3 */
715 static struct resource uart4_resources
[] = {
717 .start
= AT91SAM9260_BASE_US4
,
718 .end
= AT91SAM9260_BASE_US4
+ SZ_16K
- 1,
719 .flags
= IORESOURCE_MEM
,
722 .start
= AT91SAM9260_ID_US4
,
723 .end
= AT91SAM9260_ID_US4
,
724 .flags
= IORESOURCE_IRQ
,
728 static struct atmel_uart_data uart4_data
= {
733 static struct platform_device at91sam9260_uart4_device
= {
734 .name
= "atmel_usart",
737 .platform_data
= &uart4_data
,
738 .coherent_dma_mask
= 0xffffffff,
740 .resource
= uart4_resources
,
741 .num_resources
= ARRAY_SIZE(uart4_resources
),
744 static inline void configure_usart4_pins(void)
746 at91_set_B_periph(AT91_PIN_PA31
, 1); /* TXD4 */
747 at91_set_B_periph(AT91_PIN_PA30
, 0); /* RXD4 */
750 static struct resource uart5_resources
[] = {
752 .start
= AT91SAM9260_BASE_US5
,
753 .end
= AT91SAM9260_BASE_US5
+ SZ_16K
- 1,
754 .flags
= IORESOURCE_MEM
,
757 .start
= AT91SAM9260_ID_US5
,
758 .end
= AT91SAM9260_ID_US5
,
759 .flags
= IORESOURCE_IRQ
,
763 static struct atmel_uart_data uart5_data
= {
768 static struct platform_device at91sam9260_uart5_device
= {
769 .name
= "atmel_usart",
772 .platform_data
= &uart5_data
,
773 .coherent_dma_mask
= 0xffffffff,
775 .resource
= uart5_resources
,
776 .num_resources
= ARRAY_SIZE(uart5_resources
),
779 static inline void configure_usart5_pins(void)
781 at91_set_A_periph(AT91_PIN_PB12
, 1); /* TXD5 */
782 at91_set_A_periph(AT91_PIN_PB13
, 0); /* RXD5 */
785 struct platform_device
*at91_uarts
[ATMEL_MAX_UART
]; /* the UARTs to use */
786 struct platform_device
*atmel_default_console_device
; /* the serial console device */
788 void __init
at91_init_serial(struct at91_uart_config
*config
)
792 /* Fill in list of supported UARTs */
793 for (i
= 0; i
< config
->nr_tty
; i
++) {
794 switch (config
->tty_map
[i
]) {
796 configure_usart0_pins();
797 at91_uarts
[i
] = &at91sam9260_uart0_device
;
798 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device
.dev
, "usart");
801 configure_usart1_pins();
802 at91_uarts
[i
] = &at91sam9260_uart1_device
;
803 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device
.dev
, "usart");
806 configure_usart2_pins();
807 at91_uarts
[i
] = &at91sam9260_uart2_device
;
808 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device
.dev
, "usart");
811 configure_usart3_pins();
812 at91_uarts
[i
] = &at91sam9260_uart3_device
;
813 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device
.dev
, "usart");
816 configure_usart4_pins();
817 at91_uarts
[i
] = &at91sam9260_uart4_device
;
818 at91_clock_associate("usart4_clk", &at91sam9260_uart4_device
.dev
, "usart");
821 configure_usart5_pins();
822 at91_uarts
[i
] = &at91sam9260_uart5_device
;
823 at91_clock_associate("usart5_clk", &at91sam9260_uart5_device
.dev
, "usart");
826 configure_dbgu_pins();
827 at91_uarts
[i
] = &at91sam9260_dbgu_device
;
828 at91_clock_associate("mck", &at91sam9260_dbgu_device
.dev
, "usart");
833 at91_uarts
[i
]->id
= i
; /* update ID number to mapped ID */
836 /* Set serial console device */
837 if (config
->console_tty
< ATMEL_MAX_UART
)
838 atmel_default_console_device
= at91_uarts
[config
->console_tty
];
839 if (!atmel_default_console_device
)
840 printk(KERN_INFO
"AT91: No default serial console defined.\n");
843 void __init
at91_add_device_serial(void)
847 for (i
= 0; i
< ATMEL_MAX_UART
; i
++) {
849 platform_device_register(at91_uarts
[i
]);
853 void __init
at91_init_serial(struct at91_uart_config
*config
) {}
854 void __init
at91_add_device_serial(void) {}
858 /* -------------------------------------------------------------------- */
860 * These devices are always present and don't need any board-specific
863 static int __init
at91_add_standard_devices(void)
868 arch_initcall(at91_add_standard_devices
);