[PATCH 1/1] pm9263: add nand support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Fri Oct 30 17:38:26 EDT 2009
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
Cc: Ilko Iliev <iliev at ronetix.at>
---
arch/arm/configs/pm9263_defconfig | 6 +++-
board/pm9263/init.c | 50 +++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletions(-)
diff --git a/arch/arm/configs/pm9263_defconfig b/arch/arm/configs/pm9263_defconfig
index eda317d..c1e5954 100644
--- a/arch/arm/configs/pm9263_defconfig
+++ b/arch/arm/configs/pm9263_defconfig
@@ -191,7 +191,11 @@ CONFIG_DRIVER_CFI_BANK_WIDTH_2=y
CONFIG_DRIVER_CFI_BANK_WIDTH_4=y
# CONFIG_DRIVER_CFI_BANK_WIDTH_8 is not set
CONFIG_CFI_BUFFER_WRITE=y
-# CONFIG_NAND is not set
+CONFIG_NAND=y
+CONFIG_NAND_ATMEL=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+CONFIG_MTD_NAND_IDS=y
#
# Filesystem support
diff --git a/board/pm9263/init.c b/board/pm9263/init.c
index 1060fe2..c6b4421 100644
--- a/board/pm9263/init.c
+++ b/board/pm9263/init.c
@@ -37,6 +37,55 @@
#include <mach/board.h>
#include <mach/gpio.h>
#include <mach/io.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/sam9_smc.h>
+
+static struct atmel_nand_data nand_pdata = {
+ .ale = 21,
+ .cle = 22,
+/* .det_pin = ... not connected */
+ .ecc_base = (void __iomem *)(AT91_BASE_SYS + AT91_ECC0),
+ .ecc_mode = NAND_ECC_HW,
+ .rdy_pin = AT91_PIN_PB30,
+ .enable_pin = AT91_PIN_PD15,
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
+ .bus_width_16 = 1,
+#else
+ .bus_width_16 = 0,
+#endif
+};
+
+static struct sam9_smc_config pm_nand_smc_config = {
+ .ncs_read_setup = 1,
+ .nrd_setup = 1,
+ .ncs_write_setup = 1,
+ .nwe_setup = 1,
+
+ .ncs_read_pulse = 3,
+ .nrd_pulse = 3,
+ .ncs_write_pulse = 3,
+ .nwe_pulse = 3,
+
+ .read_cycle = 5,
+ .write_cycle = 5,
+
+ .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
+ .tdf_cycles = 2,
+};
+
+static void pm_add_device_nand(void)
+{
+ /* setup bus-width (8 or 16) */
+ if (nand_pdata.bus_width_16)
+ pm_nand_smc_config.mode |= AT91_SMC_DBW_16;
+ else
+ pm_nand_smc_config.mode |= AT91_SMC_DBW_8;
+
+ /* configure chip-select 3 (NAND) */
+ sam9_smc_configure(3, &pm_nand_smc_config);
+
+ at91_add_device_nand(&nand_pdata);
+}
static struct device_d cfi_dev = {
.name = "cfi_flash",
@@ -63,6 +112,7 @@ static int pm9263_devices_init(void)
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
at91_add_device_sdram(64 * 1024 * 1024);
+ pm_add_device_nand();
at91_add_device_eth(&macb_pdata);
register_device(&cfi_dev);
--
1.6.5
More information about the u-boot-v2
mailing list