<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/mtd, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Merge tag 'mtd/for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux</title>
<updated>2026-10-25T05:49:58+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-10-25T05:49:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=44388c8f3e22b578c9089df53301ef7e53e7fb01'/>
<id>44388c8f3e22b578c9089df53301ef7e53e7fb01</id>
<content type='text'>
Pull MTD updates from Miquel Raynal:
 "Core MTD:
   - Fixes to the virt-concat driver
   - Added INT0800 firmware-flash map driver
   - mtdblock: prevent reclaim I/O during request processing
   - cfi_cmdset_0002: cap the write-buffer chunk at 256 bytes on an x8 device

  Raw NAND:
   - Clean up the Qualcomm controller driver again
   - Improve / create Arasan and IBM
   - Reflect that ESMT and GigaDevice share ID 0xc8, and disable broken
     timings feature on GD9FU2G8F3A
   - Drop platform data support from the lpc32xx drivers

  SPI NAND:
   - Heyangtek uses two bytes for the BBM like every other device
   - Winbond: Add support for W25N04LW and W25N08LW
   - Support for ISSI SPI NAND flashes

  SPI NOR:
   - Support for new Macronix and (lots of) Winbond flash devices
   - Rewrite the status register handling. There were many small helper
     functions to enable quad I/O mode in many different ways. That's
     now consolidated in one generic function.
   - Rework the SFPD handling. It used to be only parsed for flashes
     present in the in-kernel database which had any of the multi-I/O
     bit set - or with the addition of generic flash driver for any
     unknown flashes. This left a gap where SFDP wasn't handled and it
     turns out newer flashes (with SFDP support) will reused IDs of just
     these old flashed. With the rework, SFDP is tried to be parsed for
     any flashes and will amend the information which is already present
     in the in-kernel database.
   - Increase SFDP size limit to 16KiB. There are flashes which have
     some larger gaps between tables and thus exceeds the former 4KiB
     limit.
   - Flash fixups are getting more and more common. Due to this, the
     fixups are now a separate list (per manufacturer) instead of being
     attached to a specific flash. A new .match() callback makes them
     more flexible, when one is applied.
   - Support 1-1-8 and 1-8-8 modes with larger flashes which need 4byte
     addresses

  Then there is the load of API updates and misc AI fixes"

* tag 'mtd/for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (155 commits)
  mtd: spi-nor: sfdp: reduce stack usage in spi_nor_parse_sfdp()
  mtd: spi-nor: sfdp: fix missing kernel-doc
  mtd: parsers: qcom: fix offset/size overflow on large partitions
  mtd: spinand: heyangtek: Reserve both bad block marker bytes
  mtd: rawnand: pl353: fix clk reference leak in pl35x_nfc_setup_interface()
  mtd: nand: use dmaengine_submit() instead of -&gt;tx_submit()
  dt-bindings: mtd: convert IBM NDFC binding to YAML
  mtd: rawnand: fsl_ifc: allocate shared ctrl with devm_kzalloc
  mtd: rawnand: qcom: fix read location register usage in config_nand_cw_read()
  mtd: rawnand: qcom: move common code to the 'qpic_common' module
  mtd: rawnand: qcom: rename 'nand_stats' structure
  mtd: rawnand: qcom: make nandc_set_read_loc_last() more generic
  mtd: rawnand: qcom: make nandc_set_read_loc_first() more generic
  mtd: rawnand: qcom: make config_nand_cw_write() more generic
  mtd: rawnand: qcom: make config_nand_page_write() more generic
  mtd: rawnand: qcom: make config_nand_page_read() more generic
  mtd: rawnand: qcom: make check_flash_errors() more generic
  dt-bindings: mtd: arasan: Add "power-domains" for ZynqMP
  mtd: virt-concat: unlink discarded items before freeing
  mtd: virt-concat: unlink concat node before freeing it
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull MTD updates from Miquel Raynal:
 "Core MTD:
   - Fixes to the virt-concat driver
   - Added INT0800 firmware-flash map driver
   - mtdblock: prevent reclaim I/O during request processing
   - cfi_cmdset_0002: cap the write-buffer chunk at 256 bytes on an x8 device

  Raw NAND:
   - Clean up the Qualcomm controller driver again
   - Improve / create Arasan and IBM
   - Reflect that ESMT and GigaDevice share ID 0xc8, and disable broken
     timings feature on GD9FU2G8F3A
   - Drop platform data support from the lpc32xx drivers

  SPI NAND:
   - Heyangtek uses two bytes for the BBM like every other device
   - Winbond: Add support for W25N04LW and W25N08LW
   - Support for ISSI SPI NAND flashes

  SPI NOR:
   - Support for new Macronix and (lots of) Winbond flash devices
   - Rewrite the status register handling. There were many small helper
     functions to enable quad I/O mode in many different ways. That's
     now consolidated in one generic function.
   - Rework the SFPD handling. It used to be only parsed for flashes
     present in the in-kernel database which had any of the multi-I/O
     bit set - or with the addition of generic flash driver for any
     unknown flashes. This left a gap where SFDP wasn't handled and it
     turns out newer flashes (with SFDP support) will reused IDs of just
     these old flashed. With the rework, SFDP is tried to be parsed for
     any flashes and will amend the information which is already present
     in the in-kernel database.
   - Increase SFDP size limit to 16KiB. There are flashes which have
     some larger gaps between tables and thus exceeds the former 4KiB
     limit.
   - Flash fixups are getting more and more common. Due to this, the
     fixups are now a separate list (per manufacturer) instead of being
     attached to a specific flash. A new .match() callback makes them
     more flexible, when one is applied.
   - Support 1-1-8 and 1-8-8 modes with larger flashes which need 4byte
     addresses

  Then there is the load of API updates and misc AI fixes"

