From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796567251; b=q36L3ZNQGZcOU1AWdyVHOi4JKc91WXAwpkEH0moWqJptqrg6VS6DKTVYzEByVFvHW6g1 ogmIm2s2Z9RVON+O/CwjRBY6AMQWv/awYRzQU4vYFsIL1nwpu6DubGyww2WeaRKqz/RGR Nzbhj5PR8msDG2SYBMhcgVFvAwELS+Oy5d9WEyfw6exBJeneRcJhlaRBYGWJdSGW/m2yz lfTN57rsO4kuDwyn6eVRDG/6Xe8QQJ20qMdIT+BSuRibRMQQk4a3khZSm3zuvAxIr8N6N j/Galv5MmbxjT2xeMbS9zcmzkiFOfxfwNRb50YqMDYjDusNUX+2PzZ8PmKpwkBBX7Vw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796567251; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=yCWTSC+Cht6PwKymbcdKlhUsm0qnTsWU/VfPM3nT83o=; b=4bIGF2y+y4IsNpDo9h4sPQmkUVy46hkRgKDvgQdh5IsvCy6fc+U0/Ro+PbeB24mzKK19 Lwq3HweTJFtRkJQ9PvoMCLRryrMxs6n0Ll72xxb0muWTszBQjxpjQW+dMybTlShf1cfJ1 DNa0PMczdiwvTtKynkmP/VyLcwRsxw9ba4qn5eWoMa/GTRqwGH4ldJWV/odNZpJj3Dou+ j7gCqYp8UQ3Rmif4LjjfQ9HLpx8ypSAuWepRcol5Y4fHzZqiR7HuW8br6l1ZNPIpOPBbS naet6Vbfyby34C/X+8/UB4kOlDZX+Ufd8njb+wv+i17kFidHYtyiwTmQWUYTf/EanxQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J2ldEhtp; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ADED606A321; Sun, 6 Dec 2026 14:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J2ldEhtp Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796567251; b=awYgryuCvajnAYZvJq86fAznmEwW/rV2hQwCBHerpxkAFatPzOOR5PGWu9r/kQsKexXz YKnEkXkBEXV16HG+lfuBUyGKQ7n8qsgbl/Zhyoay672st8QrmdwPZ4EP5fM9aDvZpSoGz UeC+Mn/IVAfCeR+l17ArB31SMFBmQ3P4BclJRVMKb8TA8CAkq5KP1UEsoLLKyTXd7ltJW yhI3M3KEmRUzhnmQKaw0JgUa9w5nkPZDKZEVgNKEgoiRMc8Zm4OXR5YTWgBEEss017CD3 wFqvKd70PE5zd+IK9Xg0pLv5yUW80tCke9TX3b571GQTsbsLCkIGdT02oHHIXCVqItA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796567251; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=yCWTSC+Cht6PwKymbcdKlhUsm0qnTsWU/VfPM3nT83o=; b=jyFeARUEZxfy9lN+I1RpY3k0uSyMYZ2Why2NjKrSMuJWNt99/wbwfVCGlaHCzwdlddAh wAWRDtfYhjPWoziyFLaSFJ/WcqwpAGQWO4a1mnqlECXhfrpz4yl4dh7ifWY3F408u0T07 t0flykhKbNTcNjRlLT8jn2b6bgcVHpa1yZMHCV/HBYvORS7tsCVNzzEZUK1RUZkRr8M0Q CS2RZ0EIANP5hcxuto/Cmn+UX0e+ApA0NxEqg9O+QNoGTkboZQGW5enkAYdD4d8cLKduO YTJ6FFjmwLiwNF2StBVBtiIrqZ3FkpWrAYpHZWTp+4QIgFF0+RRlXspcyiafT8Uwriw== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 7C22E1F0092B; Sun, 6 Dec 2026 14:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796567251; bh=yCWTSC+Cht6PwKymbcdKlhUsm0qnTsWU/VfPM3nT83o=; h=From:Subject:Date:To:Cc:Reply-To; b=J2ldEhtp0VrdPkQ8Vgvl9Z65Af/HvvbgaweTqAdUfSI8IdaQN/OY1BxVx/bR5goat 2oHisgQECzQb54VTOhqXZeo2+J5+64Rx6ugqVG3S6M6ozMr+DT69kcPzIVv6uXQan2 2ssTC2GElYNd+He6f4t0miS1Tnsj25rrEJ5IXvdmHHsm3du1qf38U2YN6WzQX2dpyg JPyZIgH51hBOO7x32mann441gpnxv0WV1Z5Rr0VvpPzqsIsw//WPlf7dp5BNUDmNME fucWQmRByHgnCjwMSCNRfltYw+Lys0HWvNSF//l4vHxDINTUcyf4ZLt1bCx4mnbo5g CRdT7aElxnCsg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id CC856507A5; Sun, 6 Dec 2026 14:27:29 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v9 0/4] Add Cortina Systems CS7542 NAND controller support Date: Sun, 06 Dec 2026 17:27:20 +0300 Message-Id: <20261206-b4-cs7542-nand-v9-0-b79bd1478bec@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/33PQU7DMBCF4atUXmM0YzseuyvugVjE9qQ1oilKS gSqencmZUGUCJZPmu+3fFUjD5VHtd9d1cBTHeu5lxEfdiof2/7AuhbZyoDxiMbq5HQeqXFG921 fdKAYiS0AUFSC3gfu6uc9+Pzys8eP9Mr5Mlfmi2MdL+fh6/7ihPPdn/EJNWjKjBQzILJ5Opza+ vaYzyc1xyfzPzfCY4kdBA+hsW7N7ZI3G26FQ/IFHWYEw2vultxvuBNuA7sQOt+FhGveLDlteCP cNQnbaFJBW9bc/3IDuOFeOPsEhSQunTWnJTcbTsIDFsvFyu+J1jwsudvwIDwl8ME71xF2S3673 b4BhTtykncCAAA= X-Change-ID: 20261123-b4-cs7542-nand-87997e300079 To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Fil Dunsky , Philipp Zabel Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796567247; l=6313; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=DtdUthIBEeXhvaEByEqLCELQSxtl9nk3ASq3mD57hUM=; b=FGWv7AmucwDIkHMVDvgpe9Gxcn6Nk9rt64sm0v0PEnhkFiLZKdszPHN0c1uKAyGCayOZEQkzY m/EmtjbAxAEAITSqs4Xfb3zassTV0U1DL3nKtRrpP1qnz1OlzmBn6wy X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Add a programmed-I/O driver for the Cortina CS7542 NAND controller. The controller accepts complete command, address and data phases. Use the NAND core operation parser to validate and issue those phases. The binding describes both chip selects, both bus widths and the Hamming and BCH engines. The driver supports one 8-bit target, on-host Hamming with the existing Almond+ layout, software ECC and raw data. It initializes the reset and NAND timing at probe. On Almond+, the reviewed driver identified the 512 MiB Spansion S34ML04G1 and read matching U-Boot and kernel samples from RAM. It returned to the installed OpenWrt with all partitions read-only. I tested the v9 driver from a Linux 6.18 RAM kernel on Almond+ with one isolated spare eraseblock writable per run. Hardware Hamming, software Hamming in SmartMedia order, and ECC_NONE each passed page writes and reads, erase verification, auto OOB and raw data/OOB. Both Hamming modes corrected a single changed bit. ECC_NONE returned the changed byte without correction. Each test restored the original erase-counter header and verified that the remaining pages were erased. The hardware Hamming run returned to the installed OpenWrt. The software Hamming and ECC_NONE runs returned automatically to the original USB Debian, where the full raw eraseblock hashes, including OOB, matched the pre-test reads. --- Changes in v9: - Keep the shared flash interface out of reset without pulsing it. Validate the chip-select child first and reset the local NAND FSM. - Reset the local FSM on controller and Hamming timeouts. Avoid advertising panic writes, relax sleepable poll intervals and keep both bounded PIO deadlines. - Handle target-less checks without advertising unsupported cache reads. - Restrict NAND children to the two chip selects and omit the deprecated ECC-mode property from the binding example. - Link to v8: https://patch.msgid.link/20261204-b4-cs7542-nand-v8-0-bb068644f71f@gmail.com Changes in v8: - Use the NAND operation parser and transfer data directly to and from the caller's buffers. - Reject unsupported transfers before programming the controller. - Reset the controller and program its default asynchronous timing. - Keep controller-supplied raw page callbacks in the NAND core for ECC_NONE. Disable on-host ECC for software ECC and NONE. Keep the geometry checks and the full-page write constraint local to on-host Hamming. - Use the standard MTD name and remove informational probe messages. - Link to v7: https://patch.msgid.link/20261202-b4-cs7542-nand-v7-0-81d3ed341c77@gmail.com Changes in v7: - Keep the 100 ms PIO transfer budget independent of NAND WAITRDY. - Use time-based tight polling for generic PIO completion. - Reproduce the v6 regression and check full parameter and page reads, readiness errors and a stuck request in mocked MMIO; compile the affected ARM object for Linux and OpenWrt. - Share the 100 ms transfer budget across Hamming page data and OOB. Keep separate ECC and ready/busy waits, and the per-word stall limit. - Treat a cleared request bit on the final word as completion. Cover expiry at the boundary, a delayed observation of completion and a final request still pending at the deadline in the MMIO model. - Before the final-word change, the driver in an OpenWrt RAM kernel on Almond+ matched ECC data and raw/generic OOB for 128 pages across all four banks, with all MTD partitions read-only. The watchdog returned to OpenWrt. The Hamming write and timeout faults were tested in MMIO mocks with GCC and Clang. - Link to v6: https://patch.msgid.link/20261201-b4-cs7542-nand-v6-0-e6b0d712745b@gmail.com Changes in v6: - Bound each PIO transfer with one deadline and preserve the cached read position when rejecting a change-column request. - Link to v5: https://patch.msgid.link/20261127-b4-cs7542-nand-v5-0-45b1a92bd13d@gmail.com 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: Miquel Raynal To: Richard Weinberger To: Vignesh Raghavendra To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Fil Dunsky To: Philipp Zabel Cc: linux-mtd@lists.infradead.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- Fil Dunsky (4): mtd: rawnand: Honor controller raw page callbacks in ECC_NONE 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 | 11 + drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/cs752x_nand.c | 766 +++++++++++++++++++++ drivers/mtd/nand/raw/nand_base.c | 10 +- 6 files changed, 881 insertions(+), 4 deletions(-) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-nand-87997e300079 Best regards, -- Fil Dunsky