All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 controller support
@ 2026-12-01  7:14 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-12-01  7:14 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261127-b4-cs7542-nand-v5-2-45b1a92bd13d@gmail.com>
References: <20261127-b4-cs7542-nand-v5-2-45b1a92bd13d@gmail.com>
TO: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
TO: Miquel Raynal <miquel.raynal@bootlin.com>
TO: Richard Weinberger <richard@nod.at>
TO: Vignesh Raghavendra <vigneshr@ti.com>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: Philipp Zabel <p.zabel@pengutronix.de>
CC: linux-mtd@lists.infradead.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi Fil,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f]

url:    https://github.com/intel-lab-lkp/linux/commits/Fil-Dunsky-via-B4-Relay/dt-bindings-mtd-Add-Cortina-CS7542-NAND-controller/20261127-185404
base:   b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
patch link:    https://lore.kernel.org/r/20261127-b4-cs7542-nand-v5-2-45b1a92bd13d%40gmail.com
patch subject: [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 controller support
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: arm64-randconfig-2200-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201080340.G4oDRTAt-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261201080340.G4oDRTAt-lkp@intel.com/

smatch warnings:
drivers/mtd/nand/raw/cs752x_nand.c:477 cs752x_nand_exec_op() error: we previously assumed 'p.data' could be null (see line 466)

vim +477 drivers/mtd/nand/raw/cs752x_nand.c

fef89bafa0003f3 Fil Dunsky 2026-11-27  453  
fef89bafa0003f3 Fil Dunsky 2026-11-27  454  static int cs752x_nand_exec_op(struct nand_chip *chip,
fef89bafa0003f3 Fil Dunsky 2026-11-27  455  			       const struct nand_operation *op, bool check_only)
fef89bafa0003f3 Fil Dunsky 2026-11-27  456  {
fef89bafa0003f3 Fil Dunsky 2026-11-27  457  	struct cs752x_nand_host *h = to_host(chip);
fef89bafa0003f3 Fil Dunsky 2026-11-27  458  	struct mtd_info *mtd = nand_to_mtd(chip);
fef89bafa0003f3 Fil Dunsky 2026-11-27  459  	struct cs752x_nand_op p;
fef89bafa0003f3 Fil Dunsky 2026-11-27  460  	unsigned int len, requested, col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  461  	int ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  462  
fef89bafa0003f3 Fil Dunsky 2026-11-27  463  	ret = cs752x_nand_supports_op(op, &p);
fef89bafa0003f3 Fil Dunsky 2026-11-27  464  	if (ret || check_only)
fef89bafa0003f3 Fil Dunsky 2026-11-27  465  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27 @466  	requested = p.data ? p.data->ctx.data.len : 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  467  	if (!p.ncmds && p.wait_ready) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  468  		ret = cs752x_nand_wait_ready(h, p.timeout_ms);
fef89bafa0003f3 Fil Dunsky 2026-11-27  469  		if (p.delay_ns)
fef89bafa0003f3 Fil Dunsky 2026-11-27  470  			ndelay(p.delay_ns);
fef89bafa0003f3 Fil Dunsky 2026-11-27  471  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  472  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  473  	if (h->use_hwecc && p.data && p.ncmds == 2 &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  474  	    p.naddrs >= 4 && !(p.address & 0xffff) &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  475  	    requested == mtd->writesize)
fef89bafa0003f3 Fil Dunsky 2026-11-27  476  		return cs752x_nand_hwecc_op(h, &p);
fef89bafa0003f3 Fil Dunsky 2026-11-27 @477  	if (!p.ncmds && p.data->type == NAND_OP_DATA_OUT_INSTR) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  478  		h->buf_data_len = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  479  		h->buf_offs = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  480  		return cs752x_nand_pio(h, &p, (u8 *)p.data->ctx.data.buf.out,
fef89bafa0003f3 Fil Dunsky 2026-11-27  481  				      requested, true);
fef89bafa0003f3 Fil Dunsky 2026-11-27  482  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  483  	if (!p.ncmds) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  484  		if (h->read_mode != NAND_CMD_STATUS)
fef89bafa0003f3 Fil Dunsky 2026-11-27  485  			goto cached;
fef89bafa0003f3 Fil Dunsky 2026-11-27  486  		if (requested != 1)
fef89bafa0003f3 Fil Dunsky 2026-11-27  487  			return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  488  		p.command = NAND_CMD_STATUS;
fef89bafa0003f3 Fil Dunsky 2026-11-27  489  		p.ncmds = 1;
fef89bafa0003f3 Fil Dunsky 2026-11-27  490  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  491  	if (p.command == (NAND_CMD_RNDOUT | (NAND_CMD_RNDOUTSTART << 8))) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  492  		col = p.address;
fef89bafa0003f3 Fil Dunsky 2026-11-27  493  		if (h->read_mode != NAND_CMD_PARAM && h->read_mode != NAND_CMD_READ0)
fef89bafa0003f3 Fil Dunsky 2026-11-27  494  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  495  		if (col < h->cache_column || col - h->cache_column > h->buf_data_len)
fef89bafa0003f3 Fil Dunsky 2026-11-27  496  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  497  		h->buf_offs = col - h->cache_column;
fef89bafa0003f3 Fil Dunsky 2026-11-27  498  		goto cached;
fef89bafa0003f3 Fil Dunsky 2026-11-27  499  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  500  	h->buf_offs = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  501  	h->buf_data_len = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  502  	h->read_mode = p.command & 0xff;
fef89bafa0003f3 Fil Dunsky 2026-11-27  503  	h->cache_column = 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  504  	len = p.data && p.data->type == NAND_OP_DATA_IN_INSTR ? requested : 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  505  	switch (p.command) {
fef89bafa0003f3 Fil Dunsky 2026-11-27  506  	case NAND_CMD_READID:
fef89bafa0003f3 Fil Dunsky 2026-11-27  507  		len = max(requested, 8U);
fef89bafa0003f3 Fil Dunsky 2026-11-27  508  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  509  	case NAND_CMD_PARAM:
fef89bafa0003f3 Fil Dunsky 2026-11-27  510  		/* Keep all standard ONFI copies plus room for extended parameters. */
fef89bafa0003f3 Fil Dunsky 2026-11-27  511  		len = sizeof(h->own_buf);
fef89bafa0003f3 Fil Dunsky 2026-11-27  512  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  513  	case NAND_CMD_STATUS:
fef89bafa0003f3 Fil Dunsky 2026-11-27  514  		len = 1;
fef89bafa0003f3 Fil Dunsky 2026-11-27  515  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  516  	case NAND_CMD_READ0 | (NAND_CMD_READSTART << 8):
fef89bafa0003f3 Fil Dunsky 2026-11-27  517  		col = p.address & 0xffff;
fef89bafa0003f3 Fil Dunsky 2026-11-27  518  		if (col >= mtd->writesize + mtd->oobsize)
fef89bafa0003f3 Fil Dunsky 2026-11-27  519  			return -EINVAL;
fef89bafa0003f3 Fil Dunsky 2026-11-27  520  		h->cache_column = col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  521  		len = mtd->writesize + mtd->oobsize - col;
fef89bafa0003f3 Fil Dunsky 2026-11-27  522  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  523  	default:
fef89bafa0003f3 Fil Dunsky 2026-11-27  524  		break;
fef89bafa0003f3 Fil Dunsky 2026-11-27  525  	}
fef89bafa0003f3 Fil Dunsky 2026-11-27  526  	if (len > sizeof(h->own_buf) || (requested > len &&
fef89bafa0003f3 Fil Dunsky 2026-11-27  527  					 (!p.data || p.data->type == NAND_OP_DATA_IN_INSTR)))
fef89bafa0003f3 Fil Dunsky 2026-11-27  528  		return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  529  	if (p.data && p.data->type == NAND_OP_DATA_OUT_INSTR)
fef89bafa0003f3 Fil Dunsky 2026-11-27  530  		return cs752x_nand_pio(h, &p, (u8 *)p.data->ctx.data.buf.out,
fef89bafa0003f3 Fil Dunsky 2026-11-27  531  				      requested, true);
fef89bafa0003f3 Fil Dunsky 2026-11-27  532  
fef89bafa0003f3 Fil Dunsky 2026-11-27  533  	ret = cs752x_nand_pio(h, &p, h->own_buf, len,
fef89bafa0003f3 Fil Dunsky 2026-11-27  534  			      p.command == NAND_CMD_RESET);
fef89bafa0003f3 Fil Dunsky 2026-11-27  535  	if (ret)
fef89bafa0003f3 Fil Dunsky 2026-11-27  536  		return ret;
fef89bafa0003f3 Fil Dunsky 2026-11-27  537  	h->buf_data_len = len;
fef89bafa0003f3 Fil Dunsky 2026-11-27  538  cached:
fef89bafa0003f3 Fil Dunsky 2026-11-27  539  	if (!requested)
fef89bafa0003f3 Fil Dunsky 2026-11-27  540  		return 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  541  	if (h->buf_offs > h->buf_data_len ||
fef89bafa0003f3 Fil Dunsky 2026-11-27  542  	    requested > h->buf_data_len - h->buf_offs)
fef89bafa0003f3 Fil Dunsky 2026-11-27  543  		return -EOPNOTSUPP;
fef89bafa0003f3 Fil Dunsky 2026-11-27  544  	memcpy(p.data->ctx.data.buf.in, h->own_buf + h->buf_offs, requested);
fef89bafa0003f3 Fil Dunsky 2026-11-27  545  	h->buf_offs += requested;
fef89bafa0003f3 Fil Dunsky 2026-11-27  546  	return 0;
fef89bafa0003f3 Fil Dunsky 2026-11-27  547  }
fef89bafa0003f3 Fil Dunsky 2026-11-27  548  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH v5 0/3] Add Cortina Systems CS7542 NAND controller support
@ 2026-11-27 15:54 Fil Dunsky
  2026-11-27 15:54   ` Fil Dunsky via B4 Relay
  0 siblings, 1 reply; 4+ messages in thread
From: Fil Dunsky @ 2026-11-27 15:54 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel
  Cc: linux-mtd, devicetree, linux-kernel

Add the CS7542 programmed-I/O NAND controller independently of the
platform series and ARCH_CORTINA_ACCESS.

Describe the hardware's two chip selects, 8/16-bit bus and Hamming/BCH
capabilities in the binding. The initial driver supports one connected
8-bit target on either CS, on-host Hamming with 256-byte steps, software
ECC and raw transfers. ECC_NONE is rejected: the core installs split
raw-page callbacks for that mode, which are not safe for this sequencer. It preserves firmware bus timing by retaining
the AXI clock rate. The optional flash reset is acquired without a pulse;
PIO polls completion without claiming the flash IRQ or shared SSP DMA.

Validate generic operation descriptors separately from execution. Use
NAND core page-operation builders in the hardware ECC callbacks instead
of assembling read/program opcodes independently. Preserve the existing
Almond+ Hamming/OOB layout.

Retained v4 validation (the on-host Hamming path is unchanged in v5):
- Full ARM vmlinux/modules builds with the driver =y and =m, without the
  platform series and with COMPILE_TEST=n; software Hamming enabled.
- Binding/example validation and strict source checkpatch.
- Actual NAND core builders and the driver validator: 9815 cases each
  against native and OpenWrt 6.18 headers, GCC and Clang ASan/UBSan.
- Actual hardware-ECC sequencing versus v3: 240 cases per compiler,
  including command/address registers, CS/bank selection, main/ECC/OOB
  ordering and fault cleanup.
- Exact driver compilation with the installed OpenWrt 6.18.64 headers.

The v4 NAND driver booted on Almond+ in a combined OpenWrt
6.18.64 RAM kernel. It read 56 MiB of protected regions with matching
SHA-256 and matched raw/generic 64-byte OOB reads in all four banks.
The real UBI stack created a temporary two-LEB volume, wrote/compared
two 253952-byte patterns, physically erased both LEBs and read back ff.
The temporary volume was removed and the normal reserve restored to
80 blocks (free 0/bad 0, original five volumes intact). The independent
fixed-deadline watchdog returned to installed OpenWrt automatically;
all 13 protected hashes and all configuration hashes matched, and the
four LCD services and normal 30-second watchdog were running.

The RAM run tested the retained hardware Hamming layout. Software ECC
was checked by compilation and the core-operation host tests, rather
than changing the ECC format of the existing flash. No kernel image
was installed by the RAM test. Native driver source bytes were identical
to the tested 6.18 integration; the native full builds are separate.

New v5 checks: full native ARM vmlinux/modules with COMPILE_TEST=n,
exact Linux 6.18 ARM object compilation with Werror, and 52 actual-source
attach/child-selection cases per compiler under GCC/Clang ASan/UBSan.
These cover a disabled CS0 sibling with enabled CS1 and rejection of
ECC_NONE while retaining software ECC. The board uses a single enabled
CS0 with on-host Hamming; these changes do not alter that tested path.
No new hardware write test or installation is claimed for the v5 delta.

---
Changes in v5:
- Select the available NAND child, including CS1 when CS0 is disabled.
- Reject ECC_NONE; retain software ECC and monolithic raw transfers.
- Check the changed attach and probe paths with actual-source tests.
- Link to v4: https://patch.msgid.link/20261126-b4-cs7542-nand-v4-0-38e488f6f8b1@gmail.com

Changes in v4:
- Address Miquel Raynal's binding and driver review on v2.
- Describe controller capabilities rather than only the initial driver.
- Add the AXI clock, flash IRQ, optional reset and data aperture binding.
- Separate supports_op() and remove the NAND opcode whitelist.
- Use core page helpers for hardware ECC; allow software ECC/raw transfers.
- Support either chip select and reject multiple connected targets explicitly.
- Preserve bus timing through clock rate exclusivity; do not pulse flash reset.
- Clarify the vendor EXTADDR convention; retain the existing Hamming layout.
- Link to v3: https://patch.msgid.link/20261125-b4-cs7542-nand-v3-0-0b6d141c102e@gmail.com

To: Fil Dunsky <filipp.dunsky@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
To: Richard Weinberger <richard@nod.at>
To: Vignesh Raghavendra <vigneshr@ti.com>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-mtd@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

---
Fil Dunsky (3):
      dt-bindings: mtd: Add Cortina CS7542 NAND controller
      mtd: rawnand: Add Cortina CS7542 controller support
      MAINTAINERS: Add Cortina CS7542 NAND controller entry

 .../bindings/mtd/cortina,cs7542-nand.yaml          |  90 +++
 MAINTAINERS                                        |   7 +
 drivers/mtd/nand/raw/Kconfig                       |  12 +
 drivers/mtd/nand/raw/Makefile                      |   1 +
 drivers/mtd/nand/raw/cs752x_nand.c                 | 744 +++++++++++++++++++++
 5 files changed, 854 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-nand-87997e300079

Best regards,
--  
Fil Dunsky <filipp.dunsky@gmail.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-01  7:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  7:14 [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 controller support kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-11-27 15:54 [PATCH v5 0/3] Add Cortina Systems CS7542 NAND " Fil Dunsky
2026-11-27 15:54 ` [PATCH v5 2/3] mtd: rawnand: Add Cortina CS7542 " Fil Dunsky
2026-11-27 15:54   ` Fil Dunsky via B4 Relay
2026-11-27 15:54   ` Fil Dunsky via B4 Relay

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.