22 #include <mach/board.h>
37 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
41 static struct resource usbh_resources[] = {
58 .dma_mask = &ohci_dmamask,
60 .platform_data = &usbh_data,
62 .resource = usbh_resources,
74 for (i = 0; i < data->
ports; i++) {
91 #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
94 static struct resource udc_resources[] = {
111 .platform_data = &udc_data,
113 .resource = udc_resources,
122 if (gpio_is_valid(data->
vbus_pin)) {
141 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
145 static struct resource eth_resources[] = {
162 .dma_mask = ð_dmamask,
164 .platform_data = ð_data,
166 .resource = eth_resources,
215 #if IS_ENABLED(CONFIG_MMC_ATMELMCI)
219 static struct resource mmc_resources[] = {
236 .dma_mask = &mmc_dmamask,
240 .resource = mmc_resources,
247 unsigned int slot_count = 0;
253 if (data->
slot[i].bus_width) {
255 if (gpio_is_valid(data->
slot[i].detect_pin)) {
259 if (gpio_is_valid(data->
slot[i].wp_pin))
268 if (data->
slot[i].bus_width == 4) {
280 if (data->
slot[i].bus_width == 4) {
289 "AT91: SD/MMC slot %d not available\n", i);
312 #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
315 #define NAND_BASE AT91_CHIPSELECT_3
317 static struct resource nand_resources[] = {
320 .end = NAND_BASE +
SZ_256M - 1,
331 .
name =
"atmel_nand",
334 .platform_data = &nand_data,
336 .resource = nand_resources,
355 if (gpio_is_valid(data->
rdy_pin))
359 if (gpio_is_valid(data->
det_pin))
380 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
384 .sda_is_open_drain = 1,
386 .scl_is_open_drain = 1,
393 .dev.platform_data = &
pdata,
408 #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
410 static struct resource twi_resources[] = {
425 .resource = twi_resources,
433 at91sam9260_twi_device.
name =
"i2c-at91sam9g20";
435 at91sam9260_twi_device.
name =
"i2c-at91sam9260";
457 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
460 static struct resource spi0_resources[] = {
477 .dma_mask = &spi_dmamask,
480 .resource = spi0_resources,
486 static struct resource spi1_resources[] = {
503 .dma_mask = &spi_dmamask,
506 .resource = spi1_resources,
515 unsigned long cs_pin;
516 short enable_spi0 = 0;
517 short enable_spi1 = 0;
520 for (i = 0; i < nr_devices; i++) {
521 if (devices[i].controller_data)
522 cs_pin = (
unsigned long) devices[i].controller_data;
523 else if (devices[i].bus_num == 0)
526 cs_pin = spi1_standard_cs[devices[
i].chip_select];
528 if (!gpio_is_valid(cs_pin))
531 if (devices[i].bus_num == 0)
540 devices[
i].controller_data = (
void *) cs_pin;
570 #ifdef CONFIG_ATMEL_TCLIB
572 static struct resource tcb0_resources[] = {
598 .resource = tcb0_resources,
602 static struct resource tcb1_resources[] = {
628 .resource = tcb1_resources,
632 static void __init at91_add_device_tc(
void)
638 static void __init at91_add_device_tc(
void) { }
646 static struct resource rtt_resources[] = {
661 .resource = rtt_resources,
665 #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
666 static void __init at91_add_device_rtt_rtc(
void)
668 at91sam9260_rtt_device.
name =
"rtc-at91sam9";
675 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
676 rtt_resources[1].
end = rtt_resources[1].
start + 3;
681 static void __init at91_add_device_rtt_rtc(
void)
688 static void __init at91_add_device_rtt(
void)
690 at91_add_device_rtt_rtc();
699 #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
700 static struct resource wdt_resources[] = {
711 .resource = wdt_resources,
715 static void __init at91_add_device_watchdog(
void)
720 static void __init at91_add_device_watchdog(
void) {}
728 #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
731 static struct resource ssc_resources[] = {
748 .dma_mask = &ssc_dmamask,
751 .resource = ssc_resources,
755 static inline void configure_ssc_pins(
unsigned pins)
787 pdev = &at91sam9260_ssc_device;
788 configure_ssc_pins(pins);
805 #if defined(CONFIG_SERIAL_ATMEL)
806 static struct resource dbgu_resources[] = {
827 .
name =
"atmel_usart",
830 .dma_mask = &dbgu_dmamask,
832 .platform_data = &dbgu_data,
834 .resource = dbgu_resources,
838 static inline void configure_dbgu_pins(
void)
844 static struct resource uart0_resources[] = {
865 .
name =
"atmel_usart",
868 .dma_mask = &uart0_dmamask,
870 .platform_data = &uart0_data,
872 .resource = uart0_resources,
876 static inline void configure_usart0_pins(
unsigned pins)
895 static struct resource uart1_resources[] = {
916 .
name =
"atmel_usart",
919 .dma_mask = &uart1_dmamask,
921 .platform_data = &uart1_data,
923 .resource = uart1_resources,
927 static inline void configure_usart1_pins(
unsigned pins)
932 if (pins & ATMEL_UART_RTS)
934 if (pins & ATMEL_UART_CTS)
938 static struct resource uart2_resources[] = {
959 .
name =
"atmel_usart",
962 .dma_mask = &uart2_dmamask,
964 .platform_data = &uart2_data,
966 .resource = uart2_resources,
970 static inline void configure_usart2_pins(
unsigned pins)
975 if (pins & ATMEL_UART_RTS)
977 if (pins & ATMEL_UART_CTS)
981 static struct resource uart3_resources[] = {
1002 .
name =
"atmel_usart",
1005 .dma_mask = &uart3_dmamask,
1007 .platform_data = &uart3_data,
1009 .resource = uart3_resources,
1010 .num_resources =
ARRAY_SIZE(uart3_resources),
1013 static inline void configure_usart3_pins(
unsigned pins)
1018 if (pins & ATMEL_UART_RTS)
1020 if (pins & ATMEL_UART_CTS)
1024 static struct resource uart4_resources[] = {
1045 .
name =
"atmel_usart",
1048 .dma_mask = &uart4_dmamask,
1050 .platform_data = &uart4_data,
1052 .resource = uart4_resources,
1053 .num_resources =
ARRAY_SIZE(uart4_resources),
1056 static inline void configure_usart4_pins(
void)
1062 static struct resource uart5_resources[] = {
1083 .
name =
"atmel_usart",
1086 .dma_mask = &uart5_dmamask,
1088 .platform_data = &uart5_data,
1090 .resource = uart5_resources,
1091 .num_resources =
ARRAY_SIZE(uart5_resources),
1094 static inline void configure_usart5_pins(
void)
1109 pdev = &at91sam9260_dbgu_device;
1110 configure_dbgu_pins();
1113 pdev = &at91sam9260_uart0_device;
1114 configure_usart0_pins(pins);
1117 pdev = &at91sam9260_uart1_device;
1118 configure_usart1_pins(pins);
1121 pdev = &at91sam9260_uart2_device;
1122 configure_usart2_pins(pins);
1125 pdev = &at91sam9260_uart3_device;
1126 configure_usart3_pins(pins);
1129 pdev = &at91sam9260_uart4_device;
1130 configure_usart4_pins();
1133 pdev = &at91sam9260_uart5_device;
1134 configure_usart5_pins();
1139 pdata = pdev->
dev.platform_data;
1140 pdata->
num = portnr;
1143 at91_uarts[portnr] = pdev;
1164 #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \
1165 defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
1169 static struct resource cf0_resources[] = {
1180 .platform_data = &cf0_data,
1182 .resource = cf0_resources,
1188 static struct resource cf1_resources[] = {
1199 .platform_data = &cf1_data,
1201 .resource = cf1_resources,
1238 if (gpio_is_valid(data->
rst_pin)) {
1243 if (gpio_is_valid(data->
irq_pin)) {
1248 if (gpio_is_valid(data->
det_pin)) {
1259 #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE)
1260 pdev->
name =
"pata_at91";
1262 #warning "board requires AT91_CF_TRUE_IDE: enable pata_at91"
1265 pdev->
name =
"at91_cf";
1278 #if IS_ENABLED(CONFIG_AT91_ADC)
1281 static struct resource adc_resources[] = {
1298 .platform_data = &adc_data,
1300 .resource = adc_resources,
1306 .
name =
"timer-counter-0",
1310 .name =
"timer-counter-1",
1314 .name =
"timer-counter-2",
1320 .is_external =
true,
1350 data->
registers = &at91_adc_register_g20;
1366 static int __init at91_add_standard_devices(
void)
1368 if (of_have_populated_dt())
1371 at91_add_device_rtt();
1372 at91_add_device_watchdog();
1373 at91_add_device_tc();