From patchwork Sat Nov 21 01:10:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 4222 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 1A9581C5D65 for ; Sat, 21 Nov 2026 02:13:09 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-27965-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-27965-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 2167B801C5 for ; Sat, 21 Nov 2026 01:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795223500; b=wsD2djohCkMGbeTZfIrlS4ouSLWHJ+IJLTx7CaWJV55tWS5qAhq70X1JQvesrTDbuY0z Z7MYg8V5hLdgD8BCRmuikgNoqAMWyMdXf5isN756JyVQzWRlS8PIiGpRgkyoNL4fcRRhg 6o9hm9gbMYdP6JCUjqvJE8sRyBEwAVVx6Zt/1fbg4wT71xMech5JAKRPi17trbi2ujrL0 MeBgRaB1fislp4XWdAO2nf0nehVKGE99Lb1dDwCsYkkgp8MeytqZRW4t/PZq3VZwxson+ /jOCYdWaovfEu4V+ea/KWauTjro6Bob4pjfDA4rMvD4xGBCXxpcnUYyJP0k16PQH4fA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795223500; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State: X-Gm-Gg:X-Received:Received:From:Date:Subject:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=3n0HsVfrCilvrywczliXObPQ3Hlxg0mpvZCNssFAoKg=; b=jgFD79ZU0AESN1DxNj3/sUTzPY38peXlUnMhPX5KcT5kLcdQDd1bbjfNFN3bZirIB62u Ch1MFMC7k334XfHtdl6FjEYZjVhP/GNfeu96/D4a+lRbymtWUyHGKhBimWLNxozxmThHz zpyPRH9LajPQhZLZ9lU/gH9jEC0w4Jjzf00cvcox+TEgZ81ebtp39cvjnEv7oOwuwBHBu e3xl8ZSwpEM4+qYUEA+6lzC9c8deS0FfOaG6QbRpmFY+b1wFyhSud1mzMb4S90PrTkDDX FxB8OTkTVyYOCW0VwbCmVpBBrME6lHfgI0Ug35yyYaYuRI1WVNDWpGwC9/DG73gNeLw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="c/6qSJIa"; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CE2460A2609; Sat, 21 Nov 2026 01:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=c/6qSJIa X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795223500; b=3GgtI9NzfsFNr4GHqSN3CKZszKKU0XVKdlCdNBwC2xReJim6YMY3C9F6cge4nErWfeOI eFQCQo9T4G+ZH4Xi3OEdfvxs2tCT8vn8zqpsVFt3I712hcAz4i/U7eXjIB/zQzlPIMizr KUVUyt6pRwe+GdAZ9Yj1jS/N49KDEJAOP32r4aVunRHa5uJFwdiZD6Lm+NAWEgpckI4Cr /BXdAmfaUO/ZQK2rkIClUYMA7aZzmJPmXlMu0vgHZUTxCRWXknBWkjPlzbmIVM8Pga8R0 83gxqhetKc3vGMXQ6C/tdVMEpJ1fSvzVRSGHWmJcLmL5TVjwuXHlxE09y5FjM6s96rQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795223500; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=3n0HsVfrCilvrywczliXObPQ3Hlxg0mpvZCNssFAoKg=; b=DoksfQhQKCWIjtIdkZHCwkskS9L7IcSpf8jPdoRi0+NtoAVrzdZGdrijaXJbtBIPESq/ XTMj8ouLSVioBDsqp/i10glizhDNtupK30LnCMvvrzVwL+4QqB9nW0Nvk0x3I8MBmo0lD JWW8y0d/gT+RH9x63TuxoscFHq8vcD5NL2FgonBm0HRoCju+fOwBz2eR0tFpcUSh1AicH HwUFAIm9mToYa3z5Nq8IORyuOkLQ64rSUylyiSxuAj5lVZUewOgrDldltRbk4UZVctgUM UaushQNWyxo6bP1SQIqTEdhNy8MXPQOtfwDNXLodB8fFoZUhbCIY2+2UdFgIdTOIANg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="c/6qSJIa"; arc=none smtp.remote-ip=209.85.167.170 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81212606C518 for ; Sat, 21 Nov 2026 01:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 81212606C518 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-oi1-f170.google.com with SMTP id 5614622812f47-57728d859e9so756084b6e.1 for ; Fri, 20 Nov 2026 17:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795223492; x=1795828292; 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=3n0HsVfrCilvrywczliXObPQ3Hlxg0mpvZCNssFAoKg=; b=c/6qSJIaA1m3ElVZwZ1AP7RuG5lHj/3VH+jeSCq3iEzpVZ3D0fEO3/28iBpkWXlGKo 8aVeaH6SHj/XN3kZ8mXrg9L5bh1sPjMQnxAEcpXEd7OYXM5vrUz0TcKsJc599NCvjCrd Un/ZT9o0eqj/CVZq+Z1UgWKzd+5KAF+3Cr5AUxqH7ccjyOB/sITF1gRjiX8lY15abXYn 0dunSI6oCdU2mSVT+IlQZn+14GX3FGKqfvVSsHs42nxtlNFA8AgFjhCe0uK0VufZ3VaZ WqV6jT/r8HBNo1IXibGp9+SEMfJKSJa5zP7sehzlQiTbICSjJq9EmK6D1zIUiVVAiEhQ jI5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795223492; x=1795828292; 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=3n0HsVfrCilvrywczliXObPQ3Hlxg0mpvZCNssFAoKg=; b=YCXfL+nOE3RmM+TCrq45vwKZt+WHVhF7HeHGgit1n5+ckGq6Js2iW11+kwY5WncucC hJFKRQY++FjndDt//B07m50J/MyFSwUz1FGdVJ81qp2RJFSFcZXM6j/8odqsugXgnfjd yItf/1nwfDa2p9/8pHPKGUPCqnbHm/sl9bUeeXFKMOQoujDWV4rDa6vRYht+3AZOoGI/ 6fUd/grXlVIA866BUpmSDMb12HlAXUCwykB2XWPo9GAi70YOZ0FZMIR3XFwDqyhkW+uy ra8+bKlIbMZ4SRSEKDDc30KHQmAWKGdzs2IJiLJIxF0m9iW7a00TAPNkWSU5UhaiTUVT gWVQ== X-Forwarded-Encrypted: i=1; AL+hErEAKJ3ILE3SYdHlYh0iRsk7GWQv1XDGMitfXXR9eaDxgBaewHAk3sZA8gagLoYcwASxu4QuBEm8YasCZQ==@lists.linux.dev X-Gm-Message-State: APuU4Z8DOIZChNpZ0KXtfzraaV3hy5zJkfzcRzJNUcQUC5dqZlawCph4 uXHCqHPkhiO742mV3xegHdbPWGaCZGt+phfiL5ykHBAXWFpO9EEmhaTD X-Gm-Gg: AYBFou1zpSwFKEXBCF0SENoVvO/jlZ9mVC3QbCDqETBpRZowj9km2raIZLmYYXZ4ZPe fIyrmK0RcKNTCMTdzezBgCOM8N4F5wMoTkZT40y+lZs72NUFH1ANUNGMf0k5ehnogh1UP63kmUF hFWI2ifCAVX7QQUZDCdehBVuTsfPMnhJnTHLuZ5omK9RzQdvVTJrlFtz3F/lzewvMFFDQ6zxyar LFGglp75fHp3aDXz0ban1OAHSwQxWB/2VCAP+F3fK6+2PzvDxtPqF2ewUAWzLble7T86g9zta6t gyzJ0LgqmxCNe1qLadWa2kxM4fWKMP3O6zFmFDUdIG6l6l0fPDMd+nnjwUslGztT42OwHY8yfrK IA2VO7sktOz38WFYLe7CKMBsSp/SP8MLg7L3y7izVvTSKAyeGDO1P/2D/dp5W1beFWD5YZlQj04 MGjX22WvPJxiw1GbOT7L5leLSSek6u+v1zQ4Pk/CL2abD29ri+ZIPAozt2VIAyz3kIa8R7tD3wS VzsMSO6hX12XjQwg17X9glaswmm0x1oI/tRUqft3fwtaJ35IBNG2V4unT3zb0XimsUJUBcndNgs se2+4+/OVomuPKVG4hTk6bP9F5FI9qL1SMxfaAOw8pRgTTxc4iMSPUoaVTBNyg14sQ77cBeNsYb UhdXbCkuXp+6LwImgigr64DCA+9XNQ+qC8hlwPgl5vS1fq41Y23FQAsN2594K5ZFpaXd1Hr6Idf I04kNeHZB6EiISttcU0Ms7OWvP6cy9Ncm2b4/cdBIuZexAd9AsT+j2 X-Received: by 2002:a05:6808:508f:b0:576:1161:cfeb with SMTP id 5614622812f47-57a0d4ed405mr6123275b6e.66.1795223492380; Fri, 20 Nov 2026 17:11:32 -0800 (PST) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a3485e3ecsm3291532b6e.9.2026.11.20.17.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 17:11:31 -0800 (PST) From: James Hilliard Date: Fri, 20 Nov 2026 18:10:49 -0700 Subject: [PATCH v11 26/26] mtd: rawnand: sunxi: reduce user-data length register accesses X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-Id: <20261120-submit-sunxi-nand-vendor-oob-layout-v1-v11-26-9721b1905ef4@gmail.com> References: <20261120-submit-sunxi-nand-vendor-oob-layout-v1-v11-0-9721b1905ef4@gmail.com> In-Reply-To: <20261120-submit-sunxi-nand-vendor-oob-layout-v1-v11-0-9721b1905ef4@gmail.com> To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , James Hilliard Cc: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maxime Ripard , Richard Genoud , Boris Brezillon , Masahiro Yamada , Brian Norris , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, devicetree@vger.kernel.org X-Mailer: b4 0.17-dev X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [4.31 / 15.00]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MAILLIST(-0.18)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; TAGGED_RCPT(0.00)[dt]; FROM_HAS_DN(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[25]; FREEMAIL_CC(0.00)[kernel.org,gmail.com,sholland.org,bootlin.com,socionext.com,lists.infradead.org,lists.linux.dev,vger.kernel.org]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:helo,tor.lore.kernel.org:rdns]; FORGED_SENDER_MAILLIST(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-27965-noreply=patchwork.local]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.77.114.92:received,174.29.1.49:received,209.85.167.170:received]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; FREEMAIL_TO(0.00)[bootlin.com,nod.at,ti.com,linutronix.de,kernel.org,goodmis.org,pengutronix.de,gmail.com]; MIME_TRACE(0.00)[0:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from] X-Rspamd-Queue-Id: 1A9581C5D65 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX H6/H616 pack eight ECC steps' user-data length codes into each 32-bit register. DMA currently clears all these registers, then read-modify-writes one field per step, repeatedly accessing the same words. Each code counts four-byte words; zero means no user data. Build each packed value in memory and write it once per DMA batch, including zeros for unused slots. Take each length from the batch's logical step but encode it in the corresponding batch-local hardware slot. Rewrite every register on each batch rather than caching values across resets or changes of chip. Use the same encoder for PIO. Each step writes the first packed word with only slot zero set, so page setup only needs to clear the other words. This also clears stale DMA slots before PIO uses the registers. The lengths and on-flash layout do not change. Signed-off-by: James Hilliard --- drivers/mtd/nand/raw/sunxi_nand.c | 59 ++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index 37f01801cf48..31f995a1f5d8 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -57,7 +57,7 @@ #define NFC_H6_USER_DATA_REGS 32 #define NFC_REG_USER_DATA(nfc, x) (nfc->caps->reg_user_data + ((x) * 4)) #define NFC_REG_H6_USER_DATA_LEN 0x0070 -/* A USER_DATA_LEN register can hold the length of 8 USER_DATA registers */ +/* Each USER_DATA_LEN register holds eight 4-bit ECC-step user-data length codes. */ #define NFC_REG_USER_DATA_LEN_CAPACITY 8 #define NFC_REG_USER_DATA_LEN(nfc, step) \ (nfc->caps->reg_user_data_len + \ @@ -1061,10 +1061,7 @@ static void sunxi_nfc_hw_ecc_get_prot_oob_bytes(struct nand_chip *nand, u8 *oob, sunxi_nfc_randomize_bbm(nand, page, oob); } -/* - * On H6/H6 the user_data length has to be set in specific registers - * before writing. - */ +/* The first PIO step overwrites the first packed word; clear the rest. */ static void sunxi_nfc_reset_user_data_len(struct sunxi_nfc *nfc) { int loop_step = NFC_REG_USER_DATA_LEN_CAPACITY; @@ -1073,7 +1070,7 @@ static void sunxi_nfc_reset_user_data_len(struct sunxi_nfc *nfc) if (!nfc->caps->reg_user_data_len) return; - for (int i = 0; i < nfc->caps->max_ecc_steps; i += loop_step) + for (int i = loop_step; i < nfc->caps->max_ecc_steps; i += loop_step) writel(0, nfc->regs + NFC_REG_USER_DATA_LEN(nfc, i)); } @@ -1088,10 +1085,8 @@ static int sunxi_nfc_user_data_len_code(struct sunxi_nfc *nfc, int len) return len / USER_DATA_SZ; } -static void sunxi_nfc_set_user_data_len(struct sunxi_nfc *nfc, - int len, int step) +static void sunxi_nfc_set_user_data_len_pio(struct sunxi_nfc *nfc, int len) { - u32 val; int code; /* not all SoCs have this register */ @@ -1102,11 +1097,35 @@ static void sunxi_nfc_set_user_data_len(struct sunxi_nfc *nfc, if (code < 0) return; - val = readl(nfc->regs + NFC_REG_USER_DATA_LEN(nfc, step)); + /* PIO uses only slot zero. */ + writel(FIELD_PREP(NFC_USER_DATA_LEN_MSK(0), code), + nfc->regs + NFC_REG_USER_DATA_LEN(nfc, 0)); +} + +static void sunxi_nfc_set_user_data_len_dma(struct nand_chip *nand, + int first_step, int nchunks) +{ + struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); + struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); + int first, step, len, code; + u32 val; + + if (!nfc->caps->reg_user_data_len) + return; - val &= ~NFC_USER_DATA_LEN_MSK(step); - val |= field_prep(NFC_USER_DATA_LEN_MSK(step), code); - writel(val, nfc->regs + NFC_REG_USER_DATA_LEN(nfc, step)); + /* Write each packed register once, including zeroes for unused slots. */ + for (first = 0; first < nfc->caps->max_ecc_steps; + first += NFC_REG_USER_DATA_LEN_CAPACITY) { + val = 0; + for (step = first; step < nchunks && + step < first + NFC_REG_USER_DATA_LEN_CAPACITY; step++) { + len = sunxi_nfc_user_data_sz(sunxi_nand, first_step + step); + code = sunxi_nfc_user_data_len_code(nfc, len); + if (code >= 0) + val |= field_prep(NFC_USER_DATA_LEN_MSK(step), code); + } + writel(val, nfc->regs + NFC_REG_USER_DATA_LEN(nfc, first)); + } } static void sunxi_nfc_hw_ecc_set_prot_oob_bytes(struct nand_chip *nand, @@ -1474,7 +1493,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct nand_chip *nand, if (ret) return ret; - sunxi_nfc_set_user_data_len(nfc, user_data_sz, 0); + sunxi_nfc_set_user_data_len_pio(nfc, user_data_sz); sunxi_nfc_randomizer_config(nand, page, false); sunxi_nfc_randomizer_enable(nand); writel(NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ECC_OP, @@ -1503,7 +1522,7 @@ static int sunxi_nfc_hw_ecc_read_batch_dma(struct nand_chip *nand, struct sunxi_nfc_ecc_snapshot snapshot; struct scatterlist sg; int page = read->page; - int ret, i; + int ret; u32 wait; if (first_step) { @@ -1524,10 +1543,7 @@ static int sunxi_nfc_hw_ecc_read_batch_dma(struct nand_chip *nand, return ret; sunxi_nfc_hw_ecc_enable(nand); - sunxi_nfc_reset_user_data_len(nfc); - for (i = 0; i < nchunks; i++) - sunxi_nfc_set_user_data_len(nfc, - sunxi_nfc_user_data_sz(sunxi_nand, first_step + i), i); + sunxi_nfc_set_user_data_len_dma(nand, first_step, nchunks); /* exec_op() restores the page's spare base during column changes. */ if (first_step) writel(mtd->writesize + sunxi_get_oob_offset(sunxi_nand, ecc, first_step), @@ -1645,7 +1661,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct nand_chip *nand, sunxi_nfc_randomizer_config(nand, page, false); sunxi_nfc_randomizer_enable(nand); - sunxi_nfc_set_user_data_len(nfc, user_data_sz, nfc_step); + sunxi_nfc_set_user_data_len_pio(nfc, user_data_sz); sunxi_nfc_hw_ecc_set_prot_oob_bytes(nand, oob, nfc_step, bbm, page, user_data_sz); @@ -1900,7 +1916,7 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *nand, goto pio_fallback; } - sunxi_nfc_reset_user_data_len(nfc); + sunxi_nfc_set_user_data_len_dma(nand, first_step, batch_steps); for (i = first_step; i < first_step + batch_steps; i++) { unsigned int user_data_sz = sunxi_nfc_user_data_sz(sunxi_nand, i); int oob_off = sunxi_get_oob_offset(sunxi_nand, ecc, i); @@ -1908,7 +1924,6 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *nand, sunxi_nfc_hw_ecc_set_prot_oob_bytes(nand, oob, reg_index, !i, page, user_data_sz); - sunxi_nfc_set_user_data_len(nfc, user_data_sz, i - first_step); reg_index += user_data_sz / 4; }