From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21286CCF9E0 for ; Tue, 28 Oct 2025 07:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/f7I4mS7ffDmKYbrcNaYVr3wHLxNovubQrX/C8jQciI=; b=GAR49ufSyXFW/3 XAl3oHzjLLa3sZuoAgvW47/O41Z6BW7+XQr9au4zWjzD4sagZEeVKCWBbmf3pnoUxLKrZ//aGZp59 4GmWmMmfdWrmrqAa7sHSryR8q3o5F5MWs9BfXAQact5vPXcycEE2VipwZH/JsKidecBxrdyncqROx W3KnyeCWOL8EJswSPdEFjn7s99huCczPwo2cK2bW0VgUDRSp8DxjyEI/4g6xo+EVguv5KNdAaHxns w6BD/RIv0Z1HgswJ98FoMdhl220WvVSGiiM+6YdinHLZ6dc5jW/ydnevBKzQsSwbuxuzw6qRFv1lA QWarmxhDCaB1KMkt2W6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vDeGK-0000000FRPm-35HI; Tue, 28 Oct 2025 07:37:00 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vDeFt-0000000FQr0-0eOq for linux-mtd@bombadil.infradead.org; Tue, 28 Oct 2025 07:36:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=gYVTL1ZTxnVIPezTCNImC2+NTtWeAAb/rtkfiK22AXQ=; b=VwVhO7Ocrj+iQCAydZ5qC4yh0X ArCRl4sEq0276yDt4pM9cQqXUU5/LVrEmzAVrDEDMYf+1/CC60uLQE+SNE0c/3imhHxAIBQFahIx6 gtKRrZsxKs601UfbIxab3mQ4ULGArp0VGfSkdkmLZbOayf/jhQx1xMjTins5lIAmAJOIKvQn7vw6n UuKh8p5e2fTAIJjqVWY4f1am9vg8DUm0+jYt14F/YV+N0w4KBYha5AkeVMW/cbWIeFn0XkhVE5+IG Nan4BRnMZQNo2xBKjWgNl5pZE4Cp2soowjy+2sCVjtA9TpAtg/KGxY0RuDBqLUrbu3Oa+Fga9IjxA gEXJumiA==; Received: from smtpout-04.galae.net ([185.171.202.116]) by desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vDdO5-00000003ozL-3a6L for linux-mtd@lists.infradead.org; Tue, 28 Oct 2025 06:40:59 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E09A3C0BE98; Tue, 28 Oct 2025 07:36:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2926E606AB; Tue, 28 Oct 2025 07:36:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9398A102F2521; Tue, 28 Oct 2025 08:36:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761636981; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=gYVTL1ZTxnVIPezTCNImC2+NTtWeAAb/rtkfiK22AXQ=; b=S0UcxA9NYGs2ewHABynPmDYWKrDuiA8iepB8MO+ff1dndv12k1LWS4Tco7fe3YzJM7S3hx jEbih65ZYKTXRMWFCYUsnmJI6Y3Bqg44aKykc7WQbxTA3X4duiyEpoO1DDpx/3tSyAL2XK LTxeV+APRdOPzXR565OaRzbNyROiQw2VXPSfNxI7ofCyHGdecudOIYkOTypurdNP7xwnBB Ew086K6m+EzbQkLX9oESDBjioaPa07rstrSrWrjd9jV4PKMGd9IdvlnLmOG08jEak1hGlk QIaOkNfhHk7DW4teqgAwuAmZodaFmeRWq7ePXCnxGWpZuajb7NWNu7vQvv8Pyw== From: Richard Genoud To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Wentao Liang , Johan Hovold , Maxime Ripard , Thomas Petazzoni , 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, Richard Genoud Subject: [PATCH v4 10/16] mtd: rawnand: sunxi: introduce random en/dir in sunxi_nfc_caps Date: Tue, 28 Oct 2025 08:35:03 +0100 Message-ID: <20251028073534.526992-11-richard.genoud@bootlin.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251028073534.526992-1-richard.genoud@bootlin.com> References: <20251028073534.526992-1-richard.genoud@bootlin.com> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251028_064058_071859_399131C6 X-CRM114-Status: GOOD ( 10.83 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org The H6/H616 RANDOM EN/DIRECTION masks are different from A10/A23. So move the masks into sunxi_nfc_caps. No functional change. Signed-off-by: Richard Genoud --- drivers/mtd/nand/raw/sunxi_nand.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index a16d50a01751..7dfc50a788e2 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -144,8 +144,8 @@ #define NFC_ECC_EXCEPTION BIT(4) #define NFC_ECC_BLOCK_SIZE_MSK BIT(5) #define NFC_ECC_BLOCK_512 BIT(5) -#define NFC_RANDOM_EN BIT(9) -#define NFC_RANDOM_DIRECTION BIT(10) +#define NFC_RANDOM_EN(nfc) (nfc->caps->random_en_mask) +#define NFC_RANDOM_DIRECTION(nfc) (nfc->caps->random_dir_mask) #define NFC_ECC_MODE_MSK(nfc) (nfc->caps->ecc_mode_mask) #define NFC_ECC_MODE(nfc, x) field_prep(NFC_ECC_MODE_MSK(nfc), (x)) #define NFC_RANDOM_SEED_MSK GENMASK(30, 16) @@ -239,6 +239,8 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand) * @reg_ecc_err_cnt: ECC error counter register * @reg_user_data: User data register * @reg_pat_found: Data Pattern Status Register + * @random_en_mask: RANDOM_EN mask in NFC_ECC_CTL register + * @random_dir_mask: RANDOM_DIRECTION mask in NFC_ECC_CTL register * @ecc_mode_mask: ECC_MODE mask in NFC_ECC_CTL register * @pat_found_mask: ECC_PAT_FOUND mask in NFC_REG_PAT_FOUND register * @dma_maxburst: DMA maxburst @@ -252,6 +254,8 @@ struct sunxi_nfc_caps { unsigned int reg_ecc_err_cnt; unsigned int reg_user_data; unsigned int reg_pat_found; + unsigned int random_en_mask; + unsigned int random_dir_mask; unsigned int ecc_mode_mask; unsigned int pat_found_mask; unsigned int dma_maxburst; @@ -680,7 +684,7 @@ static void sunxi_nfc_randomizer_enable(struct nand_chip *nand) if (!(nand->options & NAND_NEED_SCRAMBLING)) return; - writel(readl(nfc->regs + NFC_REG_ECC_CTL) | NFC_RANDOM_EN, + writel(readl(nfc->regs + NFC_REG_ECC_CTL) | NFC_RANDOM_EN(nfc), nfc->regs + NFC_REG_ECC_CTL); } @@ -691,7 +695,7 @@ static void sunxi_nfc_randomizer_disable(struct nand_chip *nand) if (!(nand->options & NAND_NEED_SCRAMBLING)) return; - writel(readl(nfc->regs + NFC_REG_ECC_CTL) & ~NFC_RANDOM_EN, + writel(readl(nfc->regs + NFC_REG_ECC_CTL) & ~NFC_RANDOM_EN(nfc), nfc->regs + NFC_REG_ECC_CTL); } @@ -2230,6 +2234,8 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = { .reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT, .reg_user_data = NFC_REG_A10_USER_DATA, .reg_pat_found = NFC_REG_ECC_ST, + .random_en_mask = BIT(9), + .random_dir_mask = BIT(10), .ecc_mode_mask = GENMASK(15, 12), .pat_found_mask = GENMASK(31, 16), .dma_maxburst = 4, @@ -2244,6 +2250,8 @@ static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = { .reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT, .reg_user_data = NFC_REG_A10_USER_DATA, .reg_pat_found = NFC_REG_ECC_ST, + .random_en_mask = BIT(9), + .random_dir_mask = BIT(10), .ecc_mode_mask = GENMASK(15, 12), .pat_found_mask = GENMASK(31, 16), .dma_maxburst = 8, -- 2.47.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/