From 72fb68d53cfbe505319cbb4aa92a1fe7ecf3d4fb Mon Sep 17 00:00:00 2001 From: John Schmoller Date: Fri, 22 Oct 2010 00:20:25 -0500 Subject: xes: Add board_flash_wp_on() Add board_flash_wp_on() to check a pca9557 gpio pin to see if non-volatile memory write protection is enabled. Previously, write protected NOR flashes would fail initialization which resulted in a bootup error such as: ... DTT: 53 C local / 64 C remote (adt7461@4c) DTT: 54 C local (ds1621@48) FLASH: Executed from FLASH1 POST memory PASSED FLASH: ## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB ## Unknown FLASH on Bank 2 - Size = 0x00000000 = 0 MB *** failed *** ### ERROR ### Please RESET the board ### With this patch, NOR flash initialization is skipped: ... DTT: 53 C local / 64 C remote (adt7461@4c) DTT: 54 C local (ds1621@48) FLASH: Executed from FLASH1 POST memory PASSED FLASH: Uninitialized - Write Protect On L2: 1024 KB enabled NAND: 1024 MiB ... Note that flash related commands such as flinfo and saveenv will error out when flash write protection is enabled. Signed-off-by: John Schmoller Signed-off-by: Peter Tyser Signed-off-by: Kumar Gala --- board/xes/common/fsl_8xxx_misc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'board/xes') diff --git a/board/xes/common/fsl_8xxx_misc.c b/board/xes/common/fsl_8xxx_misc.c index e37a3c1123..b7fa6950b0 100644 --- a/board/xes/common/fsl_8xxx_misc.c +++ b/board/xes/common/fsl_8xxx_misc.c @@ -22,6 +22,21 @@ #include #include +#ifdef CONFIG_PCA953X +#include + +/* + * Determine if a board's flashes are write protected + */ +int board_flash_wp_on(void) +{ + if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) & + CONFIG_SYS_PCA953X_NVM_WP) + return 1; + + return 0; +} +#endif /* * Return a board's derivative model number. For example: -- cgit v1.2.1