Skip to content
Snippets Groups Projects
  1. Jul 08, 2022
  2. Jun 28, 2022
  3. Jun 15, 2022
    • Patrick Delaunay's avatar
      env: mmc : align erase address and size on erase_grp_size · d7226704
      Patrick Delaunay authored and Jaehoon Chung's avatar Jaehoon Chung committed
      
      On eMMC device, the erase_grp_size > 1 so the address and size for the
      erase block command in env/mmc.c can be unaligned on erase group size and
      some strange trace occurs and the result is not guarantee by MMC devices.
      
      The SD-Card behavior doesn't change as erase_grp_size = 1 for SD-Card.
      
      For example, on eMMC present on STM32MP15C-EV1 and before the patch:
      
        STM32MP> env erase
      
        Erasing Environment on MMC...
      
        Caution! Your devices Erase group is 0x400
        The erase range would be change to 0x2000~0x27ff
      
        16 blocks erased: OK
      
        Caution! Your devices Erase group is 0x400
        The erase range would be change to 0x2000~0x23ff
      
        16 blocks erased: OK
        OK
      
      After this patch:
        STM32MP> env erase
        Erasing Environment on MMC...
        1024 blocks erased at 0x2000: OK
        1024 blocks erased at 0x2000: OK
        OK
      
      Here the 2 copies of U-Boot environment are in the same devices Erase
      group: it is erased twice.
      
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
      Reviewed-by: Patrice Chotard's avatarPatrice Chotard <patrice.chotard@foss.st.com>
      d7226704
  4. May 23, 2022
    • Patrice Chotard's avatar
      spi: spi_flash_probe_bus_cs() rely on DT for spi speed and mode · 3feea0ba
      Patrice Chotard authored and Tom Rini's avatar Tom Rini committed
      
      Now, spi_flash_probe_bus_cs() relies on DT for spi speed and mode
      and logically calls spi_get_bus_and_cs(). In case spi mode and speed are
      not read from DT, make usage of spi_flash_probe() instead.
      
      To sum-up:
       - Previous call tree was:
          spi_flash_probe() -> spi_flash_probe_bus_cs() -> spi_get_bus_and_cs()
      
       - Current call tree is:
          spi_flash_probe() -> _spi_get_bus_and_cs()
          spi_flash_probe_bus_cs() -> spi_get_bus_and_cs()
      
      This patch impacts the following :
        - cmd/sf.c: if spi mode and/or speed is passed in argument of
          do_spi_flash_probe(), call spi_flash_probe() otherwise call
          spi_flash_probe_bus_cs().
      
        - drivers/net/fm/fm.c: as by default spi speed and mode was set to
          0 and a comment indicates that speed and mode are read from DT,
          use spi_flash_probe_bus_cs().
      
        - drivers/net/pfe_eth/pfe_firmware.c: spi speed and mode are not read
          from DT by all platforms using this driver, so keep legacy and replace
          spi_flash_probe_bus_cs() by spi_flash_probe();
      
        - drivers/net/sni_netsec.c : spi speed and mode are not read from DT,
          so replace spi_flash_probe_bus_cs() by spi_flash_probe().
      
        - drivers/usb/gadget/max3420_udc.c: Can't find any platform which make
          usage of this driver, nevertheless, keep legacy and replace
          spi_get_bus_and_cs() by _spi_get_bus_and_cs().
      
        - env/sf.c: a comment indicates that speed and mode are read
          from DT. So use spi_flash_probe_bus_cs().
      
      Signed-off-by: Patrice Chotard's avatarPatrice Chotard <patrice.chotard@foss.st.com>
      
      Cc: Marek Behun <marek.behun@nic.cz>
      Cc: Jagan Teki <jagan@amarulasolutions.com>
      Cc: Vignesh R <vigneshr@ti.com>
      Cc: Joe Hershberger <joe.hershberger@ni.com>
      Cc: Ramon Fried <rfried.dev@gmail.com>
      Cc: Lukasz Majewski <lukma@denx.de>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Wolfgang Denk <wd@denx.de>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Stefan Roese <sr@denx.de>
      Cc: "Pali Rohár" <pali@kernel.org>
      Cc: Konstantin Porotchkin <kostap@marvell.com>
      Cc: Igal Liberman <igall@marvell.com>
      Cc: Bin Meng <bmeng.cn@gmail.com>
      Cc: Pratyush Yadav <p.yadav@ti.com>
      Cc: Sean Anderson <seanga2@gmail.com>
      Cc: Anji J <anji.jagarlmudi@nxp.com>
      Cc: Biwen Li <biwen.li@nxp.com>
      Cc: Priyanka Jain <priyanka.jain@nxp.com>
      Cc: Chaitanya Sakinam <chaitanya.sakinam@nxp.com>
      3feea0ba
  5. May 02, 2022
  6. Apr 21, 2022
    • Marek Vasut's avatar
      env: Implement lower priority arch_env_get_location() · de70e887
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      Currently there is only one way to override desired environment location,
      by implementing env_get_location(). This is increasingly being conflated
      both on board level and architecture level, which leads to a problem on
      boards where this function is already implemented on architecture level,
      since those boards have no way to override this environment location on
      board level anymore.
      
      Implement arch_env_get_location() function which is architecture specific
      and should only ever be implemented in architecture code. This function
      has lower priority than env_get_location(), which should only ever be
      implemented in board code, and which overrides the arch_env_get_location()
      architecture environment selection.
      
      This way, architecture can define its default environment chooser, while
      board can now override it as needed at all times.
      
      There is no functional change, since env_get_location() simply returns
      arch_env_get_location(), and arch_env_get_location() implements the
      current env_get_location() default content.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Adam Ford <aford173@gmail.com>
      Cc: Fabio Estevam <festevam@denx.de>
      Cc: Marek Behún <marek.behun@nic.cz>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Stefano Babic <sbabic@denx.de>
      Cc: Tim Harvey <tharvey@gateworks.com>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Tommaso Merciai <tomm.merciai@gmail.com>
      Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
      de70e887
  7. Apr 10, 2022
    • Marek Vasut's avatar
      Revert "env: Load env when ENV_IS_NOWHERE is only location selected" · 5c7399ec
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      This reverts commit 8d61237e.
      
      This commit broke environment on literally every board I have access
      to, with this revert in place, environment works as it should again.
      The problem I observe with this patch is that saved environment in
      either SPI NOR or eMMC is never used, the system always falls back
      to default environment. The 'saveenv' command does succeed, but then
      after reset, the default env is again used.
      
      Furthermore, the commit introduced duplicate code in env_init(), this:
      "
      	if (!prio) {
      		gd->env_addr = (ulong)&default_environment[0];
      		gd->env_valid = ENV_INVALID;
      
      		return 0;
      	}
      
      	if (ret == -ENOENT) {
      		gd->env_addr = (ulong)&default_environment[0];
      		gd->env_valid = ENV_INVALID;
      
      		return 0;
      	}
      "
      
      Furthermore, the commit is missing DCO SoB line.
      
      Also note that upstream does not support UltraZed EG board, so
      this might have been a patch pulled from downstream which did
      depend on some other downstream behavior.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu>
      Cc: Tom Rini <trini@konsulko.com>
      5c7399ec
  8. Apr 07, 2022
  9. Mar 18, 2022
    • Tom Rini's avatar
      Convert CONFIG_ETHPRIME to Kconfig · 0e14cdfa
      Tom Rini authored
      
      This converts the following to Kconfig:
         CONFIG_ETHPRIME
      
      This is also done by adding a gating Kconfig option, CONFIG_USE_ETHPRIME
      similar to other options that are not always set and control environment
      variables.
      
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      0e14cdfa
  10. Mar 10, 2022
    • André Przywara's avatar
      env: sunxi: enable ENV_IS_IN_SPI_FLASH · 753a85fd
      André Przywara authored and Jagan Teki's avatar Jagan Teki committed
      
      Now that sunxi uses CONFIG_SPI more sanely, and can also now properly
      load the environment from SPI flash, let's enable the symbol that
      actually considers the SPI flash when accessing the environment.
      
      As this symbol depends on CONFIG_SPI, which we now only enable if the
      board has a SPI flash, we can make if "default y" for all Allwinner
      boards.
      
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      753a85fd
    • André Przywara's avatar
      env: sunxi: Define location in SPI flash · 2bdf213f
      André Przywara authored and Jagan Teki's avatar Jagan Teki committed
      
      To allow loading and storing the environment from SPI flash, adjust the
      raw offset variables for Allwinner boards to make sense there.
      
      U-Boot (including SPL and other blobs) is loaded from the beginning of
      SPI flash, so move the environment location as far back as possible, to
      not create unnecessary limits. As those offsets are shared with (now
      mostly unused) raw MMC environment, we should respect the common one
      megabyte limit, which also makes sense on SPI flash.
      
      So limit the environment for those raw locations to 64KB, and place it
      just below 1MB (@960KB).
      
      Those values are currently unused, unless someone forcibly enables the
      raw MMC environment. In this case it would break as of now, as the
      current offset of 544KB is far too low for the current (arm64) U-Boot
      proper.
      
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      2bdf213f
  11. Mar 03, 2022
  12. Jan 19, 2022
  13. Jan 14, 2022
  14. Dec 27, 2021
    • Tom Rini's avatar
      Convert CONFIG_ENV_SPI_BUS et al to Kconfig · 7e6a6fd8
      Tom Rini authored
      
      This converts the following to Kconfig:
         CONFIG_ENV_SPI_BUS
         CONFIG_ENV_SPI_CS
         CONFIG_ENV_SPI_MAX_HZ
         CONFIG_ENV_SPI_MODE
      
      As part of this, we use Kconfig to provide the defaults now that were
      done in include/spi_flash.h.  We also in some cases change from using
      CONFIG_ENV_SPI_FOO to CONFIG_SF_DEFAULT_FOO as those were the values in
      use anyhow as ENV was not enabled.
      
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      7e6a6fd8
  15. Nov 16, 2021
    • Simon Glass's avatar
      bootm: Tidy up use of autostart env var · 78398652
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This has different semantics in different places. Go with the bootm method
      and put it in a common function so that the behaviour is consistent in
      U-Boot. Update the docs.
      
      To be clear, this changes the way that 'bootelf' and standalone boot
      work. Before, if autostart was set to "fred" or "YES", for example, they
      would consider that a "yes". This may change behaviour for some boards,
      but the only in-tree boards which mention autostart use "no" to disable
      it, which will still work.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Suggested-by: default avatarWolfgang Denk <wd@denx.de>
      78398652
    • Simon Glass's avatar
      env: Allow U-Boot scripts to be placed in a .env file · 86b9c3e4
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present U-Boot environment variables, and thus scripts, are defined
      by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text
      to this file and dealing with quoting and newlines is harder than it
      should be. It would be better if we could just type the script into a
      text file and have it included by U-Boot.
      
      Add a feature that brings in a .env file associated with the board
      config, if present. To use it, create a file in a board/<vendor>
      directory, typically called <board>.env and controlled by the
      CONFIG_ENV_SOURCE_FILE option.
      
      The environment variables should be of the form "var=value". Values can
      extend to multiple lines. See the README under 'Environment Variables:'
      for more information and an example.
      
      In many cases environment variables need access to the U-Boot CONFIG
      variables to select different options. Enable this so that the environment
      scripts can be as useful as the ones currently in the board config files.
      This uses the C preprocessor, means that comments can be included in the
      environment using /* ... */
      
      Also support += to allow variables to be appended to. This is needed when
      using the preprocessor.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Behún <marek.behun@nic.cz>
      Tested-by: default avatarMarek Behún <marek.behun@nic.cz>
      86b9c3e4
  16. Nov 13, 2021
  17. Oct 31, 2021
  18. Oct 26, 2021
  19. Oct 25, 2021
    • Marek Vasut's avatar
      env: mmc: Add support for redundant env in both eMMC boot partitions · d11d1bec
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      Currently the MMC environment driver supports storing redundant environment
      only in one eMMC partition at different offsets. This is sub-optimal, since
      if this one boot partition is erased, both copies of environment are lost.
      Since the eMMC has two boot partitions, add support for storing one copy of
      environment in each of the two boot partitions.
      
      To enable this functionality, select CONFIG_SYS_REDUNDAND_ENVIRONMENT to
      indicate redundant environment should be used. Set CONFIG_SYS_MMC_ENV_PART
      to 1 to indicate environment should be stored in eMMC boot partition. Set
      CONFIG_ENV_OFFSET equal to CONFIG_ENV_OFFSET_REDUND, and both to the offset
      from start of eMMC boot partition where the environment should be located.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Stefano Babic <sbabic@denx.de>
      d11d1bec
    • Marek Vasut's avatar
      env: mmc: Add missing eMMC bootpart restoration to env erase · f47f87f2
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      If the environment is stored in eMMC hardware boot partition, the environment
      driver first stores the currently selected eMMC boot partition, then does the
      requested operation, and then restores the original boot partition settings.
      In case the environment operation fails, the boot partition settings are also
      restored.
      
      The 'env erase' implementation in the MMC environment driver lacks the path
      which restores the boot partition. This could lead to various failure modes,
      like the system boots the wrong copy of bootloader etc. Fix this by filling
      in the missing restoration path.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Stefano Babic <sbabic@denx.de>
      f47f87f2
  20. Oct 23, 2021
    • Marek Behún's avatar
      mtd: Remove mtd_erase_callback() entirely · 0d1ecc99
      Marek Behún authored and Jagan Teki's avatar Jagan Teki committed
      
      The original purpose of mtd_erase_callback() in Linux at the time it was
      imported to U-Boot, was to inform the caller that erasing is done (since
      it was an asynchronous operation).
      
      All supplied callback methods in U-Boot do nothing, but the
      mtd_erase_callback() function was (until previous patch) grossly abused
      in U-Boot's mtdpart implementation for completely different purpose.
      
      Since we got rid of the abusement, remove the mtd_erase_callback()
      function and the .callback member from struct erase_info entirely, in
      order to avoid such problems in the future.
      
      Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
      0d1ecc99
  21. Oct 21, 2021
    • Marek Behún's avatar
      env: Move non-cli env functions to env/common.c · f2315664
      Marek Behún authored and Simon Glass's avatar Simon Glass committed
      
      Move the following functions from cmd/nvedit.c to env/common.c:
        env_set_ulong()
        env_set_hex()
        env_get_hex()
        eth_env_get_enetaddr()
        eth_env_set_enetaddr()
        env_get()
        from_env()
        env_get_f()
        env_get_ulong()
      since these functions are not specific for U-Boot's CLI.
      
      We leave env_set() in cmd/nvedit.c, since it calls _do_env_set(), which
      is a static function in that file.
      
      Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      f2315664
    • Marek Behún's avatar
      env: Inline env_get_char() into its only user · 52f9ed34
      Marek Behún authored and Simon Glass's avatar Simon Glass committed
      
      This function is a relic from the past when environment was read from
      underlying device one character at a time.
      
      It is used only in the case when getting an environemnt variable prior
      relocation, and the function is simple enough to be inlined there.
      
      Since env_get_char() is being changed to simple access to an array, we
      can drop the failing cases and simplify the code (this could have been
      done before, since env_get_char() did not fail even before).
      
      Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      52f9ed34
Loading