1. 04 Nov, 2023 1 commit
    • Miquel Raynal's avatar
      Merge tag 'spi-nor/for-6.7' into mtd/next · 3a8ab4a1
      Miquel Raynal authored
      For SPI NOR we cleaned the flash info entries in order to have
      them slimmer and self explanatory. In order to make the entries
      as slim as possible, we introduced sane default values so that
      the actual flash entries don't need to specify them. We now use
      a flexible macro to specify the flash ID instead of the previous
      INFOx() macros that had hardcoded ID lengths.
      
      Instead of:
      -       { "w25q512nwm", INFO(0xef8020, 0, 64 * 1024, 0)
      -               OTP_INFO(256, 3, 0x1000, 0x1000) },
      
      We now use:
      +               .id = SNOR_ID(0xef, 0x80, 0x20),
      +               .name = "w25q512nwm",
      +               .otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
      
      We also removed some flash entries: the very old Catalyst
      SPI EEPROMs that were introduced once with the SPI-NOR subsystem,
      and a Fujitsu MRAM. Both should use the at25 EEPROM driver.
      The latter even has device tree bindings for the at25 driver.
      
      We made sure that the conversion didn't introduce any unwanted
      changes by comparing the .rodata segment before and after the
      conversion. The patches landed in linux-next immediately after
      v6.6-rc2, we haven't seen any regressions yet.
      
      Apart of the autumn cleaning we introduced a new flash entry,
      at25ff321a, and added block protection support for mt25qu512a.
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      3a8ab4a1
  2. 27 Oct, 2023 1 commit
    • Linus Walleij's avatar
      mtd: cfi_cmdset_0001: Byte swap OTP info · 565fe150
      Linus Walleij authored
      Currently the offset into the device when looking for OTP
      bits can go outside of the address of the MTD NOR devices,
      and if that memory isn't readable, bad things happen
      on the IXP4xx (added prints that illustrate the problem before
      the crash):
      
      cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x00000100
      ixp4xx_copy_from copy from 0x00000100 to 0xc880dd78
      cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x12000000
      ixp4xx_copy_from copy from 0x12000000 to 0xc880dd78
      8<--- cut here ---
      Unable to handle kernel paging request at virtual address db000000
      [db000000] *pgd=00000000
      (...)
      
      This happens in this case because the IXP4xx is big endian and
      the 32- and 16-bit fields in the struct cfi_intelext_otpinfo are not
      properly byteswapped. Compare to how the code in read_pri_intelext()
      byteswaps the fields in struct cfi_pri_intelext.
      
      Adding a small byte swapping loop for the OTP in read_pri_intelext()
      and the crash goes away.
      
      The problem went unnoticed for many years until I enabled
      CONFIG_MTD_OTP on the IXP4xx as well, triggering the bug.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarNicolas Pitre <nico@fluxnic.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20231020-mtd-otp-byteswap-v4-1-0d132c06aa9d@linaro.org
      565fe150
  3. 18 Oct, 2023 2 commits
  4. 16 Oct, 2023 21 commits
  5. 27 Sep, 2023 1 commit
  6. 22 Sep, 2023 10 commits
  7. 19 Sep, 2023 4 commits