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=1796194224; b=43j/+oHGn0E716FQXXirUarhspDP31TSJl9S+/vNZNVzdhJs35VAWpn3nzHgYmdUI/qu Bqu0/6tWdGLQR+yuiQZS29Nz6lJ6dCYAObZR/UefPWutoqGxLThe5bPzfj0mQ7bRCXA9g 1rPVD4k9PsRcx9ugN5ZmcapHHgMgtSFvO1ym9pZA25woXgzOMBhQcVbivMaFry3YySXRC i3o4f1w2hGc53ed4fhkeUrSzQDt6FIstLSy7xJXuKJQFSXtF7FUM351zOr7iSGr2sVvfv Iwjq0v4VQ851yjYrUi43MYEI3ZEVIeYCDexUt3xte9HIsQ55NSMkN9R2ovFSY8qXRew== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796194224; 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=gSo62BH3GQEyqIaS3sqc3DbMA28slTETiuCBYZHf2uY=; b=xroPm9OuMwFZPKHhhCLGh2M1vvxT9WLHoQ7Ju2OlL/QHojeC+aVb+WrOZ8dCwn/OUf3T vtVAKrlsdgLKEAey8UzA6CAqRmdXMa9l7Sfy59mqc9qnjRPOZUUk/rUGZQN2rRFSkDsT/ AnFb+KzdmpJQbUwkahBO2K6nLrsBEPeODQe2VaZqwP56+kNB9M8fS2Fp3S/PEn6Kd/mlu HNW413sMh86FzLm5kE/3x1dZ8t4HqCPO5Wd9il9H9Ax+HoZNSsxSHmZJVetEdKMTSwF59 wtw8hYSFjCw5xs24qZJilHFictkn4r7SFXhiIC4aA6amV8urSmLYhEHUWI8GE0UqsOg== 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=VqK03JvC; 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 0BDDF606A329; Wed, 2 Dec 2026 06:50:23 +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=VqK03JvC 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=1796194223; b=C7rwBY8iBbVIcwM4yjBc5/u/Y8X9T1UusURE2dLOf6QHl6h33ROrfw5oMNp426zU8DOt Yswr3hqks/EjDq+NglooV4X6EinUpqIBUnFe0HVBkezkP2sweTM2Um+PUFNomB/234Nka 0EJkD30pWvaW+lN8PgV2WzvxL8ihj1KnJVgutUq67HxCAhrxo62cC0cKJFG71Z3lZWNzN w5VC2duCCsSm4r1Gd4ndhNuc8uDKpt0ysYzVEc7cPbLObuuG0u2qmF561XaHrWFpArw/O kSzh3cD9LM07WSW4K/+3uAoYCugiFlfRa9f9dEUtqI/gOIFM6Vfqmbid+KUhlTxJSIQ== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796194223; 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=gSo62BH3GQEyqIaS3sqc3DbMA28slTETiuCBYZHf2uY=; b=ZL31UTkr7lHTNzvyi3ZjmimiwEK6VO7Zi3n67kJFE3yHyFv/KE0pgTOpqIAMVdnjX0jt XBJP6J8vyPSbu4u7L7Tb+L2iRgPPdjtNfoMd3Wl2wbL7afhSW1/2z8lvoWBMVOkX4Tepp F45d+0lRf1SOS1PS81KN14zLfseI0NYMUehy0TKWrGI5aeFaEwso6PijY5rHT913yqV9y eCyeM7INWk6+q+LdbWZX7htTAyijMOki1i2uIcOrKfl2B9+YXbnqibyuFZfNz9XBNsgkK G3zuXte6sRQE2B8i8y6AoI2RbNns8mGgvnzj1moBWWfbs1rq7AF1xvQ35YO4iQbhg7g== 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 8D9701F000C1; Wed, 2 Dec 2026 06:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796194223; bh=gSo62BH3GQEyqIaS3sqc3DbMA28slTETiuCBYZHf2uY=; h=From:Subject:Date:To:Cc:Reply-To; b=VqK03JvC/iNKJRV8Sp6xXdB+belhc71cvqq/sFP4rLq+cmDeaYLQdhHJHv7pw9R+e rG6dXdWtgyH04ONpwIakGq0JdSxpYH8ugOZPLTANeunvg6tlypMK3xdWAJooXgVSYX PDnJj2EbarNGQ9Em1tQa6WQ6DjE8wfiW4XpqfqnOTDa0sASE6IQEGf5G8Ei/5N3ZHP 7+tBQa63nciLmMJhnqyTKpXEiWViZhd+CbXnp+1tm7nGOPGTed1n50u7wGedHapAV2 kQ+33SIaMuDoXU9830BB0HlTq4y6kbW9+k79zu/8KL/LrhDPxqwixSL8XVsAlDusyw 8zvAVP9IUtgYQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id E2C0C4F2AF; Wed, 2 Dec 2026 06:50:15 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v7 0/3] Add Cortina Systems CS7542 NAND controller support Date: Wed, 02 Dec 2026 09:50:01 +0300 Message-Id: <20261202-b4-cs7542-nand-v7-0-81d3ed341c77@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/33NTWrDMBCG4asEraswo39l1XuULixpnKg0drFS0 xB898jJosamXX4wzzs3VmjIVNhhd2MDjbnkvqvDvuxYPDXdkXhOdTMBwiAKyYPisVitBO+aLnF nvbckAcB6VtHXQG3+eQTf3p+7fIcPipe5Ml+ccrn0w/XxccT57s/4iBy4jYTWR0Ak8Xo8N/lzH /szm+Oj+J+Lyn3yLTgDTku15nLJ9YbLyiGYhAojgqA1V0tuNlxVLh0p51rTuoBrrpfcbriuXOm AjRchoUxrbn65ANxwUzmZAMnWeO0s+TRNdz0hUon5AQAA 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=1796194214; l=6664; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=P9yRmOV1VuuoO5fagEpf+P8vVrVfFYKZQEJWg+ZugBE=; b=7r5qnymdYeLooX2YpwJQeSogsxkddpQwL+zHp0f2mffryO8x3hfz1M36nFenYqZ0bE6nPyFDi FoboOObUGryD0kW9RVZOAIkPWaBlKPGm0NZqysfwToGh25QYwx1Yiqc 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 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 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: Fil Dunsky To: Miquel Raynal To: Richard Weinberger To: Vignesh Raghavendra To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Philipp Zabel 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 | 767 +++++++++++++++++++++ 5 files changed, 877 insertions(+) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-nand-87997e300079 Best regards, -- Fil Dunsky