20 #include <mach/board.h>
34 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
37 static struct resource hdmac_resources[] = {
51 .
name =
"at91sam9rl_dma",
54 .dma_mask = &hdmac_dmamask,
57 .resource = hdmac_resources,
73 #if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
75 static struct resource usba_udc_resources[] = {
93 #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
97 .fifo_size = maxpkt, \
104 EP(
"ep0", 0, 64, 1, 0, 0),
105 EP(
"ep1", 1, 1024, 2, 1, 1),
106 EP(
"ep2", 2, 1024, 2, 1, 1),
107 EP(
"ep3", 3, 1024, 3, 1, 0),
108 EP(
"ep4", 4, 1024, 3, 1, 0),
109 EP(
"ep5", 5, 1024, 3, 1, 1),
110 EP(
"ep6", 6, 1024, 3, 1, 1),
125 .
name =
"atmel_usba_udc",
128 .platform_data = &usba_udc_data.pdata,
130 .resource = usba_udc_resources,
131 .num_resources =
ARRAY_SIZE(usba_udc_resources),
141 usba_udc_data.pdata.vbus_pin = -
EINVAL;
142 usba_udc_data.pdata.num_ep =
ARRAY_SIZE(usba_udc_ep);
143 memcpy(usba_udc_data.ep, usba_udc_ep,
sizeof(usba_udc_ep));
145 if (data && gpio_is_valid(data->
vbus_pin)) {
148 usba_udc_data.pdata.vbus_pin = data->
vbus_pin;
164 #if IS_ENABLED(CONFIG_MMC_ATMELMCI)
168 static struct resource mmc_resources[] = {
185 .dma_mask = &mmc_dmamask,
189 .resource = mmc_resources,
198 if (data->
slot[0].bus_width) {
200 if (gpio_is_valid(data->
slot[0].detect_pin)) {
204 if (gpio_is_valid(data->
slot[0].wp_pin))
215 if (data->
slot[0].bus_width == 4) {
234 #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
237 #define NAND_BASE AT91_CHIPSELECT_3
239 static struct resource nand_resources[] = {
242 .end = NAND_BASE +
SZ_256M - 1,
253 .
name =
"atmel_nand",
256 .platform_data = &nand_data,
258 .resource = nand_resources,
277 if (gpio_is_valid(data->
rdy_pin))
281 if (gpio_is_valid(data->
det_pin))
305 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
309 .sda_is_open_drain = 1,
311 .scl_is_open_drain = 1,
318 .dev.platform_data = &
pdata,
333 #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
335 static struct resource twi_resources[] = {
349 .
name =
"i2c-at91sam9g20",
351 .resource = twi_resources,
376 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
379 static struct resource spi_resources[] = {
396 .dma_mask = &spi_dmamask,
399 .resource = spi_resources,
409 unsigned long cs_pin;
416 for (i = 0; i < nr_devices; i++) {
417 if (devices[i].controller_data)
418 cs_pin = (
unsigned long) devices[i].controller_data;
422 if (!gpio_is_valid(cs_pin))
429 devices[
i].controller_data = (
void *) cs_pin;
444 #if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
448 static struct resource ac97_resources[] = {
462 .
name =
"atmel_ac97c",
465 .dma_mask = &ac97_dmamask,
469 .resource = ac97_resources,
499 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
503 static struct resource lcdc_resources[] = {
517 .
name =
"atmel_lcdfb",
520 .dma_mask = &lcdc_dmamask,
522 .platform_data = &lcdc_data,
524 .resource = lcdc_resources,
568 #ifdef CONFIG_ATMEL_TCLIB
570 static struct resource tcb_resources[] = {
596 .resource = tcb_resources,
600 static void __init at91_add_device_tc(
void)
605 static void __init at91_add_device_tc(
void) { }
613 #if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
617 static struct resource tsadcc_resources[] = {
631 .
name =
"atmel_tsadcc",
634 .dma_mask = &tsadcc_dmamask,
636 .platform_data = &tsadcc_data,
638 .resource = tsadcc_resources,
639 .num_resources =
ARRAY_SIZE(tsadcc_resources),
664 #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
671 static void __init at91_add_device_rtc(
void)
676 static void __init at91_add_device_rtc(
void) {}
684 static struct resource rtt_resources[] = {
699 .resource = rtt_resources,
702 #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
703 static void __init at91_add_device_rtt_rtc(
void)
705 at91sam9rl_rtt_device.
name =
"rtc-at91sam9";
712 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
713 rtt_resources[1].
end = rtt_resources[1].
start + 3;
718 static void __init at91_add_device_rtt_rtc(
void)
725 static void __init at91_add_device_rtt(
void)
727 at91_add_device_rtt_rtc();
736 #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
737 static struct resource wdt_resources[] = {
748 .resource = wdt_resources,
752 static void __init at91_add_device_watchdog(
void)
757 static void __init at91_add_device_watchdog(
void) {}
765 #if defined(CONFIG_ATMEL_PWM)
768 static struct resource pwm_resources[] = {
785 .platform_data = &pwm_mask,
787 .resource = pwm_resources,
818 #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
821 static struct resource ssc0_resources[] = {
838 .dma_mask = &ssc0_dmamask,
841 .resource = ssc0_resources,
845 static inline void configure_ssc0_pins(
unsigned pins)
863 static struct resource ssc1_resources[] = {
880 .dma_mask = &ssc1_dmamask,
883 .resource = ssc1_resources,
887 static inline void configure_ssc1_pins(
unsigned pins)
889 if (pins & ATMEL_SSC_TF)
891 if (pins & ATMEL_SSC_TK)
893 if (pins & ATMEL_SSC_TD)
895 if (pins & ATMEL_SSC_RD)
897 if (pins & ATMEL_SSC_RK)
919 pdev = &at91sam9rl_ssc0_device;
920 configure_ssc0_pins(pins);
923 pdev = &at91sam9rl_ssc1_device;
924 configure_ssc1_pins(pins);
942 #if defined(CONFIG_SERIAL_ATMEL)
943 static struct resource dbgu_resources[] = {
964 .
name =
"atmel_usart",
967 .dma_mask = &dbgu_dmamask,
969 .platform_data = &dbgu_data,
971 .resource = dbgu_resources,
975 static inline void configure_dbgu_pins(
void)
981 static struct resource uart0_resources[] = {
1002 .
name =
"atmel_usart",
1005 .dma_mask = &uart0_dmamask,
1007 .platform_data = &uart0_data,
1009 .resource = uart0_resources,
1010 .num_resources =
ARRAY_SIZE(uart0_resources),
1013 static inline void configure_usart0_pins(
unsigned pins)
1032 static struct resource uart1_resources[] = {
1053 .
name =
"atmel_usart",
1056 .dma_mask = &uart1_dmamask,
1058 .platform_data = &uart1_data,
1060 .resource = uart1_resources,
1061 .num_resources =
ARRAY_SIZE(uart1_resources),
1064 static inline void configure_usart1_pins(
unsigned pins)
1069 if (pins & ATMEL_UART_RTS)
1071 if (pins & ATMEL_UART_CTS)
1075 static struct resource uart2_resources[] = {
1096 .
name =
"atmel_usart",
1099 .dma_mask = &uart2_dmamask,
1101 .platform_data = &uart2_data,
1103 .resource = uart2_resources,
1104 .num_resources =
ARRAY_SIZE(uart2_resources),
1107 static inline void configure_usart2_pins(
unsigned pins)
1112 if (pins & ATMEL_UART_RTS)
1114 if (pins & ATMEL_UART_CTS)
1118 static struct resource uart3_resources[] = {
1139 .
name =
"atmel_usart",
1142 .dma_mask = &uart3_dmamask,
1144 .platform_data = &uart3_data,
1146 .resource = uart3_resources,
1147 .num_resources =
ARRAY_SIZE(uart3_resources),
1150 static inline void configure_usart3_pins(
unsigned pins)
1155 if (pins & ATMEL_UART_RTS)
1157 if (pins & ATMEL_UART_CTS)
1170 pdev = &at91sam9rl_dbgu_device;
1171 configure_dbgu_pins();
1174 pdev = &at91sam9rl_uart0_device;
1175 configure_usart0_pins(pins);
1178 pdev = &at91sam9rl_uart1_device;
1179 configure_usart1_pins(pins);
1182 pdev = &at91sam9rl_uart2_device;
1183 configure_usart2_pins(pins);
1186 pdev = &at91sam9rl_uart3_device;
1187 configure_usart3_pins(pins);
1192 pdata = pdev->
dev.platform_data;
1193 pdata->
num = portnr;
1196 at91_uarts[portnr] = pdev;
1220 static int __init at91_add_standard_devices(
void)
1223 at91_add_device_rtc();
1224 at91_add_device_rtt();
1225 at91_add_device_watchdog();
1226 at91_add_device_tc();