* tag 'mtd/for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (155 commits)
  mtd: spi-nor: sfdp: reduce stack usage in spi_nor_parse_sfdp()
  mtd: spi-nor: sfdp: fix missing kernel-doc
  mtd: parsers: qcom: fix offset/size overflow on large partitions
  mtd: spinand: heyangtek: Reserve both bad block marker bytes
  mtd: rawnand: pl353: fix clk reference leak in pl35x_nfc_setup_interface()
  mtd: nand: use dmaengine_submit() instead of -&gt;tx_submit()
  dt-bindings: mtd: convert IBM NDFC binding to YAML
  mtd: rawnand: fsl_ifc: allocate shared ctrl with devm_kzalloc
  mtd: rawnand: qcom: fix read location register usage in config_nand_cw_read()
  mtd: rawnand: qcom: move common code to the 'qpic_common' module
  mtd: rawnand: qcom: rename 'nand_stats' structure
  mtd: rawnand: qcom: make nandc_set_read_loc_last() more generic
  mtd: rawnand: qcom: make nandc_set_read_loc_first() more generic
  mtd: rawnand: qcom: make config_nand_cw_write() more generic
  mtd: rawnand: qcom: make config_nand_page_write() more generic
  mtd: rawnand: qcom: make config_nand_page_read() more generic
  mtd: rawnand: qcom: make check_flash_errors() more generic
  dt-bindings: mtd: arasan: Add "power-domains" for ZynqMP
  mtd: virt-concat: unlink discarded items before freeing
  mtd: virt-concat: unlink concat node before freeing it
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'spi-nor/for-7.4' into mtd/next</title>
<updated>2026-10-23T16:50:09+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2026-10-23T16:50:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0ef71adafaa9b36a06dd5b823aebcd2fa9b9b9c2'/>
<id>0ef71adafaa9b36a06dd5b823aebcd2fa9b9b9c2</id>
<content type='text'>
SPI NOR changes for 7.4

- Support for new Macronix and (lots of) Winbond flash devices
- The addition of the Winbond flashes was accompanied by a big rewrite of the
  status register handling. There were many small helper functions to enable
  quad I/O mode in many different ways. That's now consolidated in one generic
  function.
- The SFPD handling was reworked. It used to be only parsed for flashes present
  in the in-kernel database which had any of the multi-I/O bit set - or with the
  addition of generic flash driver for any unknown flashes. This left a gap
  where SFDP wasn't handled and it turns out newer flashes (with SFDP support)
  will reused IDs of just these old flashed. With the rework, SFDP is tried to
  be parsed for any flashes and will amend the information which is already
  present in the in-kernel database.
- SFDP size limit was increased to 16KiB. There are flashes which have some
  larger gaps between tables and thus exceeds the former 4KiB limit.
