From patchwork Sun Sep 13 04:04:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3296 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 84C5C1C2CE2 for ; Sun, 13 Sep 2026 06:08:26 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-25845-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-25845-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 14B5E3B0E9 for ; Sun, 13 Sep 2026 04:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E97C338737E; Sun, 13 Sep 2026 04:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W3l1113F" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 004BE19C54E for ; Sun, 13 Sep 2026 04:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789272322; cv=none; b=Bf+3Zi68kNWihdM32qTWTCJw5tRhxTE70fNa7hBbVDDMqV5ARkTs70ccF9dOq+b82+K647YNOG10Qh4jPA7DFItdn6Dz2Xcu1wkokGdAyazzz3rTBLdWyJDcmZ0hA0GEvWXxjrq8kR5YCnUkW8GVLfB987MnWn/5zdyRDZebq0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789272322; c=relaxed/simple; bh=6QXvhJNkBJWcV5Ntyx9Vdimd7EE2MpJdJCkLfrX8lRo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k1mwezqcgJbBzEXWcyZQUitaatFELwCO6J5IfZJW7MniP8UPXJEDzYVHu6Vh5pXSW5wzqTezb2fG+jzKscV9+W6fQ2NVZwrAEsIvJEVu0rlw5BFLddSo9ukvQEtr/jiAOFV/k9uGpzdFTvZ06VmjKk6tv8inBzVNLIRhw4oiDso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W3l1113F; arc=none smtp.client-ip=209.85.160.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-478622cd851so1000188fac.1 for ; Sat, 12 Sep 2026 21:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789272318; x=1789877118; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hb1UAgJ8R3xqyuxnkYr/GKcQBuP99rDSmeFz/RErrU8=; b=W3l1113FuTjB21E9zbZZvoyKtklCKy0RoNEkkzJEcb/Ho02/5uJVwicsrxJFot1+E7 vEgkMwx3JbR0Fv47m+hkRHe+hXLaWEy+zZpIVyDVSZ9o2kQxBKPJEespB1fFiNr8pgan tlm5MwDBQ05PH6pJgvN6FSubdmWNN2xjfOk/EH5UiPRsQ0GyJqhL6bxhM1wrPhVd3jLN uGfkrwvIqEcTJVOMdUbflqrfwbVg5DNCll8hnqTpWsOopleQEVof/L9uM1cJNKH44Vj+ 9Oi9/xef1X8WJUVbSeRbte/Bk5ALbL0ptDfRkD3HHPJ0bTi8n3jSIYrQyV/6ENRx30zX oZbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789272318; x=1789877118; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hb1UAgJ8R3xqyuxnkYr/GKcQBuP99rDSmeFz/RErrU8=; b=o69wM3tcXS0mjiCFA2gIjDgQ0rAlT3UFE3RmAkc+ZrcbvefrHkRQ27obd5n2LVMMuI wMZGZ6N5avfR6WXVXcYg+DfGir3T49fkdXpUojANGBk6Bu/UAcDxmDcV2DLm2AwHBWKZ K5AE5P5TPv7pEwEHH8xR7p4yO/BNovJLdQUPI4xS6KyeJIt5ZIyfHs2ozorjLOPekXzf ZhFZhBgkqZ9NMKu/0zE0Y1wEiNWbzmlIcWIUC3FceNgwX/fqfNyFZuij4JD1398KgQs7 Q/dCL0HfDXPv4IHfr24b5CKjktTkaNJ17MGMr51eW3V+Sf3jbQIWPQ9QhIHHajEXL/MT bS6g== X-Forwarded-Encrypted: i=1; AKwUvByyYLOL9VAHSdX09wX0xC/FeTILYQwP4x7umMAvdeub23VPwYDGxWULk2dON1RQ76j04/Ns7Fl2NjtBUA==@lists.linux.dev X-Gm-Message-State: AFuF++kdnf6fikO+uW/tVd7otDhoKpyp9m0CD4C00h7FahLmsRi1Zb6h uz8epKYni8OQSUl8rCG2tEK/FySQ8hxVjWckn64l2QHwTsB/P/xrGJ3j X-Gm-Gg: AYBFou1FmhelTbGQ2vD83VSGxIqQw4+M7IsVxkJgeuDE8tcaUXq5gnXb0q8fmFLVOpM OIkZa6xCqqFzj3IZyPwlMkSEAYmfn78+PDklpE6kL1dRJ7rTf+U/9FTyvr6/IpdOKcjTqZ0zn5W 9XC+rtkyMvUo/tIcycZEXXcXsUY8EUNr08pLRlSkTi9/aBDb3hAI0sT94zG7kI860AVq/6WuilS 89a/VoO0C/eY2WSaqD1u95kod7fPOKLUdmUvfvTg4/cjsc/eRihNxxU8R8iYNs8ga5DuHqVvpV6 MRKAViS2aSR0pzeamBep4rM3El3gQLACTYG1QfinD0+c1FfGM6Do736QKvBDLeVON15KUXixNyr d0LjeHaKcawzDvXCVfBR5/mqYnxPhSsTPHN/ZnPoHZDFQlFPmKgyOqMjjj4KxwndG4kpGgXNfXj buCELn2uIFqWDfuiWAY5e7YyL9eRZaUiuEMkvwhjoM3SFMVGZCG+ZTvKFtSebHm9iqfTX0A6HK5 HrGb9Log0lacwDlhXr9R3wTKQ/a4+bGbn3aDRzNOi/5iu/B24yktcPNetslB5ChWYrr6vdGop49 71/Ubsm/zGxGWph7otXZg2McYA1Gf9GR33sEoOa4YwCEHESkpHf/JnlsQ9MNXAJLEm+CQoPlBrx ILEp9qTfJplJ3WTv5Q/8Xs9RqLUWbGONneWNA+qe3 X-Received: by 2002:a05:6870:8306:b0:469:fb51:b351 with SMTP id 586e51a60fabf-47de8fd0c3fmr7839424fac.17.1789272317809; Sat, 12 Sep 2026 21:05:17 -0700 (PDT) Received: from [127.0.1.1] (184-96-157-145.hlrn.qwest.net. [184.96.157.145]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-47df8699647sm6011535fac.5.2026.09.12.21.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2026 21:05:17 -0700 (PDT) From: James Hilliard Date: Sat, 12 Sep 2026 22:04:58 -0600 Subject: [PATCH v4 07/17] mtd: rawnand: sunxi: avoid a second program confirm for OOB writes Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260912-submit-sunxi-nand-vendor-oob-layout-v1-v4-7-4a64bed94229@gmail.com> References: <20260912-submit-sunxi-nand-vendor-oob-layout-v1-v4-0-4a64bed94229@gmail.com> In-Reply-To: <20260912-submit-sunxi-nand-vendor-oob-layout-v1-v4-0-4a64bed94229@gmail.com> To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maxime Ripard , Richard Genoud , Masahiro Yamada , Boris Brezillon , Brian Norris Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, James Hilliard X-Mailer: b4 0.15.2 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-1.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; FREEMAIL_CC(0.00)[lists.infradead.org,vger.kernel.org,lists.linux.dev,gmail.com]; FORGED_SENDER_MAILLIST(0.00)[]; RCPT_COUNT_TWELVE(0.00)[20]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[dt]; PRECEDENCE_BULK(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[jameshilliard1@gmail.com,linux-sunxi@lists.linux.dev]; TAGGED_FROM(0.00)[bounces-25845-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10]; FREEMAIL_TO(0.00)[bootlin.com,nod.at,ti.com,kernel.org,gmail.com,sholland.org,socionext.com]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 84C5C1C2CE2 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The hardware-ECC OOB writer delegates to the page writer, which already issues PAGEPROG, waits for completion and checks the NAND status. The OOB wrapper then calls nand_prog_page_end_op() again, sending an extra program confirm without a corresponding program setup. An error on this redundant operation is returned even though the page writer has already succeeded. Return the page writer's result directly. This leaves both PIO and DMA responsible for completing their own program operation and preserves their error results, including for bad-block-marker writes. Fixes: 25f815f66a14 ("mtd: nand: force drivers to explicitly send READ/PROG commands") Signed-off-by: James Hilliard --- drivers/mtd/nand/raw/sunxi_nand.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index 72b79f893e29..41d6560d7df7 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -1843,15 +1843,10 @@ static int sunxi_nfc_hw_ecc_write_oob(struct nand_chip *nand, int page) { struct mtd_info *mtd = nand_to_mtd(nand); u8 *buf = nand_get_data_buf(nand); - int ret; memset(buf, 0xff, mtd->writesize); - ret = nand->ecc.write_page(nand, buf, 1, page); - if (ret) - return ret; - /* Send command to program the OOB data */ - return nand_prog_page_end_op(nand); + return nand->ecc.write_page(nand, buf, 1, page); } static const struct sunxi_nfc_timings sun4i_a10_nfc_timings = {