|
@@ -708,3 +708,174 @@ void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, in
|
|
|
#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
|
|
|
static u64 spi_dmamask = DMA_BIT_MASK(32);
|
|
|
|
|
|
+static struct resource spi0_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_SPI0,
|
|
|
+ .end = AT91SAM9G45_BASE_SPI0 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI0,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI0,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9g45_spi0_device = {
|
|
|
+ .name = "atmel_spi",
|
|
|
+ .id = 0,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &spi_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ },
|
|
|
+ .resource = spi0_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(spi0_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static const unsigned spi0_standard_cs[4] = { AT91_PIN_PB3, AT91_PIN_PB18, AT91_PIN_PB19, AT91_PIN_PD27 };
|
|
|
+
|
|
|
+static struct resource spi1_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_SPI1,
|
|
|
+ .end = AT91SAM9G45_BASE_SPI1 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI1,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI1,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9g45_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_PB17, AT91_PIN_PD28, AT91_PIN_PD18, AT91_PIN_PD19 };
|
|
|
+
|
|
|
+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_PB0, 0); /* SPI0_MISO */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI0_MOSI */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI0_SPCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9g45_spi0_device);
|
|
|
+ }
|
|
|
+ if (enable_spi1) {
|
|
|
+ at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_MISO */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB15, 0); /* SPI1_MOSI */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB16, 0); /* SPI1_SPCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9g45_spi1_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 = AT91SAM9G45_BASE_AC97C,
|
|
|
+ .end = AT91SAM9G45_BASE_AC97C + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AC97C,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AC97C,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9g45_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_PD8, 0); /* AC97FS */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD9, 0); /* AC97CK */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD7, 0); /* AC97TX */
|
|
|
+ at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */
|
|
|
+
|
|
|
+ /* reset */
|
|
|
+ if (gpio_is_valid(data->reset_pin))
|
|
|
+ at91_set_gpio_output(data->reset_pin, 0);
|
|
|
+
|
|
|
+ ac97_data = *data;
|
|
|
+ platform_device_register(&at91sam9g45_ac97_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * Image Sensor Interface
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+#if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
|
|
|
+static u64 isi_dmamask = DMA_BIT_MASK(32);
|
|
|
+static struct isi_platform_data isi_data;
|
|
|
+
|
|
|
+struct resource isi_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_ISI,
|
|
|
+ .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1,
|