From: Robert P. J. Day Date: Sat, 31 Dec 2016 04:55:02 -0500 (EST) Subject: [U-Boot] any remaining value to "board_flash_wp_on()" routine? Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de the adventure digging through flash code continues ... i just ran across this: $ grep -rw board_flash_wp_on * board/xes/common/fsl_8xxx_misc.c:int board_flash_wp_on(void) common/board_r.c:__weak int board_flash_wp_on(void) common/board_r.c: if (board_flash_wp_on()) $ i can see the general value in a weak routine checking on flash protection: __weak int board_flash_wp_on(void) { /* * Most flashes can't be detected when write protection is enabled, * so provide a way to let U-Boot gracefully ignore write protected * devices. */ return 0; } ... static int initr_flash(void) { ulong flash_size = 0; bd_t *bd = gd->bd; puts("Flash: "); if (board_flash_wp_on()) printf("Uninitialized - Write Protect On\n"); else flash_size = flash_init(); but it does seem odd that, in the entire u-boot code base, only one board takes advantage of that, board/xes/common/fsl_8xxx_misc.c, and in what appears to be a very restricted way: #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 is there really a need for a feature for which only a single board overrides that routine? or is there something else here i'm overlooking? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================