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=1796393052; b=oghLxZ7prX5rIema2CwQHL6WAVPAZ+icBPaYr62Gy6mZ/EArc/yw1onkIwAKGHHpU+oc zVA14kF8WaOG8eEabks/RQgcni9BrE5+YJsrLZBcpAHT9gNbC+/r1dE7OKT/yD8cMG+Ft xvxn0JqWzx9Et13+ljZoYOTL+zpAOrwfE6zKDhw9Ycf8OWB1RWl6dC7dy/oBDT23XGOtx NFR9kaKoj4J7j52l7fTohZt//+jHKlMojXoR2i6fbaMQSKzPuf7HqNaupl2DA7DFq7cqQ VvIduVF7dY/FfqJtajC51inc3OIwbrOvK8IjnMNsfKh6ihMDvMQeskYCAeSw8Ec8fQA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796393052; 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=7TiPoioofyB3rU9BCnNflx3wkSFSMBy3oCNzp4c4rk4=; b=Ykr6TdH0AJFYPDVVy1bYy5dqoV/6ciM/CL/BnbhqBk8O4vAblKdA8aE7ykR293TNxCcB VBuxIs1CbU2j0pshuaRFXxs9cRU0Yf2lkmLr8FYUPH4fjETfAcAxTHS02+gwVorTPsbR4 gXH1AsdSEijrEEBXA4730rXLnZE+l4IOBQFA0mcF/1OmxAFEQ3oDWCtDJLyPLC4rO+Owo +XkQSa63KRMnB7ttKWFBR51kL0Uk7Myv7dNKxJX+iqPSmqx7Fa4jHc9zE5WzInUT5H3+A 2g5VI/4rSlVYa1KS4tnv06KWR8wc9Y/6BAz/H7E4UXvGVXQdALKUjZclF1uV07ro6JA== 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=R3JKUoiv; 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 14B7C606A688; Fri, 4 Dec 2026 14:04:12 +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=R3JKUoiv 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=1796393051; b=2ef0nH/GCK1FNryi+dmO0H8meaK2rbV7C3Y+ww9tlTXc6oMW9cPGrBZCaLQ26m5LtaTI hTFMqn2wIPTvmtJF4z5SQC9co2ouZEzM40YWtQoNoeh0Mjhq/M/cFUksDSKqJSQFIfuxB lBP0N5atvv+MoHhr8iOtUTNxG3x9VaBZ99dUTfLwe5OS5wRrR/KRfcToFj6Izmnn/AHw2 vTD+lOIWARJiNhUGsc+OL/vmPOPduLxUu8T/F1aOyZBhROiAp4eVmvxTegFh3TBWnexKV LHevSdETMvmCKTBoVWdvcwuHX6JzCBozQQ7TojC/62Zv8mCuh7BVInkf0Lnaw9NfOJQ== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796393051; 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=7TiPoioofyB3rU9BCnNflx3wkSFSMBy3oCNzp4c4rk4=; b=lXEapNbGKrOVFaNvsAEegSULeTeRKMxEGKkeashdGAAGJmCXbEYphlaV/QWP7Of71ZIs I1xFOHvmRTEXbi2ZXaTMZEre8iGKV+yfWAfrJVvkgtI+bp3mtVFNFYNyu35fSzXmgn53r /za15wO6ABiGI2C6G77YMJZ6TnLpObT/rb6Xl2oh5Nae2EjvrWWOcVisJXVOOD30gjJTk uYmDPpV+R676Md+2QJUn7GH7fyW5/fdDzX5VvfpwCIuxBU1BvPBSMfF4vxBOpqf8uT9xX lyXeOptgKCJvaDeXUEfKkp46lnii2SCJmPAkzurAdy3zkP2JiEbFfXakMHUMClECrBg== 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 3D1131F00931; Fri, 4 Dec 2026 14:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796393051; bh=7TiPoioofyB3rU9BCnNflx3wkSFSMBy3oCNzp4c4rk4=; h=From:Subject:Date:To:Cc:Reply-To; b=R3JKUoivY2QXi5oDWLkdq8qdvTsaeHUh11DjrCdYA1+qvI/tfOQSOQaN5KbOZwXxP JTtIvAxrNk7zncFBUxP1/IpIITjrvHYOepsroveq0yQubnJZBuWusHOqpnEAoyJra1 dgcIbVIPksvWU4cPhAMnjO1gPkN2B47dbjEt32fRHZJP5Nc82L6DHWSIkgh7jcI/85 t16lDg+9uj/3n9jl8i4B7cj5g90omr0heIr/NZsQ1AjAKk2ZN+iY1DdR4yP+0AWAFH wu/pzkLJOABKAY1N6/umOLJjmczN+0GNSzlqXEluH8LzjmutL/9bU2mY0pbie6g6ua QnVj5R0P4BxvA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id AE71C4DB14; Fri, 4 Dec 2026 14:03:53 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v8 0/4] Add Cortina Systems CS7542 NAND controller support Date: Fri, 04 Dec 2026 17:03:52 +0300 Message-Id: <20261204-b4-cs7542-nand-v8-0-bb068644f71f@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/33PwU7EIBDG8VfZcBYzA5SBPfkexkOB6S7GbU1ZG 82m7y5dDzZt9Pgl8/sTbqLwmLmI4+EmRp5yyUNfh3s4iHhu+xPLnOoWCpRFVFoGI2OhxijZt32 Sjrwn1gBAXlT0PnKXP+/B55efXT7CK8frUlkuzrlch/Hr/uKEy92f8QklSIqM5CMgsno6Xdr89 hiHi1jik/qfq8p98h04C67RZsv1mjc7riuHYBMajAiKt9ysud1xU7l2bJzrbOcCbnmz5rTjTeW mCdh6FRLqtOX2lyvAHbeVsw2QqMZrZ8tpzdWOU+UOk+ak6++J1nye528t/i0+OAIAAA== X-Change-ID: 20261123-b4-cs7542-nand-87997e300079 To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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=1796393032; l=5025; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=Nv3N+JsyP4Rt8Luc8hx5e2Gdd2/9due2oxd6Kbix0G8=; b=CwopbCCqCjqWUNjtyR5qBD0LJesGROY4SbjVIGKAvj2d4HZIfEIu6cL/o7OUtRAzlpCr9mtqV i0cW/FbzvkMC5ujIOtuY27SrFyKImlfCpoPYSDTfcR8BakJPcJyT20U 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 also used one isolated spare physical eraseblock per ECC mode on Almond+. Hardware Hamming, software Hamming and ECC_NONE each passed page writes and reads, erase verification, auto OOB and raw data/OOB. The Hamming modes corrected an injected single-bit change. ECC_NONE returned the altered byte without correction. Each test restored the original UBI erase-counter header and left the rest of the block erased, then returned to OpenWrt with the five UBI volumes intact. --- 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 --- 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 | 89 +++ MAINTAINERS | 7 + drivers/mtd/nand/raw/Kconfig | 11 + drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/cs752x_nand.c | 756 +++++++++++++++++++++ drivers/mtd/nand/raw/nand_base.c | 10 +- 6 files changed, 870 insertions(+), 4 deletions(-) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-nand-87997e300079 Best regards, -- Fil Dunsky