[U-Boot] any remaining value to "board_flash_wp_on()" routine?

Robert P. J. Day rpjday at crashcourse.ca
Sat Dec 31 10:55:02 CET 2016


  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 <common.h>
  #include <asm/mmu.h>
  #ifdef CONFIG_PCA953X
  #include <pca953x.h>

  /*
   * 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
========================================================================



More information about the U-Boot mailing list