|
@@ -638,3 +638,73 @@ void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, in
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
|
|
|
+static struct resource twi0_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_TWI0,
|
|
|
+ .end = AT91SAM9G45_BASE_TWI0 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI0,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI0,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9g45_twi0_device = {
|
|
|
+ .name = "i2c-at91sam9g10",
|
|
|
+ .id = 0,
|
|
|
+ .resource = twi0_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(twi0_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static struct resource twi1_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_TWI1,
|
|
|
+ .end = AT91SAM9G45_BASE_TWI1 + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI1,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI1,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91sam9g45_twi1_device = {
|
|
|
+ .name = "i2c-at91sam9g10",
|
|
|
+ .id = 1,
|
|
|
+ .resource = twi1_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(twi1_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices)
|
|
|
+{
|
|
|
+ i2c_register_board_info(i2c_id, devices, nr_devices);
|
|
|
+
|
|
|
+ /* pins used for TWI interface */
|
|
|
+ if (i2c_id == 0) {
|
|
|
+ at91_set_A_periph(AT91_PIN_PA20, 0); /* TWD */
|
|
|
+ at91_set_A_periph(AT91_PIN_PA21, 0); /* TWCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9g45_twi0_device);
|
|
|
+ } else {
|
|
|
+ at91_set_A_periph(AT91_PIN_PB10, 0); /* TWD */
|
|
|
+ at91_set_A_periph(AT91_PIN_PB11, 0); /* TWCK */
|
|
|
+
|
|
|
+ platform_device_register(&at91sam9g45_twi1_device);
|
|
|
+ }
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * SPI
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
|
|
|
+static u64 spi_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|