29 #include <mach/board.h>
35 #include <mach/atmel-mci.h>
47 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
50 static struct resource hdmac_resources[] = {
64 .
name =
"at91sam9g45_dma",
67 .dma_mask = &hdmac_dmamask,
70 .resource = hdmac_resources,
87 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
91 static struct resource usbh_ohci_resources[] = {
108 .dma_mask = &ohci_dmamask,
110 .platform_data = &usbh_ohci_data,
112 .resource = usbh_ohci_resources,
113 .num_resources =
ARRAY_SIZE(usbh_ohci_resources),
124 for (i = 0; i < data->
ports; i++) {
125 if (gpio_is_valid(data->
vbus_pin[i]))
131 for (i = 0; i < data->
ports; i++) {
136 usbh_ohci_data = *
data;
149 #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
153 static struct resource usbh_ehci_resources[] = {
167 .
name =
"atmel-ehci",
170 .dma_mask = &ehci_dmamask,
172 .platform_data = &usbh_ehci_data,
174 .resource = usbh_ehci_resources,
175 .num_resources =
ARRAY_SIZE(usbh_ehci_resources),
186 for (i = 0; i < data->
ports; i++) {
187 if (gpio_is_valid(data->
vbus_pin[i]))
192 usbh_ehci_data = *
data;
204 #if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
205 static struct resource usba_udc_resources[] = {
223 #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
227 .fifo_size = maxpkt, \
234 EP(
"ep0", 0, 64, 1, 0, 0),
235 EP(
"ep1", 1, 1024, 2, 1, 1),
236 EP(
"ep2", 2, 1024, 2, 1, 1),
237 EP(
"ep3", 3, 1024, 3, 1, 0),
238 EP(
"ep4", 4, 1024, 3, 1, 0),
239 EP(
"ep5", 5, 1024, 3, 1, 1),
240 EP(
"ep6", 6, 1024, 3, 1, 1),
255 .
name =
"atmel_usba_udc",
258 .platform_data = &usba_udc_data.pdata,
260 .resource = usba_udc_resources,
261 .num_resources =
ARRAY_SIZE(usba_udc_resources),
266 usba_udc_data.pdata.vbus_pin = -
EINVAL;
267 usba_udc_data.pdata.num_ep =
ARRAY_SIZE(usba_udc_ep);
268 memcpy(usba_udc_data.ep, usba_udc_ep,
sizeof(usba_udc_ep));
270 if (data && gpio_is_valid(data->
vbus_pin)) {
273 usba_udc_data.pdata.vbus_pin = data->
vbus_pin;
289 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
293 static struct resource eth_resources[] = {
310 .dma_mask = ð_dmamask,
312 .platform_data = ð_data,
314 .resource = eth_resources,
363 #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
367 static struct resource mmc0_resources[] = {
384 .dma_mask = &mmc_dmamask,
386 .platform_data = &mmc0_data,
388 .resource = mmc0_resources,
392 static struct resource mmc1_resources[] = {
409 .dma_mask = &mmc_dmamask,
411 .platform_data = &mmc1_data,
413 .resource = mmc1_resources,
425 if (!data->
slot[0].bus_width)
428 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
434 atslave = &alt_atslave->
sdata;
454 if (gpio_is_valid(data->
slot[0].detect_pin)) {
458 if (gpio_is_valid(data->
slot[0].wp_pin))
471 if (data->
slot[0].bus_width == 4) {
475 if (data->
slot[0].bus_width == 8) {
496 if (data->
slot[0].bus_width == 4) {
500 if (data->
slot[0].bus_width == 8) {
522 #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
525 #define NAND_BASE AT91_CHIPSELECT_3
527 static struct resource nand_resources[] = {
530 .end = NAND_BASE +
SZ_256M - 1,
541 .
name =
"atmel_nand",
544 .platform_data = &nand_data,
546 .resource = nand_resources,
565 if (gpio_is_valid(data->
rdy_pin))
569 if (gpio_is_valid(data->
det_pin))
589 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
592 .sda_is_open_drain = 1,
594 .scl_is_open_drain = 1,
601 .dev.platform_data = &pdata_i2c0,
606 .sda_is_open_drain = 1,
608 .scl_is_open_drain = 1,
615 .dev.platform_data = &pdata_i2c1,
641 #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
642 static struct resource twi0_resources[] = {
656 .
name =
"i2c-at91sam9g10",
658 .resource = twi0_resources,
662 static struct resource twi1_resources[] = {
676 .
name =
"i2c-at91sam9g10",
678 .resource = twi1_resources,
708 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
711 static struct resource spi0_resources[] = {
728 .dma_mask = &spi_dmamask,
731 .resource = spi0_resources,
737 static struct resource spi1_resources[] = {
754 .dma_mask = &spi_dmamask,
757 .resource = spi1_resources,
766 unsigned long cs_pin;
767 short enable_spi0 = 0;
768 short enable_spi1 = 0;
771 for (i = 0; i < nr_devices; i++) {
772 if (devices[i].controller_data)
773 cs_pin = (
unsigned long) devices[i].controller_data;
774 else if (devices[i].bus_num == 0)
777 cs_pin = spi1_standard_cs[devices[
i].chip_select];
779 if (!gpio_is_valid(cs_pin))
782 if (devices[i].bus_num == 0)
791 devices[
i].controller_data = (
void *) cs_pin;
821 #if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
825 static struct resource ac97_resources[] = {
839 .
name =
"atmel_ac97c",
842 .dma_mask = &ac97_dmamask,
846 .resource = ac97_resources,
874 #if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
895 .dma_mask = &isi_dmamask,
897 .platform_data = &isi_data,
899 .resource = isi_resources,
903 static struct clk_lookup isi_mck_lookups[] = {
935 if (use_pck_as_mck) {
941 BUG_ON(IS_ERR(pck) || IS_ERR(parent));
944 pr_err(
"Failed to set PCK's parent\n");
947 isi_mck_lookups[0].
clk = pck;
958 bool use_pck_as_mck) {}
966 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
970 static struct resource lcdc_resources[] = {
984 .
name =
"atmel_lcdfb",
987 .dma_mask = &lcdc_dmamask,
989 .platform_data = &lcdc_data,
991 .resource = lcdc_resources,
1044 #ifdef CONFIG_ATMEL_TCLIB
1045 static struct resource tcb0_resources[] = {
1059 .
name =
"atmel_tcb",
1061 .resource = tcb0_resources,
1066 static struct resource tcb1_resources[] = {
1080 .
name =
"atmel_tcb",
1082 .resource = tcb1_resources,
1086 static void __init at91_add_device_tc(
void)
1092 static void __init at91_add_device_tc(
void) { }
1100 #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
1101 static struct resource rtc_resources[] = {
1117 .resource = rtc_resources,
1121 static void __init at91_add_device_rtc(
void)
1126 static void __init at91_add_device_rtc(
void) {}
1134 #if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
1138 static struct resource tsadcc_resources[] = {
1152 .
name =
"atmel_tsadcc",
1155 .dma_mask = &tsadcc_dmamask,
1157 .platform_data = &tsadcc_data,
1159 .resource = tsadcc_resources,
1160 .num_resources =
ARRAY_SIZE(tsadcc_resources),
1173 tsadcc_data = *
data;
1185 #if IS_ENABLED(CONFIG_AT91_ADC)
1188 static struct resource adc_resources[] = {
1205 .platform_data = &adc_data,
1207 .resource = adc_resources,
1213 .
name =
"external-rising",
1215 .is_external =
true,
1218 .name =
"external-falling",
1220 .is_external =
true,
1223 .name =
"external-any",
1225 .is_external =
true,
1228 .name =
"continuous",
1230 .is_external =
false,
1238 .trigger_register = 0x08,
1268 data->
registers = &at91_adc_register_g45;
1283 static struct resource rtt_resources[] = {
1298 .resource = rtt_resources,
1301 #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
1302 static void __init at91_add_device_rtt_rtc(
void)
1304 at91sam9g45_rtt_device.
name =
"rtc-at91sam9";
1311 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
1312 rtt_resources[1].
end = rtt_resources[1].
start + 3;
1317 static void __init at91_add_device_rtt_rtc(
void)
1324 static void __init at91_add_device_rtt(
void)
1326 at91_add_device_rtt_rtc();
1335 #if defined(CONFIG_HW_RANDOM_ATMEL) || defined(CONFIG_HW_RANDOM_ATMEL_MODULE)
1336 static struct resource trng_resources[] = {
1345 .
name =
"atmel-trng",
1347 .resource = trng_resources,
1351 static void __init at91_add_device_trng(
void)
1356 static void __init at91_add_device_trng(
void) {}
1363 #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
1364 static struct resource wdt_resources[] = {
1375 .resource = wdt_resources,
1379 static void __init at91_add_device_watchdog(
void)
1384 static void __init at91_add_device_watchdog(
void) {}
1392 #if defined(CONFIG_ATMEL_PWM) || defined(CONFIG_ATMEL_PWM_MODULE)
1393 static u32 pwm_mask;
1395 static struct resource pwm_resources[] = {
1409 .
name =
"atmel_pwm",
1412 .platform_data = &pwm_mask,
1414 .resource = pwm_resources,
1445 #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
1448 static struct resource ssc0_resources[] = {
1465 .dma_mask = &ssc0_dmamask,
1468 .resource = ssc0_resources,
1472 static inline void configure_ssc0_pins(
unsigned pins)
1490 static struct resource ssc1_resources[] = {
1507 .dma_mask = &ssc1_dmamask,
1510 .resource = ssc1_resources,
1514 static inline void configure_ssc1_pins(
unsigned pins)
1516 if (pins & ATMEL_SSC_TF)
1518 if (pins & ATMEL_SSC_TK)
1520 if (pins & ATMEL_SSC_TD)
1522 if (pins & ATMEL_SSC_RD)
1524 if (pins & ATMEL_SSC_RK)
1546 pdev = &at91sam9g45_ssc0_device;
1547 configure_ssc0_pins(pins);
1550 pdev = &at91sam9g45_ssc1_device;
1551 configure_ssc1_pins(pins);
1569 #if defined(CONFIG_SERIAL_ATMEL)
1570 static struct resource dbgu_resources[] = {
1591 .
name =
"atmel_usart",
1594 .dma_mask = &dbgu_dmamask,
1596 .platform_data = &dbgu_data,
1598 .resource = dbgu_resources,
1602 static inline void configure_dbgu_pins(
void)
1608 static struct resource uart0_resources[] = {
1629 .
name =
"atmel_usart",
1632 .dma_mask = &uart0_dmamask,
1634 .platform_data = &uart0_data,
1636 .resource = uart0_resources,
1637 .num_resources =
ARRAY_SIZE(uart0_resources),
1640 static inline void configure_usart0_pins(
unsigned pins)
1651 static struct resource uart1_resources[] = {
1672 .
name =
"atmel_usart",
1675 .dma_mask = &uart1_dmamask,
1677 .platform_data = &uart1_data,
1679 .resource = uart1_resources,
1680 .num_resources =
ARRAY_SIZE(uart1_resources),
1683 static inline void configure_usart1_pins(
unsigned pins)
1688 if (pins & ATMEL_UART_RTS)
1694 static struct resource uart2_resources[] = {
1715 .
name =
"atmel_usart",
1718 .dma_mask = &uart2_dmamask,
1720 .platform_data = &uart2_data,
1722 .resource = uart2_resources,
1723 .num_resources =
ARRAY_SIZE(uart2_resources),
1726 static inline void configure_usart2_pins(
unsigned pins)
1731 if (pins & ATMEL_UART_RTS)
1737 static struct resource uart3_resources[] = {
1758 .
name =
"atmel_usart",
1761 .dma_mask = &uart3_dmamask,
1763 .platform_data = &uart3_data,
1765 .resource = uart3_resources,
1766 .num_resources =
ARRAY_SIZE(uart3_resources),
1769 static inline void configure_usart3_pins(
unsigned pins)
1774 if (pins & ATMEL_UART_RTS)
1789 pdev = &at91sam9g45_dbgu_device;
1790 configure_dbgu_pins();
1793 pdev = &at91sam9g45_uart0_device;
1794 configure_usart0_pins(pins);
1797 pdev = &at91sam9g45_uart1_device;
1798 configure_usart1_pins(pins);
1801 pdev = &at91sam9g45_uart2_device;
1802 configure_usart2_pins(pins);
1805 pdev = &at91sam9g45_uart3_device;
1806 configure_usart3_pins(pins);
1811 pdata = pdev->
dev.platform_data;
1812 pdata->
num = portnr;
1815 at91_uarts[portnr] = pdev;
1836 #if defined(CONFIG_CRYPTO_DEV_ATMEL_SHA) || defined(CONFIG_CRYPTO_DEV_ATMEL_SHA_MODULE)
1837 static struct resource sha_resources[] = {
1851 .
name =
"atmel_sha",
1853 .resource = sha_resources,
1857 static void __init at91_add_device_sha(
void)
1862 static void __init at91_add_device_sha(
void) {}
1869 #if defined(CONFIG_CRYPTO_DEV_ATMEL_TDES) || defined(CONFIG_CRYPTO_DEV_ATMEL_TDES_MODULE)
1870 static struct resource tdes_resources[] = {
1884 .
name =
"atmel_tdes",
1886 .resource = tdes_resources,
1890 static void __init at91_add_device_tdes(
void)
1895 static void __init at91_add_device_tdes(
void) {}
1902 #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE)
1906 static struct resource aes_resources[] = {
1920 .
name =
"atmel_aes",
1923 .dma_mask = &aes_dmamask,
1925 .platform_data = &aes_data,
1927 .resource = aes_resources,
1931 static void __init at91_add_device_aes(
void)
1939 atslave = &alt_atslave->
txdata;
1945 atslave = &alt_atslave->
rxdata;
1950 aes_data.dma_slave = alt_atslave;
1954 static void __init at91_add_device_aes(
void) {}
1962 static int __init at91_add_standard_devices(
void)
1964 if (of_have_populated_dt())
1968 at91_add_device_rtc();
1969 at91_add_device_rtt();
1970 at91_add_device_trng();
1971 at91_add_device_watchdog();
1972 at91_add_device_tc();
1973 at91_add_device_sha();
1974 at91_add_device_tdes();
1975 at91_add_device_aes();