- Flash fixups are getting more and more common. Due to this, the fixups are now
  a separate list (per manufacturer) instead of being attached to a specific
  flash. A new .match() callback makes them more flexible, when one is applied.
- 1-1-8 and 1-8-8 modes are now supported with larger flashes which needs 4byte
  addresses.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
SPI NOR changes for 7.4

- Support for new Macronix and (lots of) Winbond flash devices
- The addition of the Winbond flashes was accompanied by a big rewrite of the
  status register handling. There were many small helper functions to enable
  quad I/O mode in many different ways. That's now consolidated in one generic
  function.
- The SFPD handling was reworked. It used to be only parsed for flashes present
  in the in-kernel database which had any of the multi-I/O bit set - or with the
  addition of generic flash driver for any unknown flashes. This left a gap
  where SFDP wasn't handled and it turns out newer flashes (with SFDP support)
  will reused IDs of just these old flashed. With the rework, SFDP is tried to
  be parsed for any flashes and will amend the information which is already
  present in the in-kernel database.
- SFDP size limit was increased to 16KiB. There are flashes which have some
  larger gaps between tables and thus exceeds the former 4KiB limit.
- Flash fixups are getting more and more common. Due to this, the fixups are now
  a separate list (per manufacturer) instead of being attached to a specific
  flash. A new .match() callback makes them more flexible, when one is applied.
- 1-1-8 and 1-8-8 modes are now supported with larger flashes which needs 4byte
  addresses.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'nand/for-7.4' into mtd/next</title>
<updated>2026-10-23T16:49:30+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2026-10-23T16:49:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=76ebe529a48518d0fa671091a8c2f1a01069aa49'/>
<id>76ebe529a48518d0fa671091a8c2f1a01069aa49</id>
<content type='text'>
Raw NAND:
- The Qualcomm controller driver has been cleaned up again.
- Arasan and IBM have been improved/created.
- Reflect that ESMT and GigaDevice share ID 0xc8, and disable broken
  timings feature on GD9FU2G8F3A.
- Platform data support has been dropped from the lpc32xx drivers.

SPI NAND:
- Heyangtek uses two bytes for the BBM like every other device.
- Winbond: Add support for W25N04LW and W25N08LW.
- Support for ISSI SPI NAND flashes.

Then there is the load of API updates and misc AI fixes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Raw NAND:
- The Qualcomm controller driver has been cleaned up again.
- Arasan and IBM have been improved/created.
- Reflect that ESMT and GigaDevice share ID 0xc8, and disable broken
  timings feature on GD9FU2G8F3A.
- Platform data support has been dropped from the lpc32xx drivers.

SPI NAND:
- Heyangtek uses two bytes for the BBM like every other device.
- Winbond: Add support for W25N04LW and W25N08LW.
- Support for ISSI SPI NAND flashes.

Then there is the load of API updates and misc AI fixes.
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: rawnand: qcom: move common code to the 'qpic_common' module</title>
<updated>2026-10-12T18:17:17+00:00</updated>
<author>
<name>Gabor Juhos</name>
<email>j4g8y7@gmail.com</email>
</author>
<published>2026-09-25T19:06:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=cfae2182fa7b0f0e3caee02fa6acf5dc77410efc'/>
<id>cfae2182fa7b0f0e3caee02fa6acf5dc77410efc</id>
<content type='text'>
The 'qpic_common' module provides some generic functions which are
usable by both the 'qcom_nandc' and by the 'spi-qpic-snand' driver.
Move more code from the 'qcom_nandc' driver to there in order to
allow using those also from the 'spi-qpic-snand' driver.

No functional changes.

Signed-off-by: Gabor Juhos &lt;j4g8y7@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The 'qpic_common' module provides some generic functions which are
usable by both the 'qcom_nandc' and by the 'spi-qpic-snand' driver.
Move more code from the 'qcom_nandc' driver to there in order to
allow using those also from the 'spi-qpic-snand' driver.

No functional changes.

Signed-off-by: Gabor Juhos &lt;j4g8y7@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: nand: qpic_common: drop stray empty line from struct 'bam_transaction'</title>
<updated>2026-09-25T13:34:20+00:00</updated>
<author>
<name>Gabor Juhos</name>
<email>j4g8y7@gmail.com</email>
</author>
<published>2026-09-20T20:16:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=55c5b6d5f59f59a8c98a7effc3195226cc20175c'/>
<id>55c5b6d5f59f59a8c98a7effc3195226cc20175c</id>
<content type='text'>
Drop a superfluous empty line from the end of the 'bam_positions'
structure group within the 'bam_transaction' structure.

