Re: [PATCH v8 3/4] mtd: rawnand: Add Cortina CS7542 controller support
From: Philipp Zabel
Date: Fri Dec 04 2026 - 09:12:49 EST
On Fr, 2026-12-04 at 17:03 +0300, Fil Dunsky via B4 Relay wrote:
> From: Fil Dunsky <filipp.dunsky@xxxxxxxxx>
>
> Add programmed-I/O support for the CS7542 NAND controller. Use the
> NAND operation parser to validate complete instructions and populate
> the native command, address and data registers. Transfer the requested
> bytes directly between the controller and the NAND core's buffer.
>
> Reset the controller at probe and program its default asynchronous bus
> timing. Keep the AXI clock rate fixed while the timing is in use.
> Poll the controller and the NAND R/B pin with distinct timeouts.
>
> Keep the existing 256-byte Hamming step and OOB layout used by Almond+.
> Disable the on-host Hamming and BCH engines for software ECC and for
> raw NAND operations. The initial driver supports one 8-bit target on
> either of the two hardware chip selects.
>
> The flash controller is fixed. An open MTD device pins its module, but
> sysfs unbind bypasses that reference and can release the live
> controller state. Suppress manual bind/unbind until the MTD devices
> can be detached safely.
>
> Signed-off-by: Fil Dunsky <filipp.dunsky@xxxxxxxxx>
> ---
> drivers/mtd/nand/raw/Kconfig | 11 +
> drivers/mtd/nand/raw/Makefile | 1 +
> drivers/mtd/nand/raw/cs752x_nand.c | 756 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 768 insertions(+)
>
[...]
> diff --git a/drivers/mtd/nand/raw/cs752x_nand.c b/drivers/mtd/nand/raw/cs752x_nand.c
> new file mode 100644
> index 000000000..690067b9b
> --- /dev/null
> +++ b/drivers/mtd/nand/raw/cs752x_nand.c
> @@ -0,0 +1,756 @@
[...]
> +static int cs752x_nand_probe(struct platform_device *pdev)
> +{
[...]
> + reset = devm_reset_control_get_optional_exclusive(dev, NULL);
The dt-binding calls this reset "shared", but here we request exclusive
access, which is correct?
> + if (IS_ERR(reset))
> + return dev_err_probe(dev, PTR_ERR(reset), "flash reset\n");
> +
> + if (reset) {
> + err = reset_control_assert(reset);
> + if (err)
> + return dev_err_probe(dev, err, "assert flash reset\n");
> +
> + udelay(2);
> + err = reset_control_deassert(reset);
> + if (err)
> + return dev_err_probe(dev, err, "release flash reset\n");
> + }
regards
Philipp