Skip to contentSkip to conversation

mtd: nand: zynq: Add a config option to use 1st stage bootloader timing

PATCH New Wilson Lee 2 participants 2 messages Nov 6, 2017

Subsystems (3)
lore
Share & tools
lore

Wilson Lee

author
#0 lore raw

PATCH v2 1/1 mtd: nand: zynq: Add a config option to use 1st stage bootloader timing

From: Jeff Westfahl <[email protected]>

In legacy method, 1st stage bootloader was used to configure the HW setting such as NAND timing. Hence, adding a config option in Zynq NAND driver for the compatibility of device that using 1st stage bootloder instead of U-boot SPL.

This commit is to add config option CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS that allow NAND driver use timing values set by the 1st stage bootloader, instead of the hard-coded values in the Zynq NAND driver.

Cc Joe Hershberger <[email protected]>
Cc Keng Soon Cheah <[email protected]>
Cc Chen Yee Chew <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
Cc Michal Simek <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/Kconfig     | 7 +++++++
 drivers/mtd/nand/zynq_nand.c | 5 +++++
 2 files changed, 12 insertions(+)
drivers/mtd/nand/Kconfig +7 -0
index 794410a..3f7edbb 100644
@@ -164,6 +164,13 @@ config NAND_ZYNQ
 	  This enables Nand driver support for Nand flash controller
 	  found on Zynq SoC.
 
+config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
+	bool "Enable use of 1st stage bootloader timing for NAND"
+	depends on NAND_ZYNQ
+	help
+	  This flag prevent U-boot reconfigure NAND flash controller and reuse
+	  the NAND timing from 1st stage bootloader.
+
 comment "Generic NAND options"
 
 # Enhance depends when converting drivers to Kconfig which use this config
drivers/mtd/nand/zynq_nand.c +5 -0
index 484f1bb..dec2c41 100644
@@ -35,6 +35,8 @@
 				(0x1 << 4)   |	/* Clear interrupt */ \
 				(0x1 << 6))	/* Disable ECC interrupt */
 
+#ifndef CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
+
 /* Assuming 50MHz clock (20ns cycle time) and 3V operation */
 #define ZYNQ_NAND_SET_CYCLES	((0x2 << 20) |	/* t_rr from nand_cycles */ \
 				(0x2 << 17)  |	/* t_ar from nand_cycles */ \
@@ -43,6 +45,7 @@
 				(0x2 << 8)   |	/* t_rea from nand_cycles */ \
 				(0x5 << 4)   |	/* t_wc from nand_cycles */ \
 				(0x5 << 0))	/* t_rc from nand_cycles */
+#endif
 
 
 #define ZYNQ_NAND_DIRECT_CMD	((0x4 << 23) |	/* Chip 0 from interface 1 */ \
@@ -257,8 +260,10 @@ static int zynq_nand_init_nand_flash(int option)
 
 	/* disable interrupts */
 	writel(ZYNQ_NAND_CLR_CONFIG, &zynq_nand_smc_base->cfr);
+#ifndef CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
 	/* Initialize the NAND interface by setting cycles and operation mode */
 	writel(ZYNQ_NAND_SET_CYCLES, &zynq_nand_smc_base->scr);
+#endif
 	if (option & NAND_BUSWIDTH_16)
 		writel(ZYNQ_NAND_SET_OPMODE_16BIT, &zynq_nand_smc_base->sor);
 	else
Signature · 1 line
2.7.4
Applied
#1 lore raw

PATCH v2 1/1 mtd: nand: zynq: Add a config option to use 1st stage bootloader timing

Quoted 66 lines · Wilson Lee

From: Jeff Westfahl <[email protected]>

In legacy method, 1st stage bootloader was used to configure the HW setting such as NAND timing. Hence, adding a config option in Zynq NAND driver for the compatibility of device that using 1st stage bootloder instead of U-boot SPL.

This commit is to add config option CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS that allow NAND driver use timing values set by the 1st stage bootloader, instead of the hard-coded values in the Zynq NAND driver.

Cc Joe Hershberger <[email protected]>
Cc Keng Soon Cheah <[email protected]>
Cc Chen Yee Chew <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
Cc Michal Simek <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/Kconfig     | 7 +++++++
 drivers/mtd/nand/zynq_nand.c | 5 +++++
 2 files changed, 12 insertions(+)
drivers/mtd/nand/Kconfig +7 -0
index 794410a..3f7edbb 100644
@@ -164,6 +164,13 @@ config NAND_ZYNQ
 	  This enables Nand driver support for Nand flash controller
 	  found on Zynq SoC.
 
+config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
+	bool "Enable use of 1st stage bootloader timing for NAND"
+	depends on NAND_ZYNQ
+	help
+	  This flag prevent U-boot reconfigure NAND flash controller and reuse
+	  the NAND timing from 1st stage bootloader.
+
 comment "Generic NAND options"
 
 # Enhance depends when converting drivers to Kconfig which use this config
drivers/mtd/nand/zynq_nand.c +3 -0
index 484f1bb..dec2c41 100644
@@ -35,6 +35,8 @@
 				(0x1 << 4)   |	/* Clear interrupt */ \
 				(0x1 << 6))	/* Disable ECC interrupt */
 
+#ifndef CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
+
 /* Assuming 50MHz clock (20ns cycle time) and 3V operation */
 #define ZYNQ_NAND_SET_CYCLES	((0x2 << 20) |	/* t_rr from nand_cycles */ \
 				(0x2 << 17)  |	/* t_ar from nand_cycles */ \
@@ -43,6 +45,7 @@
 				(0x2 << 8)   |	/* t_rea from nand_cycles */ \
 				(0x5 << 4)   |	/* t_wc from nand_cycles */ \
 				(0x5 << 0))	/* t_rc from nand_cycles */
+#endif
 
 
 #define ZYNQ_NAND_DIRECT_CMD	((0x4 << 23) |	/* Chip 0 from interface 1 */ \

drivers/mtd/nand/zynq_nand.c static int zynq_nand_init_nand_flash(int option) · line 269

Quoted 10 lines
drivers/mtd/nand/zynq_nand.c +2 -0
@@ -257,8 +260,10 @@ static int zynq_nand_init_nand_flash(int option)
 
 	/* disable interrupts */
 	writel(ZYNQ_NAND_CLR_CONFIG, &zynq_nand_smc_base->cfr);
+#ifndef CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
 	/* Initialize the NAND interface by setting cycles and operation mode */
 	writel(ZYNQ_NAND_SET_CYCLES, &zynq_nand_smc_base->scr);
+#endif
 	if (option & NAND_BUSWIDTH_16)
 		writel(ZYNQ_NAND_SET_OPMODE_16BIT, &zynq_nand_smc_base->sor);
 	else

Applied to my xilinx tree.

Thanks,
Michal