Skip to content
Snippets Groups Projects
  1. Jun 30, 2021
  2. Jun 29, 2021
  3. Jun 28, 2021
    • Tom Rini's avatar
      Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next · 8fba49bc
      Tom Rini authored
      - V3U Falcon board support
      8fba49bc
    • Tom Rini's avatar
      Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-spi into next · 296d5cff
      Tom Rini authored
      - xSPI Octal DTR support (Pratyush Yadav)
      - MXIC SPI driver (Zhengxun)
      296d5cff
    • Tom Rini's avatar
      Merge tag 'v2021.07-rc5' into next · 6d0453d8
      Tom Rini authored
      Prepare v2021.07-rc5
      
      # gpg: Signature made Mon 28 Jun 2021 03:39:36 PM EDT
      # gpg:                using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
      # gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]
      
      # Conflicts:
      #	configs/am64x_evm_r5_defconfig
      6d0453d8
    • Tom Rini's avatar
    • Kunihiko Hayashi's avatar
      arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y · 534f0fbd
      Kunihiko Hayashi authored and Tom Rini's avatar Tom Rini committed
      
      If both POSITION_INDEPENDENT and SYS_RELOC_GD_ENV_ADDR are enabled,
      wherever original env is placed anywhere, it should be relocated to
      the right address.
      
      Relocation offset gd->reloc_off is calculated with SYS_TEXT_BASE in
      setup_reloc() and env address gd->env_addr is relocated by the offset in
      initr_reloc_global_data().
      
      gd->env_addr
        = (orig env) + gd->reloc_off
        = (orig env) + (gd->relocaddr - SYS_TEXT_BASE)
      
      However, SYS_TEXT_BASE isn't always runtime base address when
      POSITION_INDEPENDENT is enabled. So the relocated env_addr might point to
      wrong address. For example, if SYS_TEXT_BASE is zero, gd->env_addr is
      out of memory location and memory exception will occur.
      
      There is a difference between linked address such as SYS_TEXT_BASE and
      runtime base address. In _main, the difference is calculated as
      "run-vs-link" offset. The env_addr should also be added to the offset
      to fix the address.
      
      gd->env_addr
        = (orig env) + ("run-vs-link" offset)   + gd->reloc_off
        = (orig env) + (SYS_TEXT_BASE - _start) + (gd->relocaddr - SYS_TEXT_BASE)
        = (orig env) + (gd->relocaddr - _start)
      
      Cc: Marek Vasut <marex@denx.de>
      Signed-off-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      534f0fbd
    • Tom Rini's avatar
      configs: Resync with savedefconfig · 2bba7807
      Tom Rini authored
      
      Rsync all defconfig files using moveconfig.py
      
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      2bba7807
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Allow using Micron mt35xu512aba in Octal DTR mode · f6adec1a
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Since this flash doesn't have a Profile 1.0 table, the Octal DTR
      capabilities are enabled in the post SFDP fixup, along with the 8D-8D-8D
      fast read settings.
      
      Enable Octal DTR mode with 20 dummy cycles to allow running at the
      maximum supported frequency of 200Mhz.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      f6adec1a
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Add support for Cypress Semper flash · ea9a22f7
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      The Cypress Semper flash is an xSPI compliant octal DTR flash. Add
      support for using it in octal DTR mode.
      
      The flash by default boots in a hybrid sector mode. Switch to uniform
      sector mode on boot. Use the default 20 dummy cycles for a read fast
      command.
      
      The SFDP programming on some older versions of the flash was incorrect.
      Fixes for that are included in the fixup hooks.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      ea9a22f7
    • Takahiro Kuwano's avatar
      mtd: spi-nor-core: Add non-uniform erase for Spansion/Cypress · ee52b0b7
      Takahiro Kuwano authored and Jagan Teki's avatar Jagan Teki committed
      
      Some of Spansion/Cypress chips have overlaid 4KB sectors at top and/or
      bottom, depending on the device configuration, while U-Boot supports
      uniform sector layout only.
      
      The spansion_erase_non_uniform()  erases overlaid 4KB sectors,
      non-overlaid portion of normal sector, and remaining normal sectors, by
      selecting correct erase command and size based on the address to erase
      and size of overlaid portion in parameters. Since different Spansion
      flashes can use different opcode for erasing the 4K sectors, the opcode
      must be passed in as a parameter based on the flash being used.
      
      Signed-off-by: default avatarTakahiro Kuwano <Takahiro.Kuwano@infineon.com>
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      [p.yadav@ti.com: Refactor the function to be compatible with nor->erase,
      make 4K opcode customizable, call spi_nor_setup_op() before executing
      the op.]
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      ee52b0b7
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: allow truncated erases · aba0bcd7
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      On devices with non-uniform sector sizes like Spansion S25 or S28 family
      of flashes the sector under erase does not necessarily have to be
      mtd->erasesize bytes long. For example, on S28 flashes the first 128 KiB
      region is composed of 32 4 KiB sectors, then a 128 KiB sector, and then
      256 KiB sectors till the end.
      
      Let the flash-specific erase functions erase less than the requested
      length in case of the 4 or 128 KiB sectors and report the number of
      bytes erased back to the calling function.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      aba0bcd7
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Perform a Soft Reset on boot · 0be8ab1f
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      When the flash is handed to us in a stateful mode like 8D-8D-8D, it is
      
      difficult to detect the mode the flash is in. One option is to read SFDP
      in all modes and see which one gives the correct "SFDP" signature, but
      not all flashes support SFDP in 8D-8D-8D mode.
      
      Further, even if you detect the mode of the flash via SFDP, you still
      have the problem of actually reading the ID. The Read ID command is not
      standardized across flash vendors. Flashes can have different dummy
      cycles needed for reading the ID. Some flashes even expect a 4-byte
      dummy address with the Read ID command. All this information cannot be
      obtained from the SFDP table.
      
      So, perform a Software Reset sequence before reading the ID and
      initializing the flash. A Soft Reset will bring back the flash in its
      default protocol mode assuming no non-volatile configuration was set.
      This will let us detect the flash even if ROM hands it to us in Octal
      DTR mode.
      
      To accommodate cases where there is more than one flash on a board, and
      only one of them needs a soft reset, failure to reset is not made fatal,
      and we still try to read ID if possible.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      0be8ab1f
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Perform a Soft Reset on shutdown · 575caf45
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      On probe, the SPI NOR core will put a flash in 8D-8D-8D mode if it
      supports it. But Linux as of now expects to get the flash in 1S-1S-1S
      mode. Handing the flash to Linux in Octal DTR mode means the kernel will
      fail to detect the flash.
      
      So, we need to reset to Power-on-Reset (POR) state before handing off
      the flash. A Software Reset command can be used to do this.
      
      One limitation of the soft reset is that it will restore state from
      non-volatile registers in some flashes. This means that if the flash was
      set to 8D mode in a non-volatile configuration, a soft reset won't help.
      This commit assumes that we don't set any non-volatile bits anywhere,
      and the flash doesn't have any non-volatile Octal DTR mode
      configuration.
      
      Since spi-nor-tiny doesn't (and likely shouldn't) have
      spi_nor_soft_reset(), add a dummy spi_nor_remove() for it that does
      nothing.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      575caf45
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Detect Soft Reset sequence support from BFPT · a1122a3d
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      A Soft Reset sequence will return the flash to Power-on-Reset (POR)
      state. It consists of two commands: Soft Reset Enable and Soft Reset.
      Find out if the sequence is supported from BFPT DWORD 16.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      a1122a3d
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Do not make invalid quad enable fatal · b058f108
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      The Micron MT35XU512ABA flash does not support the quad enable bit. But
      instead of programming the Quad Enable Require field to 000b ("Device
      does not have a QE bit"), it is programmed to 111b ("Reserved").
      
      While this is technically incorrect, it is not reason enough to abort
      BFPT parsing. Instead, continue BFPT parsing assuming there is no quad
      enable bit present.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      b058f108
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Enable octal DTR mode when possible · 6b808e08
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Allow flashes to specify a hook to enable octal DTR mode. Use this hook
      whenever possible to get optimal transfer speeds.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      6b808e08
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Prepare Read SR and FSR for Octal DTR mode · b862765c
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      The xSPI Profile 1.0 table specifies how many dummy cycles and address
      bytes are needed for the Read Status Register command in Octal DTR mode.
      Use that information to send the correct Read SR command.
      
      Some controllers might have trouble reading just 1 byte in DTR mode. So,
      when we are in DTR mode read 2 bytes and discard the second. This shows
      no side effects with the two flashes I tested: Micron mt35xu512aba and
      Cypress s28hs512t.
      
      Update Read FSR to mimic Read SR because they share the same
      characteristics.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      b862765c
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Parse xSPI Profile 1.0 table · 4d40e826
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      This table is indication that the flash is xSPI compliant and hence
      supports octal DTR mode. Extract information like the fast read opcode,
      the number of dummy cycles needed for a Read Status Register command,
      and the number of address bytes needed for a Read Status Register
      command.
      
      The default dummy cycles for a fast octal DTR read are set to 20. Since
      there is no simple way of determining the dummy cycles needed for the
      fast read command, flashes that use a different value should update it
      in their flash-specific hooks.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      4d40e826
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Get command opcode extension type from BFPT · 9ec5ea01
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Some devices in DTR mode expect an extra command byte called the
      extension. The extension can either be same as the opcode, bitwise
      inverse of the opcode, or another additional byte forming a 16-byte
      opcode. Get the extension type from the BFPT. For now, only flashes with
      "repeat" and "inverse" extensions are supported.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      9ec5ea01
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: prepare BFPT parsing for JESD216 rev D · 22ae535b
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      JESD216 rev D makes BFPT 20 DWORDs. Update the BFPT size define to
      reflect that.
      
      The check for rev A or later compared the BFPT header length with the
      maximum BFPT length, BFPT_DWORD_MAX. Since BFPT_DWORD_MAX was 16, and so
      was the BFPT length for both rev A and B, this check worked fine. But
      now, since BFPT_DWORD_MAX is 20, it means this check will also stop BFPT
      parsing for rev A or B, since their length is 16.
      
      So, instead check for BFPT_DWORD_MAX_JESD216 to stop BFPT parsing for
      the first JESD216 version, and check for BFPT_DWORD_MAX_JESD216B for the
      next two versions.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      22ae535b
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Add support for DTR protocol · 95954f55
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Double Transfer Rate (DTR) is SPI protocol in which data is transferred
      on each clock edge as opposed to on each clock cycle. Make
      framework-level changes to allow supporting flashes in DTR mode.
      
      Right now, mixed DTR modes are not supported. So, for example a mode
      like 4S-4D-4D will not work. All phases need to be either DTR or STR.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      95954f55
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Do not set data direction when there is no data · 6182d15b
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Even when spi_nor_write_reg() has no data to write, like when executing
      a write enable operation, it sets the data direction to
      SPI_MEM_DATA_OUT. This trips up spi_mem_check_buswidth() because it
      expects a data phase when there is none. Make sure the data direction is
      set to SPI_MEM_NO_DATA when there is no data to write.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      6182d15b
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Rework hwcaps selection · 71025f01
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      The spi-mem layer provides a spi_mem_supports_op() function to check
      whether a specific operation is supported by the controller or not.
      This is much more accurate than the hwcaps selection logic based on
      SPI_{RX,TX}_ flags.
      
      Rework the hwcaps selection logic to use spi_mem_supports_op().
      
      To make sure the build doesn't break for boards not using CONFIG_DM_SPI,
      add a simple SPI_{RX,TX}_ based hwcaps selection logic in spi-mem-nodm
      similar to spi_mem_default_supports_op(). This change is only
      compile-tested.
      
      To avoid SPL size problems on the x530 board, the old hwcaps selection
      is still kept around. Leaving the code in-place was getting difficult to
      read and understand, so the code is restructured to have it all in one
      isolated function. As a result of this, the parameter hwcaps to
      spi_nor_setup() is no longer needed. Remove it.
      
      Based on the Linux commit c76f5089796a (mtd: spi-nor: Rework hwcaps
      selection for the spi-mem case, 2019-08-06)
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      71025f01
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Introduce flash-specific fixup hooks · 8702188c
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Sometimes the information in a flash's SFDP tables is wrong. Sometimes
      some information just can't be expressed in the SFDP table. So,
      introduce the fixup hooks to allow tailoring settings for a specific
      flash.
      
      Three hooks are added: default_init, post_sfdp, and post_bfpt. These
      allow tweaking the flash settings at different point in the probe
      sequence. Since the hooks reside in nor->info, set that value just
      before the call to spi_nor_init_params().
      
      The hooks and at what points they are executed mimics Linux's spi-nor
      framework. One major difference is that Linux puts the struct
      spi_nor_fixups in nor->info. This is not possible in U-Boot because the
      spi-nor-ids list is shared between spi-nor-core.c and spi-nor-tiny.c.
      Since spi-nor-tiny shouldn't have those fixup hooks populated, add a
      separate function that lets flashes populate their fixup hooks.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      8702188c
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Move SFDP related declarations to top · e2e31fa6
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      These structures will be used in a later commit inside another structure
      definition. Also take the declarations out of the ifdef since they won't
      affect the final binary anyway and will be used in a later commit.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      e2e31fa6
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Add a ->setup() hook · 18b0de0f
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      nor->setup() can be used by flashes to configure settings in case they
      have any peculiarities that can't be easily expressed by the generic
      spi-nor framework. This includes things like different opcodes, dummy
      cycles, page size, uniform/non-uniform sector sizes, etc.
      
      Move related declarations to avoid forward declarations.
      
      Inspired by the Linux kernel's setup() hook.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      18b0de0f
    • Pratyush Yadav's avatar
      mtd: spi-nor-core: Fix address width on flash chips > 16MB · 1af0334a
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      If a flash chip has more than 16MB capacity but its BFPT reports
      BFPT_DWORD1_ADDRESS_BYTES_3_OR_4, the spi-nor framework defaults to 3.
      
      The check in spi_nor_scan() doesn't catch it because addr_width did get
      set. This fixes that check.
      
      Ported from Kernel commit 324f78dfb442b82365548b657ec4e6974c677502.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      1af0334a
    • Pratyush Yadav's avatar
      spi: cadence-qspi: Add support for octal DTR flashes · 38b0852b
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Set up opcode extension and enable/disable DTR mode based on whether the
      command is DTR or not.
      
      xSPI flashes can have a 4-byte dummy address associated with some
      commands like the Read Status Register command in octal DTR mode. Since
      the flash does not support sending the dummy address, we can not use
      automatic write completion polling in DTR mode. Further, no write
      completion polling makes it impossible to use DAC mode for DTR writes.
      In that mode, the controller does not know beforehand how long a write
      will be and so it can de-assert Chip Select (CS#) at any time. Once CS#
      is de-assert, the flash will go into burning phase. But since the
      controller does not do write completion polling, it does not know when
      the flash is busy and might send in writes while the flash is not ready.
      
      So, disable write completion polling and make writes go through indirect
      mode for DTR writes and let spi-mem take care of polling the SR.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      38b0852b
    • Pratyush Yadav's avatar
      spi: cadence-qspi: Add a small delay before indirect writes · a6903aa7
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      Once the start bit is toggled it takes a small amount of time before it
      is internally synchronized. This means we can't start writing during
      that part. So add a small delay to allow the bit to be synchronized.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      a6903aa7
    • Pratyush Yadav's avatar
      spi: cadence-qspi: Do not calibrate when device tree sets read delay · bd8c8dcd
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      If the device tree provides a read delay value, use that directly and do
      not perform the calibration procedure.
      
      This allows the device tree to over-ride the read delay value in cases
      where the read delay value obtained via calibration is incorrect. One
      such example is the Cypress Semper flash. It needs a read delay of 4 in
      octal DTR mode. But since the calibration procedure is run before the
      flash is switched in octal DTR mode, it yields a read delay of 2. A
      value of 4 works for both octal DTR and legacy modes.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      bd8c8dcd
    • Pratyush Yadav's avatar
      spi: spi-mem: add spi_mem_dtr_supports_op() · 5752d6ae
      Pratyush Yadav authored and Jagan Teki's avatar Jagan Teki committed
      
      spi_mem_default_supports_op() rejects DTR ops by default to ensure that
      the controller drivers that haven't been updated with DTR support
      continue to reject them. It also makes sure that controllers that don't
      support DTR mode at all (which is most of them at the moment) also
      reject them.
      
      This means that controller drivers that want to support DTR mode can't
      use spi_mem_default_supports_op(). Driver authors have to roll their own
      supports_op() function and mimic the buswidth checks. Or even worse,
      driver authors might skip it completely or get it wrong.
      
      Add spi_mem_dtr_supports_op(). It provides a basic sanity check for DTR
      ops and performs the buswidth requirement check. Move the logic for
      checking buswidth in spi_mem_default_supports_op() to a separate
      function so the logic is not repeated twice.
      
      Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
      Acked-by: default avatarJagan Teki <jagan@amarulasolutions.com>
      5752d6ae
Loading