From patchwork Sat Feb 4 14:35:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 4963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1377236wrn; Sat, 4 Feb 2023 06:39:13 -0800 (PST) X-Google-Smtp-Source: AK7set9qXVaj8qC8PkpiacMYZPqiZODf15ptjKRWgUc4UKHaC+6X9GilxSpSMEjZbP1pzvtGR44b X-Received: by 2002:a17:907:6d17:b0:88d:ba89:1843 with SMTP id sa23-20020a1709076d1700b0088dba891843mr10291052ejc.20.1675521553176; Sat, 04 Feb 2023 06:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675521553; cv=none; d=google.com; s=arc-20160816; b=0BbAkjQOK9QsvaPTODgASQbEhpixgLKg6/QOoYZx3vqfIbl8DWsEwCDWvaV1oO95E7 EMheg0MwXpMZjMI/6RiJqgaz8zLTmI8RcwXkDQagactFZvLxF/lxn337McZryN6nQ14U j6BTW7qsqg4EGmUwqIwGTtdWg94EdMSOTLX8VbmbcABFFeRRyziPueBjKR15+SmQaCKW GY7aB2strnbl3meHWfTdc8KvIxZ+E6PgKY2SrPpezbmlaMsi3N358Ik+Z8ywYrP/jW7y IvCfafh8Us3FhGeIUvpajdoXiFGNzE+8slqlmWv8O2j6DCkkJf2MHknlfgKeKDzGRF04 dMiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=xQ+77WxDcU7LsWzVt9+SldMRgmN28mhoYTDjd14rlqg=; b=lAUx+FQYtosv8LvDpGQ6uah6vDvlw4L6iTbnQ8I4qFJIegcLPrERPsXJtTw4cSdUY3 A8n2DBZA8gZKZWDP+oPpakbZlKliHDYkX7YxnV96k/cTKVzJmo5uODhCIC+k50JImkSq ck3gl3sycdf+MBVB/1x2h/+X7VnNfhrgZZqu6F35XiiMz/5WiqmxG0d+IYiub1XdoVv5 csT3D232jd4xiqn69LrTtlkty3SnKv+3he+4I5gdcWj7BbnVfRZcPw0CPWZwnBhpaPAU BVa+3WvXPza3B1kvJ6fd1tTC1JrO2+/c/d4c1C+lmf8KNl2TvPd4lqPHdBqpcdpeijKD J2uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=c2Gy5mL8; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=m1hnD1sV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a17090600d700b0087b6bbbcfcdsi7388585eji.326.2023.02.04.06.38.49; Sat, 04 Feb 2023 06:39:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=c2Gy5mL8; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=m1hnD1sV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbjBDOf7 (ORCPT + 99 others); Sat, 4 Feb 2023 09:35:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233860AbjBDOfm (ORCPT ); Sat, 4 Feb 2023 09:35:42 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134BF303C6 for ; Sat, 4 Feb 2023 06:35:19 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9AF2D5C00B2; Sat, 4 Feb 2023 09:35:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 04 Feb 2023 09:35:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t=1675521317; x=1675607717; bh=xQ+77WxDcU7LsWzVt9+SldMRg mN28mhoYTDjd14rlqg=; b=c2Gy5mL8aq4qjm1aNmxy7JKWI4UbVsp0hyXDTUzTm MyQaPxKUoj0InfI4ZV+ieo0UgxFbz4EMIInGLkiD1jceqbooJDtSh4dYZ0GDGXY+ 4t8HjczBkrTWZBUwXKHaU+CxyN3nXueJ77CYA2yEE0eNABnczgl7d/tVnuMeiRmY kvgphu32n30p0xoiU+AjFmzEU39NF7c9pDLcBpe8wKEqVauoN0Qib2ppPy79P/bo UePQyJrIqZlYhVF8SSMyOrl0UzqsdfJjwe/iC1jpSfH1O+0pa5mBBS5eFlSMovZH xIXGM7le/yKBIRxyRqH1ESvsrSKuhe3tLI1c5TCZ9/QvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1675521317; x=1675607717; bh=xQ+77WxDcU7LsWzVt9+SldMRgmN28mhoYTD jd14rlqg=; b=m1hnD1sVpWB0RRFfS/7k2abqgp8vWLdoimv5XrWE7sRHRoe3ohA RlN4Q5EJnKzRkNK4aE1xw3XOby4F2g7YZxKHa6PVm79KWgYYcVUjx7l6jrLgxxob JWK/MKD8RAAt0YdnT/79kl8N9f3zJB24YxjsMNKxoBtYdSXUHmyjhVDH65JM6dgr rQAPUo2XgTIru2I/3fZsyoL8hZOuK8rCBennjEVBPNlEHOOloP3cWJyaGdQz1tC0 kyzUdeS+lRMd+YNbExAiwJqnEX38wP4aYBj+2lVw9hScS6SNNx23yOWWCRVMa3f+ Y8ykhSSRJe2nmIDXqT8zVVU80n+z0pNTxQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudegvddgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepkeehffethedtteffgfefteetjedvfeelueevudffgfeutdejvdehledv vdffhfevnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgu rdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 4 Feb 2023 09:35:16 -0500 (EST) From: Samuel Holland To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Boris Brezillon , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 0/3] mtd: rawnand: sunxi: Some cleanup Date: Sat, 4 Feb 2023 08:35:17 -0600 Message-Id: <20230204143520.9682-1-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756911687872832225?= X-GMAIL-MSGID: =?utf-8?q?1756911687872832225?= (Apologies for the delay in sending v2. As discussed previously[1], the first patch needs to be merged in the same merge window as commit 34569d869532 from v1 of the series, even if the others don't make it.) I have an A33 tablet with MLC NAND, and I wanted to use mainline Linux to dump the NAND. To do that, I updated this driver's ECC ops to fully utilize the hardware for ECC and scrambling. This made the driver compatible with the existing (scrambled) on-flash bad block map, and I was able to read the full NAND contents. This series contains some cleanup from that effort. The first patch ensures we can make good use of the hardware ECC/descrambler. The other two patches simplify some code for managing the ECC engine. [1]: https://lore.kernel.org/linux-mtd/20230102175351.64690aaf@xps-13/ Changes in v2: - Update commit message to address backward-compatibility concerns - Keep `struct sunxi_nand_hw_ecc` but change the pointer to a value - Split ECC_CTL precomputation and structure updates to two patches Samuel Holland (3): mtd: rawnand: sunxi: Update OOB layout to match hardware mtd: rawnand: sunxi: Embed sunxi_nand_hw_ecc by value mtd: rawnand: sunxi: Precompute the ECC_CTL register value drivers/mtd/nand/raw/sunxi_nand.c | 73 +++++++++---------------------- 1 file changed, 20 insertions(+), 53 deletions(-)