[PATCH 6/7] sama5d3xek: add NOR CFI support

Eric Bénard eric at eukrea.com
Sat Dec 7 04:36:59 EST 2013


log is now :
cfi_flash cfi_flash0: found cfi flash at 10000000, size 16777216

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/boards/sama5d3xek/init.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm/boards/sama5d3xek/init.c b/arch/arm/boards/sama5d3xek/init.c
index ff62550..f7dfea0 100644
--- a/arch/arm/boards/sama5d3xek/init.c
+++ b/arch/arm/boards/sama5d3xek/init.c
@@ -118,6 +118,40 @@ static void ek_add_device_nand(void)
 static void ek_add_device_nand(void) {}
 #endif
 
+#if defined(CONFIG_DRIVER_CFI)
+static struct sama5_smc_config __initdata cm_nor_smc_config = {
+	.ncs_read_setup		= 10,
+	.nrd_setup		= 10,
+	.ncs_write_setup	= 10,
+	.nwe_setup		= 10,
+
+	.ncs_read_pulse		= 11,
+	.nrd_pulse		= 11,
+	.ncs_write_pulse	= 11,
+	.nwe_pulse		= 11,
+
+	.read_cycle		= 22,
+	.write_cycle		= 22,
+
+	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_DBW_16,
+	.tdf_cycles		= 6,
+};
+
+static void ek_add_device_norcfi(void)
+{
+	struct clk *clk = clk_get(NULL, "smc_clk");
+
+	clk_enable(clk);
+
+	/* configure chip-select 0 (NOR) */
+	sama5_smc_configure(0, 0, &cm_nor_smc_config);
+
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 256 * 1024 * 1024, 0);
+}
+#else
+static void ek_add_device_norcfi(void) {}
+#endif
+
 #if defined(CONFIG_DRIVER_NET_MACB)
 static struct macb_platform_data gmac_pdata = {
 	.phy_interface = PHY_INTERFACE_MODE_RGMII,
@@ -413,6 +447,7 @@ static int at91sama5d3xek_devices_init(void)
 	ek_add_device_w1();
 	ek_add_device_hdmi();
 	ek_add_device_nand();
+	ek_add_device_norcfi();
 	ek_add_led();
 	ek_add_device_eth();
 	ek_add_device_spi();
-- 
1.8.3.1




More information about the barebox mailing list