No functional changes.

Signed-off-by: Gabor Juhos &lt;j4g8y7@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drop a superfluous empty line from the end of the 'bam_positions'
structure group within the 'bam_transaction' structure.

No functional changes.

Signed-off-by: Gabor Juhos &lt;j4g8y7@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: spinand: Fix spinand_manufacturer_ops kernel-doc</title>
<updated>2026-09-09T07:55:07+00:00</updated>
<author>
<name>Karl Mehltretter</name>
<email>kmehltretter@gmail.com</email>
</author>
<published>2026-09-09T06:40:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7e874b1750a40f3dc9a629aeb72eba09c77f77e9'/>
<id>7e874b1750a40f3dc9a629aeb72eba09c77f77e9</id>
<content type='text'>
The kernel-doc heading for struct spinand_manufacturer_ops misspells
and truncates its name as manufacurer_ops. As a result, kernel-doc cannot
match the comment to the structure declaration.

Use the structure's actual name.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter &lt;kmehltretter@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The kernel-doc heading for struct spinand_manufacturer_ops misspells
and truncates its name as manufacurer_ops. As a result, kernel-doc cannot
match the comment to the structure declaration.

Use the structure's actual name.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter &lt;kmehltretter@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: spi-nor: Create an indirection on the part name</title>
<updated>2026-09-07T07:45:21+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2026-09-04T18:12:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=98b89d868a178d47277feede51314d8227d4cb56'/>
<id>98b89d868a178d47277feede51314d8227d4cb56</id>
<content type='text'>
We currently print through sysfs and debugfs the name of the part if the
.name field, which is legacy, has been filled in the ID table (otherwise
"(null)" is printed). These IDs had an interest until manufacturers
started re-using more and more extensively the so called unique JEDEC
IDs. At this stage, a name that was tailored for a chip sold in 2016 may
no longer be relevant for a chip sold in 2026. Still showing this name
through the various filesystems may confuse people, removing these names
cannot be done since they are now part of the user ABI (because of
sysfs).

In order to allow overwriting the .name field (which is part of a
read-only structure), let's create a spi-nor pointer which will by
default point to that .name, but which can be cleared in fixup hooks to
make sure the name is hidden on newer parts.

Reviewed-by: Takahiro Kuwano &lt;takahiro.kuwano@infineon.com&gt;
Reviewed-by: Michael Walle &lt;mwalle@kernel.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We currently print through sysfs and debugfs the name of the part if the
.name field, which is legacy, has been filled in the ID table (otherwise
"(null)" is printed). These IDs had an interest until manufacturers
started re-using more and more extensively the so called unique JEDEC
IDs. At this stage, a name that was tailored for a chip sold in 2016 may
no longer be relevant for a chip sold in 2026. Still showing this name
through the various filesystems may confuse people, removing these names
cannot be done since they are now part of the user ABI (because of
sysfs).

In order to allow overwriting the .name field (which is part of a
read-only structure), let's create a spi-nor pointer which will by
default point to that .name, but which can be cleared in fixup hooks to
make sure the name is hidden on newer parts.

Reviewed-by: Takahiro Kuwano &lt;takahiro.kuwano@infineon.com&gt;
Reviewed-by: Michael Walle &lt;mwalle@kernel.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: spi-nor: Add support for the new JESD216 rev F QER field</title>
<updated>2026-09-07T07:45:20+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2026-09-04T18:12:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9f1feb4162387295b0d8de6c879f00357852609b'/>
<id>9f1feb4162387295b0d8de6c879f00357852609b</id>
<content type='text'>
Revision F of the JEDEC JESD216 standard includes yet another
supported setting in the QER 3-bit bitfield: 110b.

This setting implies that the QE bit is bit 1 of SR2 (which is an
already supported case) but this time it makes it very clear that both
reading and writing to SR2 is supported, but not with the usual
opcodes. The write operation uses an alternate WRSR2 opcode:
0x31 (instead of 0x3E) and both the reads and writes manipulate a single
register at a time.

