1. 01 8月, 2018 1 次提交
    • B
      mtd: spi-nor: only apply reset hacks to broken hardware · bb276262
      Brian Norris 提交于
      Commit 59b356ff ("mtd: m25p80: restore the status of SPI flash when
      exiting") is the latest from a long history of attempts to add reboot
      handling to handle stateful addressing modes on SPI flash. Some prior
      mostly-related discussions:
      
      http://lists.infradead.org/pipermail/linux-mtd/2013-March/046343.html
      [PATCH 1/3] mtd: m25p80: utilize dedicated 4-byte addressing commands
      
      http://lists.infradead.org/pipermail/barebox/2014-September/020682.html
      [RFC] MTD m25p80 3-byte addressing and boot problem
      
      http://lists.infradead.org/pipermail/linux-mtd/2015-February/057683.html
      [PATCH 2/2] m25p80: if supported put chip to deep power down if not used
      
      Previously, attempts to add reboot-time software reset handling were
      rejected, but the latest attempt was not.
      
      Quick summary of the problem:
      Some systems (e.g., boot ROM or bootloader) assume that they can read
      initial boot code from their SPI flash using 3-byte addressing. If the
      flash is left in 4-byte mode after reset, these systems won't boot. The
      above patch provided a shutdown/remove hook to attempt to reset the
      addressing mode before we reboot. Notably, this patch misses out on
      huge classes of unexpected reboots (e.g., crashes, watchdog resets).
      
      Unfortunately, it is essentially impossible to solve this problem 100%:
      if your system doesn't know how to reset the SPI flash to power-on
      defaults at initialization time, no amount of software can really rescue
      you -- there will always be a chance of some unexpected reset that
      leaves your flash in an addressing mode that your boot sequence didn't
      expect.
      
      While it is not directly harmful to perform hacks like the
      aforementioned commit on all 4-byte addressing flash, a
      properly-designed system should not need the hack -- and in fact,
      providing this hack may mask the fact that a given system is indeed
      broken. So this patch attempts to apply this unsound hack more narrowly,
      providing a strong suggestion to developers and system designers that
      this is truly a hack. With luck, system designers can catch their errors
      early on in their development cycle, rather than applying this hack long
      term. But apparently enough systems are out in the wild that we still
      have to provide this hack.
      
      Document a new device tree property to denote systems that do not have a
      proper hardware (or software) reset mechanism, and apply the hack (with
      a loud warning) only in this case.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
      bb276262
  2. 18 5月, 2018 3 次提交
  3. 21 4月, 2018 4 次提交
  4. 21 3月, 2018 1 次提交
  5. 28 12月, 2017 2 次提交
  6. 20 12月, 2017 2 次提交
  7. 13 12月, 2017 4 次提交
  8. 30 10月, 2017 2 次提交
  9. 23 10月, 2017 1 次提交
  10. 11 10月, 2017 5 次提交
  11. 10 10月, 2017 1 次提交
  12. 18 9月, 2017 2 次提交
  13. 23 8月, 2017 1 次提交
  14. 02 8月, 2017 1 次提交
    • A
      mtd: spi-nor: Recover from Spansion/Cypress errors · c4b3eacc
      Alexander Sverdlin 提交于
      S25FL{128|256|512}S datasheets say:
      "When P_ERR or E_ERR bits are set to one, the WIP bit will remain set to
      one indicating the device remains busy and unable to receive new operation
      commands. A Clear Status Register (CLSR) command must be received to return
      the device to standby mode."
      
      Current spi-nor code works until first error occurs, but write/erase errors
      are not just rare hardware failures, they also occur if user tries to flash
      write-protected areas. After such attempt no SPI command can be executed
      any more and even read fails. This patch adds support for P_ERR and E_ERR
      bits in Status Register 1 (so that operation fails immediately and not
      after a long timeout) and proper recovery from the error condition.
      
      Tested on Spansion S25FS128S, which is supported by S25FL129P entry.
      Signed-off-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@wedev4u.fr>
      c4b3eacc
  15. 18 7月, 2017 1 次提交
  16. 27 6月, 2017 2 次提交
  17. 21 6月, 2017 3 次提交
  18. 16 5月, 2017 4 次提交
    • D
      mtd: spi-nor: Potential oops on error path in quad_enable() · 05d090f0
      Dan Carpenter 提交于
      Before commit cff959958832 ("mtd: spi-nor: introduce SPI 1-2-2 and SPI
      1-4-4 protocols") then we treated 1 as -EINVAL in the caller but after
      that commit we changed to propagate the return.  My static checker
      complains that it's eventually passed to an ERR_PTR() and later
      dereferenced, but I'm not totally certain if that's true.  Regardless,
      returning 1 is wrong.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@wedev4u.fr>
      05d090f0
    • C
      mtd: spi-nor: introduce Octo SPI protocols · fe488a5e
      Cyrille Pitchen 提交于
      This patch starts adding support to Octo SPI protocols (SPI x-y-8).
      
      Op codes for Fast Read and/or Page Program operations using Octo SPI
      protocols are not known yet (no JEDEC specification has defined them yet)
      but we'd rather introduce the Octo SPI protocols now so it's done as it
      should be.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      fe488a5e
    • C
      mtd: spi-nor: introduce Double Transfer Rate (DTR) SPI protocols · 15f55331
      Cyrille Pitchen 提交于
      This patch introduces support to Double Transfer Rate (DTR) SPI protocols.
      DTR is used only for Fast Read operations.
      
      According to manufacturer datasheets, whatever the number of I/O lines
      used during instruction (x) and address/mode/dummy (y) clock cycles, DTR
      is used only during data (z) clock cycles of SPI x-y-z protocols.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      15f55331
    • C
      mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols · cfc5604c
      Cyrille Pitchen 提交于
      This patch changes the prototype of spi_nor_scan(): its 3rd parameter
      is replaced by a 'struct spi_nor_hwcaps' pointer, which tells the spi-nor
      framework about the actual hardware capabilities supported by the SPI
      controller and its driver.
      
      Besides, this patch also introduces a new 'struct spi_nor_flash_parameter'
      telling the spi-nor framework about the hardware capabilities supported by
      the SPI flash memory and the associated settings required to use those
      hardware caps.
      
      Then, to improve the readability of spi_nor_scan(), the discovery of the
      memory settings and the memory initialization are now split into two
      dedicated functions.
      
      1 - spi_nor_init_params()
      
      The spi_nor_init_params() function is responsible for initializing the
      'struct spi_nor_flash_parameter'. Currently this structure is filled with
      legacy values but further patches will allow to override some parameter
      values dynamically, for instance by reading the JESD216 Serial Flash
      Discoverable Parameter (SFDP) tables from the SPI memory.
      The spi_nor_init_params() function only deals with the hardware
      capabilities of the SPI flash memory: especially it doesn't care about
      the hardware capabilities supported by the SPI controller.
      
      2 - spi_nor_setup()
      
      The second function is called once the 'struct spi_nor_flash_parameter'
      has been initialized by spi_nor_init_params().
      With both 'struct spi_nor_flash_parameter' and 'struct spi_nor_hwcaps',
      the new argument of spi_nor_scan(), spi_nor_setup() computes the best
      match between hardware caps supported by both the (Q)SPI memory and
      controller hence selecting the relevant settings for (Fast) Read and Page
      Program operations.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      cfc5604c