|
@@ -388,3 +388,124 @@ static struct resource spi_resources[] = {
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
|
+
|
|
|
+static struct platform_device at91sam9rl_spi_device = {
|
|
|
+ .name = "atmel_spi",
|
|
|
+ .id = 0,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &spi_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ },
|
|
|
+ .resource = spi_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(spi_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static const unsigned spi_standard_cs[4] = { AT91_PIN_PA28, AT91_PIN_PB7, AT91_PIN_PD8, AT91_PIN_PD9 };
|
|
|
+
|
|
|
+
|
|
|
+void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+ unsigned long cs_pin;
|
|
|
+
|
|
|
+ at91_set_A_periph(AT91_PIN_PA25, 0); /* MISO */
|
|
|
+ at91_set_A_periph(AT91_PIN_PA26, 0); /* MOSI */
|
|
|
+ at91_set_A_periph(AT91_PIN_PA27, 0); /* SPCK */
|
|
|
+
|
|
|
+ /* Enable SPI chip-selects */
|
|
|
+ for (i = 0; i < nr_devices; i++) {
|
|
|
+ if (devices[i].controller_data)
|
|
|
+ cs_pin = (unsigned long) devices[i].controller_data;
|
|
|
+ else
|
|
|
+ cs_pin = spi_standard_cs[devices[i].chip_select];
|
|
|
+
|
|
|
+ if (!gpio_is_valid(cs_pin))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ /* 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);
|
|
|
+ platform_device_register(&at91sam9rl_spi_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * AC97
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
|
|
|
+static u64 ac97_dmamask = DMA_BIT_MASK(32);
|
|
|
+static struct ac97c_platform_data ac97_data;
|
|
|
+
|
|
|
+static struct resource ac97_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9RL_BASE_AC97C,
|
|
|
+ .end = AT91SAM9RL_BASE_AC97C + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9rl_ac97_device = {
|
|
|
+ .name = "atmel_ac97c",
|
|
|
+ .id = 0,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &ac97_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &ac97_data,
|
|
|
+ },
|
|
|
+ .resource = ac97_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(ac97_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_ac97(struct ac97c_platform_data *data)
|
|
|
+{
|
|
|
+ if (!data)
|
|
|
+ return;
|
|
|
+
|
|
|
+ at91_set_A_periph(AT91_PIN_PD1, 0); /* AC97FS */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD2, 0); /* AC97CK */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD3, 0); /* AC97TX */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */
|
|
|
+
|
|
|
+ /* reset */
|
|
|
+ if (gpio_is_valid(data->reset_pin))
|
|
|
+ at91_set_gpio_output(data->reset_pin, 0);
|
|
|
+
|
|
|
+ ac97_data = *data;
|
|
|
+ platform_device_register(&at91sam9rl_ac97_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
|
|
|
+#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 = AT91SAM9RL_LCDC_BASE,
|
|
|
+ .end = AT91SAM9RL_LCDC_BASE + SZ_4K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC,
|