Reviewed-by: Takahiro Kuwano &lt;takahiro.kuwano@infineon.com&gt;
Reviewed-by: Michael Walle &lt;mwalle@kernel.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Revision F of the JEDEC JESD216 standard includes yet another
supported setting in the QER 3-bit bitfield: 110b.

This setting implies that the QE bit is bit 1 of SR2 (which is an
already supported case) but this time it makes it very clear that both
reading and writing to SR2 is supported, but not with the usual
opcodes. The write operation uses an alternate WRSR2 opcode:
0x31 (instead of 0x3E) and both the reads and writes manipulate a single
register at a time.

Reviewed-by: Takahiro Kuwano &lt;takahiro.kuwano@infineon.com&gt;
Reviewed-by: Michael Walle &lt;mwalle@kernel.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: spi-nor: Refactor Read Status/Write Status support</title>
<updated>2026-09-07T07:45:20+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2026-09-04T18:12:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=63489002d397ebf136548c79af68a8e05b30d45c'/>
<id>63489002d397ebf136548c79af68a8e05b30d45c</id>
<content type='text'>
SPI NOR has a lot of history. Additions over additions, the subtleties
of the JESD216 specification, their implementations by the manufacturers
and the hardware mistakes have generated a gigantic maze, let's try to
understand what is really needed.

The specification explains the QE (Quad Enable) bitfield as describing
where the bit to enable the Quad capability is, but also how to set
it. Unfortunately, the specification is not precise about what opcodes
are supported exactly in all the cases. There is an introduction that
basically states:
- Opcode 0x05 reads SR1
- Opcode 0x35 reads SR2
- Opcode 0x01 writes SR1, and then SR2 if another byte is written

Then the bitfield, among indicating the location of the QE bit, may
indicate:
- Reading SR1 and SR2 in one operation is not possible (loops over the
  content of SR1)
- Reading SR2 directly is possible
- Only writing SR1 zeroes SR2.

One problem with the current implementation, is that it only focuses on
the QE bit. A quad_enable function was created for each case, even
though in practice, the logic was always the same: read, modify, write,
read back and verify. One problem comes when other features need to play
with the status registers, like software block protection or OTP: you
never know how to properly handle the QE bit, nor where it is, nor how
to read/write the Status registers. This lead to
approximations/guessing (in swp.c, otp.c and obviously in legacy
controller drivers like atmel.c) but also to the implementation of a
gazillon of helpers for reading/writing/checking the status registers.

In addition, I believe some design decisions had a negative impact over
the years.

- All possible situations had to be flagged by the core. This is likely
  wrong, because we no longer know why we need specific quirks. It was
  ineherent to the state of the SPI NOR core before the great cleanup
  that had happened the past few years. I believe this creates confusion
  in the core today, and we should push this to vendor fixups
  instead. As an example, in 2023 Hsin-Yi was facing an issue because
  his chip was setting the wrong QER value, leading to RDCR being
  prevented, thus falling into a condition blindly setting a random QE
  bit (I strongy believe it is done like that for wrong reasons). His
  chip actually had RDCR support! The correct fix should have been to
  mark the capability in a device fixup instead of handling this in the
  core.

  Link: https://lore.kernel.org/lkml/CAJMQK-hR0eaO0b4Vd0U8_KAndLyZapqdHjVLAoe42rWi9rdLkA@mail.gmail.com/

- SFDP parsing is over cautious. I believe
  BFPT_DWORD15_QER_SR2_BIT1_NO_RD is abusive (nothing states that RDCR is
  not supported), and BFPT_DWORD15_QER_SR2_BIT1 is also out of
  specification when forcing 16-bit Status writes.

- SNOR_F_HAS_16BIT_SR is only imposing 16bit Status writes, whereas
  reads can still be 8-bit wide.

- The usage of helpers verifying the writes was also spread for IMHO no
  really good reason. Why shouldn't we trust spi operations when it
  comes to Status Registers? We do not read back our page reads, so why
  status registers should be treated with so much care, if it's not
  because we are unsure of what is being done? My proposal includes a
  check when it comes to the QE bit (done once) but we don't need these
  checks otherwise. If the QE bit was written properly, there are high
  chances that the other register accesses will just be fine, no?

Asde from my main quest, I also observed no good reason to ask the
read/write status register callers to use nor-&gt;bouncebuf while the
low-level helpers could do it themselves (we are talking about one or
two bytes being copied).

