|
@@ -389,3 +389,100 @@ static struct resource spi1_resources[] = {
|
|
|
.start = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1,
|
|
|
.end = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1,
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9261_spi1_device = {
|
|
|
+ .name = "atmel_spi",
|
|
|
+ .id = 1,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &spi_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ },
|
|
|
+ .resource = spi1_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(spi1_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB28, AT91_PIN_PA24, AT91_PIN_PA25, AT91_PIN_PA26 };
|
|
|
+
|
|
|
+void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+ unsigned long cs_pin;
|
|
|
+ short enable_spi0 = 0;
|
|
|
+ short enable_spi1 = 0;
|
|
|
+
|
|
|
+ /* Choose SPI chip-selects */
|
|
|
+ for (i = 0; i < nr_devices; i++) {
|
|
|
+ if (devices[i].controller_data)
|
|
|
+ cs_pin = (unsigned long) devices[i].controller_data;
|
|
|
+ else if (devices[i].bus_num == 0)
|
|
|
+ cs_pin = spi0_standard_cs[devices[i].chip_select];
|
|
|
+ else
|
|
|
+ cs_pin = spi1_standard_cs[devices[i].chip_select];
|
|
|
+
|
|
|
+ if (!gpio_is_valid(cs_pin))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (devices[i].bus_num == 0)
|
|
|
+ enable_spi0 = 1;
|
|
|
+ else
|
|
|
+ enable_spi1 = 1;
|
|
|
+
|
|
|
+ /* enable chip-select pin */
|
|
|
+ at91_set_gpio_output(cs_pin, 1);
|
|
|
+
|
|
|
+ /* pass chip-select pin to driver */
|
|
|
+ devices[i].controller_data = (void *) cs_pin;
|
|
|
+ }
|
|
|
+
|
|
|
+ spi_register_board_info(devices, nr_devices);
|
|
|
+
|
|
|
+ /* Configure SPI bus(es) */
|
|
|
+ if (enable_spi0) {
|
|
|
+ at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
|
|
|
+ at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
|
|
|
+ at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9261_spi0_device);
|
|
|
+ }
|
|
|
+ if (enable_spi1) {
|
|
|
+ at91_set_A_periph(AT91_PIN_PB30, 0); /* SPI1_MISO */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB31, 0); /* SPI1_MOSI */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB29, 0); /* SPI1_SPCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9261_spi1_device);
|
|
|
+ }
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * LCD Controller
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
|
|
|
+static u64 lcdc_dmamask = DMA_BIT_MASK(32);
|
|
|
+static struct atmel_lcdfb_info lcdc_data;
|
|
|
+
|
|
|
+static struct resource lcdc_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9261_LCDC_BASE,
|
|
|
+ .end = AT91SAM9261_LCDC_BASE + SZ_4K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+#if defined(CONFIG_FB_INTSRAM)
|
|
|
+ [2] = {
|
|
|
+ .start = AT91SAM9261_SRAM_BASE,
|
|
|
+ .end = AT91SAM9261_SRAM_BASE + AT91SAM9261_SRAM_SIZE - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+#endif
|
|
|
+};
|