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/dma-mapping.h>
16 #include <linux/platform_device.h>
17 #include <linux/i2c-gpio.h>
19 #include <mach/board.h>
20 #include <mach/gpio.h>
22 #include <mach/at91sam9260.h>
23 #include <mach/at91sam9260_matrix.h>
24 #include <mach/at91sam9_smc.h>
29 /* --------------------------------------------------------------------
31 * -------------------------------------------------------------------- */
33 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
34 static u64 ohci_dmamask
= DMA_BIT_MASK(32);
35 static struct at91_usbh_data usbh_data
;
37 static struct resource usbh_resources
[] = {
39 .start
= AT91SAM9260_UHP_BASE
,
40 .end
= AT91SAM9260_UHP_BASE
+ SZ_1M
- 1,
41 .flags
= IORESOURCE_MEM
,
44 .start
= AT91SAM9260_ID_UHP
,
45 .end
= AT91SAM9260_ID_UHP
,
46 .flags
= IORESOURCE_IRQ
,
50 static struct platform_device at91_usbh_device
= {
54 .dma_mask
= &ohci_dmamask
,
55 .coherent_dma_mask
= DMA_BIT_MASK(32),
56 .platform_data
= &usbh_data
,
58 .resource
= usbh_resources
,
59 .num_resources
= ARRAY_SIZE(usbh_resources
),
62 void __init
at91_add_device_usbh(struct at91_usbh_data
*data
)
68 platform_device_register(&at91_usbh_device
);
71 void __init
at91_add_device_usbh(struct at91_usbh_data
*data
) {}
75 /* --------------------------------------------------------------------
77 * -------------------------------------------------------------------- */
79 #ifdef CONFIG_USB_GADGET_AT91
80 static struct at91_udc_data udc_data
;
82 static struct resource udc_resources
[] = {
84 .start
= AT91SAM9260_BASE_UDP
,
85 .end
= AT91SAM9260_BASE_UDP
+ SZ_16K
- 1,
86 .flags
= IORESOURCE_MEM
,
89 .start
= AT91SAM9260_ID_UDP
,
90 .end
= AT91SAM9260_ID_UDP
,
91 .flags
= IORESOURCE_IRQ
,
95 static struct platform_device at91_udc_device
= {
99 .platform_data
= &udc_data
,
101 .resource
= udc_resources
,
102 .num_resources
= ARRAY_SIZE(udc_resources
),
105 void __init
at91_add_device_udc(struct at91_udc_data
*data
)
110 if (data
->vbus_pin
) {
111 at91_set_gpio_input(data
->vbus_pin
, 0);
112 at91_set_deglitch(data
->vbus_pin
, 1);
115 /* Pullup pin is handled internally by USB device peripheral */
118 platform_device_register(&at91_udc_device
);
121 void __init
at91_add_device_udc(struct at91_udc_data
*data
) {}
125 /* --------------------------------------------------------------------
127 * -------------------------------------------------------------------- */
129 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
130 static u64 eth_dmamask
= DMA_BIT_MASK(32);
131 static struct at91_eth_data eth_data
;
133 static struct resource eth_resources
[] = {
135 .start
= AT91SAM9260_BASE_EMAC
,
136 .end
= AT91SAM9260_BASE_EMAC
+ SZ_16K
- 1,
137 .flags
= IORESOURCE_MEM
,
140 .start
= AT91SAM9260_ID_EMAC
,
141 .end
= AT91SAM9260_ID_EMAC
,
142 .flags
= IORESOURCE_IRQ
,
146 static struct platform_device at91sam9260_eth_device
= {
150 .dma_mask
= ð_dmamask
,
151 .coherent_dma_mask
= DMA_BIT_MASK(32),
152 .platform_data
= ð_data
,
154 .resource
= eth_resources
,
155 .num_resources
= ARRAY_SIZE(eth_resources
),
158 void __init
at91_add_device_eth(struct at91_eth_data
*data
)
163 if (data
->phy_irq_pin
) {
164 at91_set_gpio_input(data
->phy_irq_pin
, 0);
165 at91_set_deglitch(data
->phy_irq_pin
, 1);
168 /* Pins used for MII and RMII */
169 at91_set_A_periph(AT91_PIN_PA19
, 0); /* ETXCK_EREFCK */
170 at91_set_A_periph(AT91_PIN_PA17
, 0); /* ERXDV */
171 at91_set_A_periph(AT91_PIN_PA14
, 0); /* ERX0 */
172 at91_set_A_periph(AT91_PIN_PA15
, 0); /* ERX1 */
173 at91_set_A_periph(AT91_PIN_PA18
, 0); /* ERXER */
174 at91_set_A_periph(AT91_PIN_PA16
, 0); /* ETXEN */
175 at91_set_A_periph(AT91_PIN_PA12
, 0); /* ETX0 */
176 at91_set_A_periph(AT91_PIN_PA13
, 0); /* ETX1 */
177 at91_set_A_periph(AT91_PIN_PA21
, 0); /* EMDIO */
178 at91_set_A_periph(AT91_PIN_PA20
, 0); /* EMDC */
180 if (!data
->is_rmii
) {
181 at91_set_B_periph(AT91_PIN_PA28
, 0); /* ECRS */
182 at91_set_B_periph(AT91_PIN_PA29
, 0); /* ECOL */
183 at91_set_B_periph(AT91_PIN_PA25
, 0); /* ERX2 */
184 at91_set_B_periph(AT91_PIN_PA26
, 0); /* ERX3 */
185 at91_set_B_periph(AT91_PIN_PA27
, 0); /* ERXCK */
186 at91_set_B_periph(AT91_PIN_PA23
, 0); /* ETX2 */
187 at91_set_B_periph(AT91_PIN_PA24
, 0); /* ETX3 */
188 at91_set_B_periph(AT91_PIN_PA22
, 0); /* ETXER */
192 platform_device_register(&at91sam9260_eth_device
);
195 void __init
at91_add_device_eth(struct at91_eth_data
*data
) {}
199 /* --------------------------------------------------------------------
201 * -------------------------------------------------------------------- */
203 #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
204 static u64 mmc_dmamask
= DMA_BIT_MASK(32);
205 static struct at91_mmc_data mmc_data
;
207 static struct resource mmc_resources
[] = {
209 .start
= AT91SAM9260_BASE_MCI
,
210 .end
= AT91SAM9260_BASE_MCI
+ SZ_16K
- 1,
211 .flags
= IORESOURCE_MEM
,
214 .start
= AT91SAM9260_ID_MCI
,
215 .end
= AT91SAM9260_ID_MCI
,
216 .flags
= IORESOURCE_IRQ
,
220 static struct platform_device at91sam9260_mmc_device
= {
224 .dma_mask
= &mmc_dmamask
,
225 .coherent_dma_mask
= DMA_BIT_MASK(32),
226 .platform_data
= &mmc_data
,
228 .resource
= mmc_resources
,
229 .num_resources
= ARRAY_SIZE(mmc_resources
),
232 void __init
at91_add_device_mmc(short mmc_id
, struct at91_mmc_data
*data
)
239 at91_set_gpio_input(data
->det_pin
, 1);
240 at91_set_deglitch(data
->det_pin
, 1);
243 at91_set_gpio_input(data
->wp_pin
, 1);
245 at91_set_gpio_output(data
->vcc_pin
, 0);
248 at91_set_A_periph(AT91_PIN_PA8
, 0);
252 at91_set_B_periph(AT91_PIN_PA1
, 1);
254 /* DAT0, maybe DAT1..DAT3 */
255 at91_set_B_periph(AT91_PIN_PA0
, 1);
257 at91_set_B_periph(AT91_PIN_PA5
, 1);
258 at91_set_B_periph(AT91_PIN_PA4
, 1);
259 at91_set_B_periph(AT91_PIN_PA3
, 1);
263 at91_set_A_periph(AT91_PIN_PA7
, 1);
265 /* DAT0, maybe DAT1..DAT3 */
266 at91_set_A_periph(AT91_PIN_PA6
, 1);
268 at91_set_A_periph(AT91_PIN_PA9
, 1);
269 at91_set_A_periph(AT91_PIN_PA10
, 1);
270 at91_set_A_periph(AT91_PIN_PA11
, 1);
275 platform_device_register(&at91sam9260_mmc_device
);
278 void __init
at91_add_device_mmc(short mmc_id
, struct at91_mmc_data
*data
) {}
282 /* --------------------------------------------------------------------
284 * -------------------------------------------------------------------- */
286 #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
287 static struct atmel_nand_data nand_data
;
289 #define NAND_BASE AT91_CHIPSELECT_3
291 static struct resource nand_resources
[] = {
294 .end
= NAND_BASE
+ SZ_256M
- 1,
295 .flags
= IORESOURCE_MEM
,
298 .start
= AT91_BASE_SYS
+ AT91_ECC
,
299 .end
= AT91_BASE_SYS
+ AT91_ECC
+ SZ_512
- 1,
300 .flags
= IORESOURCE_MEM
,
304 static struct platform_device at91sam9260_nand_device
= {
305 .name
= "atmel_nand",
308 .platform_data
= &nand_data
,
310 .resource
= nand_resources
,
311 .num_resources
= ARRAY_SIZE(nand_resources
),
314 void __init
at91_add_device_nand(struct atmel_nand_data
*data
)
316 unsigned long csa
, mode
;
321 csa
= at91_sys_read(AT91_MATRIX_EBICSA
);
322 at91_sys_write(AT91_MATRIX_EBICSA
, csa
| AT91_MATRIX_CS3A_SMC_SMARTMEDIA
);
324 if (cpu_is_at91sam9260()) {
325 /* Timing for sam9260 */
326 /* set the bus interface characteristics */
327 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
328 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
330 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
331 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
333 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
335 if (data
->bus_width_16
)
336 mode
= AT91_SMC_DBW_16
;
338 mode
= AT91_SMC_DBW_8
;
339 at91_sys_write(AT91_SMC_MODE(3), mode
| AT91_SMC_READMODE
| AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE
| AT91_SMC_TDF_(2));
342 if (cpu_is_at91sam9g20()) {
343 /* Timing for sam9g20 */
344 /* set the bus interface characteristics */
345 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0)
346 | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
348 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(4)
349 | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(4));
351 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
353 if (data
->bus_width_16
)
354 mode
= AT91_SMC_DBW_16
;
356 mode
= AT91_SMC_DBW_8
;
357 at91_sys_write(AT91_SMC_MODE(3), mode
| AT91_SMC_READMODE
| AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE
| AT91_SMC_TDF_(3));
361 if (data
->enable_pin
)
362 at91_set_gpio_output(data
->enable_pin
, 1);
366 at91_set_gpio_input(data
->rdy_pin
, 1);
368 /* card detect pin */
370 at91_set_gpio_input(data
->det_pin
, 1);
373 platform_device_register(&at91sam9260_nand_device
);
376 void __init
at91_add_device_nand(struct atmel_nand_data
*data
) {}
380 /* --------------------------------------------------------------------
382 * -------------------------------------------------------------------- */
385 * Prefer the GPIO code since the TWI controller isn't robust
386 * (gets overruns and underruns under load) and can only issue
387 * repeated STARTs in one scenario (the driver doesn't yet handle them).
390 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
392 static struct i2c_gpio_platform_data pdata
= {
393 .sda_pin
= AT91_PIN_PA23
,
394 .sda_is_open_drain
= 1,
395 .scl_pin
= AT91_PIN_PA24
,
396 .scl_is_open_drain
= 1,
397 .udelay
= 2, /* ~100 kHz */
400 static struct platform_device at91sam9260_twi_device
= {
403 .dev
.platform_data
= &pdata
,
406 void __init
at91_add_device_i2c(struct i2c_board_info
*devices
, int nr_devices
)
408 at91_set_GPIO_periph(AT91_PIN_PA23
, 1); /* TWD (SDA) */
409 at91_set_multi_drive(AT91_PIN_PA23
, 1);
411 at91_set_GPIO_periph(AT91_PIN_PA24
, 1); /* TWCK (SCL) */
412 at91_set_multi_drive(AT91_PIN_PA24
, 1);
414 i2c_register_board_info(0, devices
, nr_devices
);
415 platform_device_register(&at91sam9260_twi_device
);
418 #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
420 static struct resource twi_resources
[] = {
422 .start
= AT91SAM9260_BASE_TWI
,
423 .end
= AT91SAM9260_BASE_TWI
+ SZ_16K
- 1,
424 .flags
= IORESOURCE_MEM
,
427 .start
= AT91SAM9260_ID_TWI
,
428 .end
= AT91SAM9260_ID_TWI
,
429 .flags
= IORESOURCE_IRQ
,
433 static struct platform_device at91sam9260_twi_device
= {
436 .resource
= twi_resources
,
437 .num_resources
= ARRAY_SIZE(twi_resources
),
440 void __init
at91_add_device_i2c(struct i2c_board_info
*devices
, int nr_devices
)
442 /* pins used for TWI interface */
443 at91_set_A_periph(AT91_PIN_PA23
, 0); /* TWD */
444 at91_set_multi_drive(AT91_PIN_PA23
, 1);
446 at91_set_A_periph(AT91_PIN_PA24
, 0); /* TWCK */
447 at91_set_multi_drive(AT91_PIN_PA24
, 1);
449 i2c_register_board_info(0, devices
, nr_devices
);
450 platform_device_register(&at91sam9260_twi_device
);
453 void __init
at91_add_device_i2c(struct i2c_board_info
*devices
, int nr_devices
) {}
457 /* --------------------------------------------------------------------
459 * -------------------------------------------------------------------- */
461 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
462 static u64 spi_dmamask
= DMA_BIT_MASK(32);
464 static struct resource spi0_resources
[] = {
466 .start
= AT91SAM9260_BASE_SPI0
,
467 .end
= AT91SAM9260_BASE_SPI0
+ SZ_16K
- 1,
468 .flags
= IORESOURCE_MEM
,
471 .start
= AT91SAM9260_ID_SPI0
,
472 .end
= AT91SAM9260_ID_SPI0
,
473 .flags
= IORESOURCE_IRQ
,
477 static struct platform_device at91sam9260_spi0_device
= {
481 .dma_mask
= &spi_dmamask
,
482 .coherent_dma_mask
= DMA_BIT_MASK(32),
484 .resource
= spi0_resources
,
485 .num_resources
= ARRAY_SIZE(spi0_resources
),
488 static const unsigned spi0_standard_cs
[4] = { AT91_PIN_PA3
, AT91_PIN_PC11
, AT91_PIN_PC16
, AT91_PIN_PC17
};
490 static struct resource spi1_resources
[] = {
492 .start
= AT91SAM9260_BASE_SPI1
,
493 .end
= AT91SAM9260_BASE_SPI1
+ SZ_16K
- 1,
494 .flags
= IORESOURCE_MEM
,
497 .start
= AT91SAM9260_ID_SPI1
,
498 .end
= AT91SAM9260_ID_SPI1
,
499 .flags
= IORESOURCE_IRQ
,
503 static struct platform_device at91sam9260_spi1_device
= {
507 .dma_mask
= &spi_dmamask
,
508 .coherent_dma_mask
= DMA_BIT_MASK(32),
510 .resource
= spi1_resources
,
511 .num_resources
= ARRAY_SIZE(spi1_resources
),
514 static const unsigned spi1_standard_cs
[4] = { AT91_PIN_PB3
, AT91_PIN_PC5
, AT91_PIN_PC4
, AT91_PIN_PC3
};
516 void __init
at91_add_device_spi(struct spi_board_info
*devices
, int nr_devices
)
519 unsigned long cs_pin
;
520 short enable_spi0
= 0;
521 short enable_spi1
= 0;
523 /* Choose SPI chip-selects */
524 for (i
= 0; i
< nr_devices
; i
++) {
525 if (devices
[i
].controller_data
)
526 cs_pin
= (unsigned long) devices
[i
].controller_data
;
527 else if (devices
[i
].bus_num
== 0)
528 cs_pin
= spi0_standard_cs
[devices
[i
].chip_select
];
530 cs_pin
= spi1_standard_cs
[devices
[i
].chip_select
];
532 if (devices
[i
].bus_num
== 0)
537 /* enable chip-select pin */
538 at91_set_gpio_output(cs_pin
, 1);
540 /* pass chip-select pin to driver */
541 devices
[i
].controller_data
= (void *) cs_pin
;
544 spi_register_board_info(devices
, nr_devices
);
546 /* Configure SPI bus(es) */
548 at91_set_A_periph(AT91_PIN_PA0
, 0); /* SPI0_MISO */
549 at91_set_A_periph(AT91_PIN_PA1
, 0); /* SPI0_MOSI */
550 at91_set_A_periph(AT91_PIN_PA2
, 0); /* SPI1_SPCK */
552 at91_clock_associate("spi0_clk", &at91sam9260_spi0_device
.dev
, "spi_clk");
553 platform_device_register(&at91sam9260_spi0_device
);
556 at91_set_A_periph(AT91_PIN_PB0
, 0); /* SPI1_MISO */
557 at91_set_A_periph(AT91_PIN_PB1
, 0); /* SPI1_MOSI */
558 at91_set_A_periph(AT91_PIN_PB2
, 0); /* SPI1_SPCK */
560 at91_clock_associate("spi1_clk", &at91sam9260_spi1_device
.dev
, "spi_clk");
561 platform_device_register(&at91sam9260_spi1_device
);
565 void __init
at91_add_device_spi(struct spi_board_info
*devices
, int nr_devices
) {}
569 /* --------------------------------------------------------------------
570 * Timer/Counter blocks
571 * -------------------------------------------------------------------- */
573 #ifdef CONFIG_ATMEL_TCLIB
575 static struct resource tcb0_resources
[] = {
577 .start
= AT91SAM9260_BASE_TCB0
,
578 .end
= AT91SAM9260_BASE_TCB0
+ SZ_16K
- 1,
579 .flags
= IORESOURCE_MEM
,
582 .start
= AT91SAM9260_ID_TC0
,
583 .end
= AT91SAM9260_ID_TC0
,
584 .flags
= IORESOURCE_IRQ
,
587 .start
= AT91SAM9260_ID_TC1
,
588 .end
= AT91SAM9260_ID_TC1
,
589 .flags
= IORESOURCE_IRQ
,
592 .start
= AT91SAM9260_ID_TC2
,
593 .end
= AT91SAM9260_ID_TC2
,
594 .flags
= IORESOURCE_IRQ
,
598 static struct platform_device at91sam9260_tcb0_device
= {
601 .resource
= tcb0_resources
,
602 .num_resources
= ARRAY_SIZE(tcb0_resources
),
605 static struct resource tcb1_resources
[] = {
607 .start
= AT91SAM9260_BASE_TCB1
,
608 .end
= AT91SAM9260_BASE_TCB1
+ SZ_16K
- 1,
609 .flags
= IORESOURCE_MEM
,
612 .start
= AT91SAM9260_ID_TC3
,
613 .end
= AT91SAM9260_ID_TC3
,
614 .flags
= IORESOURCE_IRQ
,
617 .start
= AT91SAM9260_ID_TC4
,
618 .end
= AT91SAM9260_ID_TC4
,
619 .flags
= IORESOURCE_IRQ
,
622 .start
= AT91SAM9260_ID_TC5
,
623 .end
= AT91SAM9260_ID_TC5
,
624 .flags
= IORESOURCE_IRQ
,
628 static struct platform_device at91sam9260_tcb1_device
= {
631 .resource
= tcb1_resources
,
632 .num_resources
= ARRAY_SIZE(tcb1_resources
),
635 static void __init
at91_add_device_tc(void)
637 /* this chip has a separate clock and irq for each TC channel */
638 at91_clock_associate("tc0_clk", &at91sam9260_tcb0_device
.dev
, "t0_clk");
639 at91_clock_associate("tc1_clk", &at91sam9260_tcb0_device
.dev
, "t1_clk");
640 at91_clock_associate("tc2_clk", &at91sam9260_tcb0_device
.dev
, "t2_clk");
641 platform_device_register(&at91sam9260_tcb0_device
);
643 at91_clock_associate("tc3_clk", &at91sam9260_tcb1_device
.dev
, "t0_clk");
644 at91_clock_associate("tc4_clk", &at91sam9260_tcb1_device
.dev
, "t1_clk");
645 at91_clock_associate("tc5_clk", &at91sam9260_tcb1_device
.dev
, "t2_clk");
646 platform_device_register(&at91sam9260_tcb1_device
);
649 static void __init
at91_add_device_tc(void) { }
653 /* --------------------------------------------------------------------
655 * -------------------------------------------------------------------- */
657 static struct resource rtt_resources
[] = {
659 .start
= AT91_BASE_SYS
+ AT91_RTT
,
660 .end
= AT91_BASE_SYS
+ AT91_RTT
+ SZ_16
- 1,
661 .flags
= IORESOURCE_MEM
,
665 static struct platform_device at91sam9260_rtt_device
= {
668 .resource
= rtt_resources
,
669 .num_resources
= ARRAY_SIZE(rtt_resources
),
672 static void __init
at91_add_device_rtt(void)
674 platform_device_register(&at91sam9260_rtt_device
);
678 /* --------------------------------------------------------------------
680 * -------------------------------------------------------------------- */
682 #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
683 static struct platform_device at91sam9260_wdt_device
= {
689 static void __init
at91_add_device_watchdog(void)
691 platform_device_register(&at91sam9260_wdt_device
);
694 static void __init
at91_add_device_watchdog(void) {}
698 /* --------------------------------------------------------------------
699 * SSC -- Synchronous Serial Controller
700 * -------------------------------------------------------------------- */
702 #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
703 static u64 ssc_dmamask
= DMA_BIT_MASK(32);
705 static struct resource ssc_resources
[] = {
707 .start
= AT91SAM9260_BASE_SSC
,
708 .end
= AT91SAM9260_BASE_SSC
+ SZ_16K
- 1,
709 .flags
= IORESOURCE_MEM
,
712 .start
= AT91SAM9260_ID_SSC
,
713 .end
= AT91SAM9260_ID_SSC
,
714 .flags
= IORESOURCE_IRQ
,
718 static struct platform_device at91sam9260_ssc_device
= {
722 .dma_mask
= &ssc_dmamask
,
723 .coherent_dma_mask
= DMA_BIT_MASK(32),
725 .resource
= ssc_resources
,
726 .num_resources
= ARRAY_SIZE(ssc_resources
),
729 static inline void configure_ssc_pins(unsigned pins
)
731 if (pins
& ATMEL_SSC_TF
)
732 at91_set_A_periph(AT91_PIN_PB17
, 1);
733 if (pins
& ATMEL_SSC_TK
)
734 at91_set_A_periph(AT91_PIN_PB16
, 1);
735 if (pins
& ATMEL_SSC_TD
)
736 at91_set_A_periph(AT91_PIN_PB18
, 1);
737 if (pins
& ATMEL_SSC_RD
)
738 at91_set_A_periph(AT91_PIN_PB19
, 1);
739 if (pins
& ATMEL_SSC_RK
)
740 at91_set_A_periph(AT91_PIN_PB20
, 1);
741 if (pins
& ATMEL_SSC_RF
)
742 at91_set_A_periph(AT91_PIN_PB21
, 1);
746 * SSC controllers are accessed through library code, instead of any
747 * kind of all-singing/all-dancing driver. For example one could be
748 * used by a particular I2S audio codec's driver, while another one
749 * on the same system might be used by a custom data capture driver.
751 void __init
at91_add_device_ssc(unsigned id
, unsigned pins
)
753 struct platform_device
*pdev
;
756 * NOTE: caller is responsible for passing information matching
757 * "pins" to whatever will be using each particular controller.
760 case AT91SAM9260_ID_SSC
:
761 pdev
= &at91sam9260_ssc_device
;
762 configure_ssc_pins(pins
);
763 at91_clock_associate("ssc_clk", &pdev
->dev
, "pclk");
769 platform_device_register(pdev
);
773 void __init
at91_add_device_ssc(unsigned id
, unsigned pins
) {}
777 /* --------------------------------------------------------------------
779 * -------------------------------------------------------------------- */
780 #if defined(CONFIG_SERIAL_ATMEL)
782 const resource_size_t __initdata usart_base_addr
[ATMEL_MAX_UART
] = {
783 AT91_VA_BASE_SYS
+ AT91_DBGU
,
784 AT91SAM9260_BASE_US0
,
785 AT91SAM9260_BASE_US1
,
786 AT91SAM9260_BASE_US2
,
787 AT91SAM9260_BASE_US3
,
788 AT91SAM9260_BASE_US4
,
792 const resource_size_t __initdata usart_id_addr
[ATMEL_MAX_UART
] = {
802 void __init
configure_dbgu_pins(void)
804 at91_set_A_periph(AT91_PIN_PB14
, 0); /* DRXD */
805 at91_set_A_periph(AT91_PIN_PB15
, 1); /* DTXD */
808 void __init
configure_usart0_pins(void)
810 at91_set_A_periph(AT91_PIN_PB4
, 1); /* TXD0 */
811 at91_set_A_periph(AT91_PIN_PB5
, 0); /* RXD0 */
813 #if defined(CONFIG_AT91_USART0_UART_RTS)
814 at91_set_A_periph(AT91_PIN_PB26
, 0); /* RTS0 */
816 #if defined(CONFIG_AT91_USART0_UART_CTS)
817 at91_set_A_periph(AT91_PIN_PB27
, 0); /* CTS0 */
819 #if defined(CONFIG_AT91_USART0_UART_DTR)
820 at91_set_A_periph(AT91_PIN_PB24
, 0); /* DTR0 */
822 #if defined(CONFIG_AT91_USART0_UART_DSR)
823 at91_set_A_periph(AT91_PIN_PB22
, 0); /* DSR0 */
825 #if defined(CONFIG_AT91_USART0_UART_DCD)
826 at91_set_A_periph(AT91_PIN_PB23
, 0); /* DCD0 */
828 #if defined(CONFIG_AT91_USART0_UART_RI)
829 at91_set_A_periph(AT91_PIN_PB25
, 0); /* RI0 */
833 void __init
configure_usart1_pins(void)
835 at91_set_A_periph(AT91_PIN_PB6
, 1); /* TXD1 */
836 at91_set_A_periph(AT91_PIN_PB7
, 0); /* RXD1 */
838 #if defined(CONFIG_AT91_USART1_UART_RTS)
839 at91_set_A_periph(AT91_PIN_PB28
, 0); /* RTS1 */
841 #if defined(CONFIG_AT91_USART1_UART_CTS)
842 at91_set_A_periph(AT91_PIN_PB29
, 0); /* CTS1 */
846 void __init
configure_usart2_pins(void)
848 at91_set_A_periph(AT91_PIN_PB8
, 1); /* TXD2 */
849 at91_set_A_periph(AT91_PIN_PB9
, 0); /* RXD2 */
851 #if defined(CONFIG_AT91_USART2_UART_RTS)
852 at91_set_A_periph(AT91_PIN_PA4
, 0); /* RTS2 */
854 #if defined(CONFIG_AT91_USART2_UART_CTS)
855 at91_set_A_periph(AT91_PIN_PA5
, 0); /* CTS2 */
859 void __init
configure_usart3_pins(void)
861 at91_set_A_periph(AT91_PIN_PB10
, 1); /* TXD3 */
862 at91_set_A_periph(AT91_PIN_PB11
, 0); /* RXD3 */
864 #if defined(CONFIG_AT91_USART3_UART_RTS)
865 at91_set_B_periph(AT91_PIN_PC8
, 0); /* RTS3 */
867 #if defined(CONFIG_AT91_USART3_UART_CTS)
868 at91_set_B_periph(AT91_PIN_PC10
, 0); /* CTS3 */
872 void __init
configure_usart4_pins(void)
874 at91_set_B_periph(AT91_PIN_PA31
, 1); /* TXD4 */
875 at91_set_B_periph(AT91_PIN_PA30
, 0); /* RXD4 */
878 void __init
configure_usart5_pins(void)
880 at91_set_A_periph(AT91_PIN_PB12
, 1); /* TXD5 */
881 at91_set_A_periph(AT91_PIN_PB13
, 0); /* RXD5 */
886 /* -------------------------------------------------------------------- */
888 * These devices are always present and don't need any board-specific
891 static int __init
at91_add_standard_devices(void)
893 at91_add_device_rtt();
894 at91_add_device_watchdog();
895 at91_add_device_tc();
899 arch_initcall(at91_add_standard_devices
);