So after these observations, my proposal is the following:
- Create private low level helpers that just read or write a status
  register. They are flexible, we can give the opcode (which varies
  based on the SFDP QER field) and the length (1 or 2).
- Create public generic accessors which will be used to read/write sr1
  and/or sr2. This is where all the cleverness shall be. The helpers use
  the available opcodes for a given chip in order to fullfill the
  request.
- Provide a single generic -&gt;quad_enable() hook which generically does
  all the steps mentioned above (read, modify, write, read back and
  verify).
- Create a list of opcodes for all 6 possible situations:
  {read, write} {sr1, sr2, sr1 and sr2}. These opcodes are
  filled/cleared based on the QER field. An opcode set to 0 indicates
  the absence of support (there is no 0x00 opcode in SPI NOR).

I tried my best to analyze the current behavior and to mimic it as much
as possible, but this is a risky cleanup. However, if we go for this, it
will be *much* easier in the future to handle all kind of chip
variations. We won't be limited to a couple of flags anymore, but rather
we'll be able to just disable a read or write capability using a single
line.

Known deviations:
- The Atmel manufacturer driver drives non SFDP chips which by default
  were receiving the HAS_16B_WR flag, forcing SR2 writes all the times,
  but it was deliberately making single bytes writes to SR1 for its
  locking operations. The flag is likely wrong for them, so I removed
  it.
- I am proposing on purpose a single quad_enable helper. It should match
  all the cases, with 1 identified difference which I believe is
  harmless: in the SR2_BIT7 case, the helper would make an extra SR1
  read/write which was not done before. This entry explicitly supports
  reading and writing the two registers. Note: no manufacturer has been
  identified to actually use that entry yet.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
SPI NOR has a lot of history. Additions over additions, the subtleties
of the JESD216 specification, their implementations by the manufacturers
and the hardware mistakes have generated a gigantic maze, let's try to
understand what is really needed.

The specification explains the QE (Quad Enable) bitfield as describing
where the bit to enable the Quad capability is, but also how to set
it. Unfortunately, the specification is not precise about what opcodes
are supported exactly in all the cases. There is an introduction that
basically states:
- Opcode 0x05 reads SR1
- Opcode 0x35 reads SR2
- Opcode 0x01 writes SR1, and then SR2 if another byte is written

Then the bitfield, among indicating the location of the QE bit, may
indicate:
- Reading SR1 and SR2 in one operation is not possible (loops over the
  content of SR1)
- Reading SR2 directly is possible
- Only writing SR1 zeroes SR2.

One problem with the current implementation, is that it only focuses on
the QE bit. A quad_enable function was created for each case, even
though in practice, the logic was always the same: read, modify, write,
read back and verify. One problem comes when other features need to play
with the status registers, like software block protection or OTP: you
never know how to properly handle the QE bit, nor where it is, nor how
to read/write the Status registers. This lead to
approximations/guessing (in swp.c, otp.c and obviously in legacy
controller drivers like atmel.c) but also to the implementation of a
gazillon of helpers for reading/writing/checking the status registers.

In addition, I believe some design decisions had a negative impact over
the years.

- All possible situations had to be flagged by the core. This is likely
  wrong, because we no longer know why we need specific quirks. It was
  ineherent to the state of the SPI NOR core before the great cleanup
  that had happened the past few years. I believe this creates confusion
  in the core today, and we should push this to vendor fixups
  instead. As an example, in 2023 Hsin-Yi was facing an issue because
  his chip was setting the wrong QER value, leading to RDCR being
  prevented, thus falling into a condition blindly setting a random QE
  bit (I strongy believe it is done like that for wrong reasons). His
  chip actually had RDCR support! The correct fix should have been to
  mark the capability in a device fixup instead of handling this in the
  core.

  Link: https://lore.kernel.org/lkml/CAJMQK-hR0eaO0b4Vd0U8_KAndLyZapqdHjVLAoe42rWi9rdLkA@mail.gmail.com/

- SFDP parsing is over cautious. I believe
  BFPT_DWORD15_QER_SR2_BIT1_NO_RD is abusive (nothing states that RDCR is
  not supported), and BFPT_DWORD15_QER_SR2_BIT1 is also out of
  specification when forcing 16-bit Status writes.

