|
@@ -399,3 +399,106 @@ static struct atmel_nand_data nand_data;
|
|
|
#define NAND_BASE AT91_CHIPSELECT_3
|
|
|
|
|
|
static struct resource nand_resources[] = {
|
|
|
+ {
|
|
|
+ .start = NAND_BASE,
|
|
|
+ .end = NAND_BASE + SZ_256M - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91rm9200_nand_device = {
|
|
|
+ .name = "atmel_nand",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &nand_data,
|
|
|
+ },
|
|
|
+ .resource = nand_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(nand_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_nand(struct atmel_nand_data *data)
|
|
|
+{
|
|
|
+ unsigned int csa;
|
|
|
+
|
|
|
+ if (!data)
|
|
|
+ return;
|
|
|
+
|
|
|
+ /* enable the address range of CS3 */
|
|
|
+ csa = at91_ramc_read(0, AT91_EBI_CSA);
|
|
|
+ at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA);
|
|
|
+
|
|
|
+ /* set the bus interface characteristics */
|
|
|
+ at91_ramc_write(0, AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN
|
|
|
+ | AT91_SMC_NWS_(5)
|
|
|
+ | AT91_SMC_TDF_(1)
|
|
|
+ | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */
|
|
|
+ | AT91_SMC_RWHOLD_(1) /* tDH Data Hold Time 20 - ns */
|
|
|
+ );
|
|
|
+
|
|
|
+ /* enable pin */
|
|
|
+ if (gpio_is_valid(data->enable_pin))
|
|
|
+ at91_set_gpio_output(data->enable_pin, 1);
|
|
|
+
|
|
|
+ /* ready/busy pin */
|
|
|
+ if (gpio_is_valid(data->rdy_pin))
|
|
|
+ at91_set_gpio_input(data->rdy_pin, 1);
|
|
|
+
|
|
|
+ /* card detect pin */
|
|
|
+ if (gpio_is_valid(data->det_pin))
|
|
|
+ at91_set_gpio_input(data->det_pin, 1);
|
|
|
+
|
|
|
+ at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
|
|
|
+ at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
|
|
|
+
|
|
|
+ nand_data = *data;
|
|
|
+ platform_device_register(&at91rm9200_nand_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_nand(struct atmel_nand_data *data) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * TWI (i2c)
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+/*
|
|
|
+ * Prefer the GPIO code since the TWI controller isn't robust
|
|
|
+ * (gets overruns and underruns under load) and can only issue
|
|
|
+ * repeated STARTs in one scenario (the driver doesn't yet handle them).
|
|
|
+ */
|
|
|
+#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
|
|
|
+
|
|
|
+static struct i2c_gpio_platform_data pdata = {
|
|
|
+ .sda_pin = AT91_PIN_PA25,
|
|
|
+ .sda_is_open_drain = 1,
|
|
|
+ .scl_pin = AT91_PIN_PA26,
|
|
|
+ .scl_is_open_drain = 1,
|
|
|
+ .udelay = 2, /* ~100 kHz */
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91rm9200_twi_device = {
|
|
|
+ .name = "i2c-gpio",
|
|
|
+ .id = 0,
|
|
|
+ .dev.platform_data = &pdata,
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
|
|
|
+{
|
|
|
+ at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
|
|
|
+ at91_set_multi_drive(AT91_PIN_PA25, 1);
|
|
|
+
|
|
|
+ at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
|
|
|
+ at91_set_multi_drive(AT91_PIN_PA26, 1);
|
|
|
+
|
|
|
+ i2c_register_board_info(0, devices, nr_devices);
|
|
|
+ platform_device_register(&at91rm9200_twi_device);
|
|
|
+}
|
|
|
+
|
|
|
+#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
|
|
|
+
|
|
|
+static struct resource twi_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91RM9200_BASE_TWI,
|
|
|
+ .end = AT91RM9200_BASE_TWI + SZ_16K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|