Skip to content
Snippets Groups Projects
  1. Mar 10, 2022
    • André Przywara's avatar
      sunxi: boards: Enable SPI flash support in U-Boot proper · 280294c5
      André Przywara authored and Jagan Teki's avatar Jagan Teki committed
      
      Some sunxi boards ship with SPI flash, which allows booting through the
      BootROM. We cover this functionality by a separate SPL "mini" driver.
      Separately we have a proper DM_SPI driver for U-Boot proper, which
      provides access to the SPI flash through the "sf" command. That allows
      to update the firmware on the SPI flash, also to store the environment
      there.
      
      However only very few boards actually enable support for U-Boot proper,
      even though that would work and the SPL part is configured.
      
      Use the cleaned up configuration scheme to enable SPI flash on those
      boards which mention a SPI flash in their .dts, or which use the SPL SPI
      support.
      
      Out of the box this would enable storing the environment on the SPI
      flash, and allows people to read or write the flash from U-Boot, for
      instance to update the SPI flash when booted via an SD card.
      
      For this to actually work there must be a "spi0" alias in the DT, which
      most boards are missing. But this should be addressed separately.
      
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      280294c5
    • 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
      sunxi: use boot source for determining environment location · e42dad41
      André Przywara authored and Jagan Teki's avatar Jagan Teki committed
      
      Currently we only support to load the environment from raw MMC or FAT
      locations on Allwinner boards. With the advent of SPI flash we probably
      also want to support using the environment there, so we need to become
      a bit more flexible.
      
      Change the environment priority function to take the boot source into
      account. When booted from eMMC or SD card, we use FAT or MMC, if
      configured, as before.
      If we are booted from SPI flash, we try to use the environment from
      there, if possible. The same is true for NAND flash booting, although
      this is somewhat theoretical right now (as untested).
      
      This way we can use the same image for SD and SPI flash booting, which
      allows us to simply copy a booted image from SD card to the SPI flash,
      for instance.
      
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      e42dad41
    • 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
    • André Przywara's avatar
      sunxi: Kconfig: Fix up SPI configuration · 81a46c15
      André Przywara authored and Jagan Teki's avatar Jagan Teki committed
      
      Commit 7945caf2 ("arm: sunxi: Enable SPI/SPI-FLASH support for A64")
      selected CONFIG_SPI by default on all Allwinner A64 boards, even though
      only 4 out of the 14 A64 boards have a SPI flash chip. All other SoCs
      had to manually select DM_SPI and friends, even though they are a
      platform property (the sunxi SPI driver is DM_SPI only).
      
      Clean this up to allow easy selection of SPI flash support in U-Boot
      proper, by selecting DM_SPI and DM_SPI_FLASH *if* CONFIG_SPI is
      selected, for *all* Allwinner SoCs. This simplifies the defconfig for
      two Libretech boards already.
      
      Also remove the forced CONFIG_SPI from the A64 Kconfig, instead let the
      four boards which allow SPI booting select this explicitly.
      
      Any board wishing to support SPI flash in U-Boot proper now just defines
      CONFIG_SPI and CONFIG_SPI_FLASH_<vendor> in its defconfig, Kconfig takes
      care of the rest.
      
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      81a46c15
  2. Feb 24, 2022
  3. Feb 23, 2022
  4. Feb 22, 2022
Loading