- SNOR_F_HAS_16BIT_SR is only imposing 16bit Status writes, whereas
  reads can still be 8-bit wide.

- The usage of helpers verifying the writes was also spread for IMHO no
  really good reason. Why shouldn't we trust spi operations when it
  comes to Status Registers? We do not read back our page reads, so why
  status registers should be treated with so much care, if it's not
  because we are unsure of what is being done? My proposal includes a
  check when it comes to the QE bit (done once) but we don't need these
  checks otherwise. If the QE bit was written properly, there are high
  chances that the other register accesses will just be fine, no?

Asde from my main quest, I also observed no good reason to ask the
read/write status register callers to use nor-&gt;bouncebuf while the
low-level helpers could do it themselves (we are talking about one or
two bytes being copied).

So after these observations, my proposal is the following:
- Create private low level helpers that just read or write a status
  register. They are flexible, we can give the opcode (which varies
  based on the SFDP QER field) and the length (1 or 2).
- Create public generic accessors which will be used to read/write sr1
  and/or sr2. This is where all the cleverness shall be. The helpers use
  the available opcodes for a given chip in order to fullfill the
  request.
- Provide a single generic -&gt;quad_enable() hook which generically does
  all the steps mentioned above (read, modify, write, read back and
  verify).
- Create a list of opcodes for all 6 possible situations:
  {read, write} {sr1, sr2, sr1 and sr2}. These opcodes are
  filled/cleared based on the QER field. An opcode set to 0 indicates
  the absence of support (there is no 0x00 opcode in SPI NOR).

I tried my best to analyze the current behavior and to mimic it as much
as possible, but this is a risky cleanup. However, if we go for this, it
will be *much* easier in the future to handle all kind of chip
variations. We won't be limited to a couple of flags anymore, but rather
we'll be able to just disable a read or write capability using a single
line.

Known deviations:
- The Atmel manufacturer driver drives non SFDP chips which by default
  were receiving the HAS_16B_WR flag, forcing SR2 writes all the times,
  but it was deliberately making single bytes writes to SR1 for its
  locking operations. The flag is likely wrong for them, so I removed
  it.
- I am proposing on purpose a single quad_enable helper. It should match
  all the cases, with 1 identified difference which I believe is
  harmless: in the SR2_BIT7 case, the helper would make an extra SR1
  read/write which was not done before. This entry explicitly supports
  reading and writing the two registers. Note: no manufacturer has been
  identified to actually use that entry yet.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Michael Walle &lt;mwalle@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: spinand: fix NULL pointer dereference with no ECC engine</title>
<updated>2026-09-04T18:32:21+00:00</updated>
<author>
<name>Nuno Sá</name>
<email>nuno.sa@analog.com</email>
</author>
<published>2026-08-31T15:07:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b890e6163761ddb580cc74f43e15f8bbde15647e'/>
<id>b890e6163761ddb580cc74f43e15f8bbde15647e</id>
<content type='text'>
When "nand-no-ecc-engine" is set in DT, nanddev_get_ecc_engine() takes
the NAND_ECC_ENGINE_TYPE_NONE path and returns success while leaving
nand-&gt;ecc.engine NULL. The SPI-NAND code nevertheless dereferences it
unconditionally to test for a pipelined engine, so probing such a
device oopses immediately.

Rather than open-coding the test three times, add a
nand_ecc_is_pipelined() helper to the NAND core that folds the NULL
check into the integration comparison, and use it everywhere. Future
callers then cannot reintroduce the problem.

Fixes: f9d7c7265bcf ("mtd: spinand: Create direct mapping descriptors for ECC operations")
Cc: stable@vger.kernel.org
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When "nand-no-ecc-engine" is set in DT, nanddev_get_ecc_engine() takes
the NAND_ECC_ENGINE_TYPE_NONE path and returns success while leaving
nand-&gt;ecc.engine NULL. The SPI-NAND code nevertheless dereferences it
unconditionally to test for a pipelined engine, so probing such a
device oopses immediately.

Rather than open-coding the test three times, add a
nand_ecc_is_pipelined() helper to the NAND core that folds the NULL
check into the integration comparison, and use it everywhere. Future
callers then cannot reintroduce the problem.

Fixes: f9d7c7265bcf ("mtd: spinand: Create direct mapping descriptors for ECC operations")
Cc: stable@vger.kernel.org
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
