From patchwork Thu Nov 9 11:24:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1861937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VDnQgiUb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=LyRgM6jg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR05F15x6z1yRS for ; Thu, 9 Nov 2023 22:26:09 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=ilOjJqlADoOj+0PDHJ+keMhl9LITJNx6t2KfiEa9DUQ=; b=VDnQgiUbn8oBmK M00WEP78DBk7POHJdh8gKzlxyyMDVE0MC0m2D+XU0OVQ1S2nTMZ9z5Bxo9X3Fy0NNjn1YqWQcXUgk Rq6PEc3iLcXC0VOfaXoL665tWHg7hFDmN79HyCRWVuitzpP9+bFP5iKC24f2mTOBGAYuGfplTDvSU JytoGhv+UyYGpVRUCk+IhObvRw6OtEW3EUU/vZwkhU5ynEOnnFwjKq9EnSOvpCL2DdtzRgLwlMHqv 8aZiQfdzJcAVLzaY8MmJiWy+ldCOiZCqzLJRvRG7P4xkzBo7Hh/0se4Bs11JkOtIZBaFwI5/xGi+h f6Z3f5qZ0WBYD2qNLF9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r13AD-0063XK-3A; Thu, 09 Nov 2023 11:25:34 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r13A8-0063TQ-1M for linux-mtd@lists.infradead.org; Thu, 09 Nov 2023 11:25:32 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6b2018a11efso831997b3a.0 for ; Thu, 09 Nov 2023 03:25:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699529123; x=1700133923; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=JhgRN2Rn+rtjvCYDC100dWfkXqmEv9CGax3w9Fgda48=; b=LyRgM6jgI2qyw3v0BO1EvNrL/ilWoBvKWPoMyinY3UYvVc6ljJ9tlKdOppa6iYWOJp 4UkzGpk8K7rVch+S7vD2akW9Y9b0APCf5uiEKhLuFttm1IVko1BcvHcBYMAxLviXjio9 TX2LdLWAVwkjjC682C4znb3eDf1nT/z0a4n5vvySAdkVMcUsduFIYgCEvOuqtAVUOjM9 0LqDCF9bsOwdQdVJT2kCrEUu1E/BfewwZvoOiChT0DUJu/1w1+BaZV99CwV57gfFu8yO x5sdY/9HyXGXB/y22tNwiRRBBffbW3wFJKM13AZuNQS4ieP5Vu3P/TT+Kz49QfKVRnY7 qbMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699529123; x=1700133923; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JhgRN2Rn+rtjvCYDC100dWfkXqmEv9CGax3w9Fgda48=; b=NEQS3DkDMbrp3cg8BuVUSXk6AHIfN4hEKaIGVYi7giKglNJQQyV32+HGrVOISfnkp6 zsnlicMostJZK9TtF3L+in1djSfp431wHpr4HHEzvD+g4U67MA+E2Yf8dle/2d2XzxXF 8Zx+UC9gCdSR65K6n/uvVb0Qc5oNWq3SoDG+TfzJV6x1oDvtw7A5fEg1w8d6EsWkGFHp adcnVVPnXoggcseN354YbsIfhffffge7UJfrii4M3DCAH9yVWEkuU+am++PQhLtK5uUC hpCkoTYpdHBR/Tvkh32NU2dgGymtMQIlFVEowQNtkYHCMway9rXdphStln+BBgsvHbOz TmZA== X-Gm-Message-State: AOJu0YxbsLcwbI8pQGThjFFdCWSuGX6OUIAvmPTv2fVumdyG0LrrYPTd M9nd1DrRk+ZUAo1M/iUz2kVEPOUvs0M= X-Google-Smtp-Source: AGHT+IH6QCtbnlZFhfuu6F2t4Oe72e99M/xqinTJVdHC04ASkRI5v8jAoSUnGjWT8MGGPPhGArAnVA== X-Received: by 2002:aa7:88c2:0:b0:6bd:d884:df00 with SMTP id k2-20020aa788c2000000b006bdd884df00mr4599334pff.9.1699529122516; Thu, 09 Nov 2023 03:25:22 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id y36-20020a056a00182400b0068790c41ca2sm10455953pfa.27.2023.11.09.03.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 03:25:22 -0800 (PST) From: JaimeLiao X-Google-Original-From: JaimeLiao To: linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, richard@nod.at Cc: jaimeliao@mxic.com.tw, jaimeliao.tw@gmail.com, angyanyu13@gmail.com Subject: [PATCH v3 1/5] Add clk wizard and mxic host controller driver Date: Thu, 9 Nov 2023 19:24:56 +0800 Message-Id: <20231109112500.4966-2-jaimeliao@mxic.com.tw> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109112500.4966-1-jaimeliao@mxic.com.tw> References: <20231109112500.4966-1-jaimeliao@mxic.com.tw> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_032528_466109_74B812E3 X-CRM114-Status: GOOD ( 15.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: JaimeLiao --- arch/arm/boot/dts/xilinx/zynq-7000.dtsi | 4 +- .../dts/xilinx/zynq-mxic-picozed.spi-nand.dts | 141 ++++++ .../zynq-mxic-picozed.spi-nand_manual.dts | 141 ++++++ .../dts/ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jaimeliao.tw[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: JaimeLiao --- arch/arm/boot/dts/xilinx/zynq-7000.dtsi | 4 +- .../dts/xilinx/zynq-mxic-picozed.spi-nand.dts | 141 ++++++ .../zynq-mxic-picozed.spi-nand_manual.dts | 141 ++++++ .../dts/xilinx/zynq-mxic-picozed.spi-nor.dts | 142 ++++++ drivers/clk/Kconfig | 1 + drivers/clk/zynq/Kconfig | 6 + drivers/clk/zynq/Makefile | 1 + drivers/clk/zynq/clk-wizard.c | 409 ++++++++++++++++++ drivers/spi/spi-mxic.c | 84 ++-- 9 files changed, 885 insertions(+), 44 deletions(-) create mode 100644 arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand.dts create mode 100644 arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand_manual.dts create mode 100644 arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nor.dts create mode 100644 drivers/clk/zynq/Kconfig create mode 100644 drivers/clk/zynq/clk-wizard.c diff --git a/arch/arm/boot/dts/xilinx/zynq-7000.dtsi b/arch/arm/boot/dts/xilinx/zynq-7000.dtsi index a7db3f3009f2..45c207b62396 100644 --- a/arch/arm/boot/dts/xilinx/zynq-7000.dtsi +++ b/arch/arm/boot/dts/xilinx/zynq-7000.dtsi @@ -289,7 +289,7 @@ sdhci0: mmc@e0100000 { compatible = "arasan,sdhci-8.9a"; - status = "disabled"; + status = "okay"; clock-names = "clk_xin", "clk_ahb"; clocks = <&clkc 21>, <&clkc 32>; interrupt-parent = <&intc>; @@ -316,7 +316,7 @@ clkc: clkc@100 { #clock-cells = <1>; compatible = "xlnx,ps7-clkc"; - fclk-enable = <0>; + fclk-enable = <0xf>; clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", "dci", "lqspi", "smc", "pcap", "gem0", "gem1", diff --git a/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand.dts b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand.dts new file mode 100644 index 000000000000..a34223b70199 --- /dev/null +++ b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand.dts @@ -0,0 +1,141 @@ +/dts-v1/; +/include/ "zynq-7000.dtsi" + +/ { + model = "Zynq MXIC PicoZed Development Board"; + compatible = "mxicy,zynq-mxic-picozed", "xlnx,zynq-7000"; + + aliases { + ethernet0 = &gem0; + serial0 = &uart1; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x30000000>; + }; + + chosen { + bootargs = ""; + stdout-path = "serial0:115200n8"; + }; + + clkwzd_in: clkwzd_in { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <133300000>; + }; +}; + +&amba { + sdhci@e0100000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x15 0x1 0x20>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x18 0x4>; + reg = <0xe0100000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + sdhci@e0101000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x16 0x1 0x21>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x2f 0x4>; + reg = <0xe0101000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + clkwizard: clkwizard@43c20000 { + compatible = "xlnx,clk-wizard-5.1"; + reg = <0x43c20000 0x10000>; + clocks = <&clkc 0xf>, <&clkc 0xf>; + clock-names = "aclk", "clk_in1"; + #clock-cells = <1>; + xlnx,clk-wizard-num-outputs = <2>; + phandle = <0x12>; + }; + +/* v11 */ +/* + clkwizard: clkwizard@43c20000 { + #clock-cells = <1>; + reg = <0x43c20000 0x1000>; + compatible = "xlnx,clocking-wizard"; + xlnx,speed-grade = <1>; + xlnx,nr-outputs = <6>; + clock-names = "clk_in1", "s_axi_aclk"; + clocks = <&clkc 18>, <&clkc 18>; + }; +*/ + + spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>; + reg-names = "regs", "dirmap"; + clocks = <&clkwizard 0x0>, <&clkwizard 0x1>, <&clkc 0xf>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + #nand-use-soft-ecc-engine; + #nand-ecc-algo = "bch"; + #nand-ecc-strength = <8>; + #nand-ecc-step-size = <512>; + spi-max-frequency = <25000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + #address-cells = <0x1>; + #size-cells = <0x1>; + }; + }; + +/* + nand: mxic-nfc@43c30000 { + compatible = "mxic,multi-itfc-v009-nand-controller"; + reg = <0x43c30000 0x10000>; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>; + clock-names = "send", "send_dly", "ps"; + interrupt-parent = <&intc>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + + nand@0 { + reg = <0>; + label = "main-storage"; + + nand-use-soft-ecc-engine; + nand-ecc-algo = "bch"; + nand-ecc-algo = "hamming"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + }; + + }; +*/ +}; + +&clkc { + ps-clk-frequency = <33333333>; +}; + +&gem0 { + status = "okay"; + phy-mode = "rgmii-id"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand_manual.dts b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand_manual.dts new file mode 100644 index 000000000000..7b68c03deb65 --- /dev/null +++ b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nand_manual.dts @@ -0,0 +1,141 @@ +/dts-v1/; +/include/ "zynq-7000.dtsi" + +/ { + model = "Zynq MXIC PicoZed Development Board"; + compatible = "mxicy,zynq-mxic-picozed", "xlnx,zynq-7000"; + + aliases { + ethernet0 = &gem0; + serial0 = &uart1; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x30000000>; + }; + + chosen { + bootargs = ""; + stdout-path = "serial0:115200n8"; + }; + + clkwzd_in: clkwzd_in { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <133300000>; + }; +}; + +&amba { + sdhci@e0100000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x15 0x1 0x20>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x18 0x4>; + reg = <0xe0100000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + sdhci@e0101000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x16 0x1 0x21>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x2f 0x4>; + reg = <0xe0101000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + clkwizard: clkwizard@43c20000 { + compatible = "xlnx,clk-wizard-5.1"; + reg = <0x43c20000 0x10000>; + clocks = <&clkc 0xf>, <&clkc 0xf>; + clock-names = "aclk", "clk_in1"; + #clock-cells = <1>; + xlnx,clk-wizard-num-outputs = <2>; + phandle = <0x12>; + }; + +/* v11 */ +/* + clkwizard: clkwizard@43c20000 { + #clock-cells = <1>; + reg = <0x43c20000 0x1000>; + compatible = "xlnx,clocking-wizard"; + xlnx,speed-grade = <1>; + xlnx,nr-outputs = <6>; + clock-names = "clk_in1", "s_axi_aclk"; + clocks = <&clkc 18>, <&clkc 18>; + }; +*/ + + spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>; + reg-names = "regs"; + clocks = <&clkwizard 0x0>, <&clkwizard 0x1>, <&clkc 0xf>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + #nand-use-soft-ecc-engine; + #nand-ecc-algo = "bch"; + #nand-ecc-strength = <8>; + #nand-ecc-step-size = <512>; + spi-max-frequency = <25000000>; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + #address-cells = <0x1>; + #size-cells = <0x1>; + }; + }; + +/* + nand: mxic-nfc@43c30000 { + compatible = "mxic,multi-itfc-v009-nand-controller"; + reg = <0x43c30000 0x10000>; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>; + clock-names = "send", "send_dly", "ps"; + interrupt-parent = <&intc>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + + nand@0 { + reg = <0>; + label = "main-storage"; + + nand-use-soft-ecc-engine; + nand-ecc-algo = "bch"; + nand-ecc-algo = "hamming"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + }; + + }; +*/ +}; + +&clkc { + ps-clk-frequency = <33333333>; +}; + +&gem0 { + status = "okay"; + phy-mode = "rgmii-id"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nor.dts b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nor.dts new file mode 100644 index 000000000000..ee700c43218f --- /dev/null +++ b/arch/arm/boot/dts/xilinx/zynq-mxic-picozed.spi-nor.dts @@ -0,0 +1,142 @@ +/dts-v1/; +/include/ "zynq-7000.dtsi" + +/ { + model = "Zynq MXIC PicoZed Development Board"; + compatible = "mxicy,zynq-mxic-picozed", "xlnx,zynq-7000"; + + aliases { + ethernet0 = &gem0; + serial0 = &uart1; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x30000000>; + }; + + chosen { + bootargs = ""; + stdout-path = "serial0:115200n8"; + }; + + clkwzd_in: clkwzd_in { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <133300000>; + }; +}; + +&amba { + sdhci@e0100000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x15 0x1 0x20>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x18 0x4>; + reg = <0xe0100000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + sdhci@e0101000 { + compatible = "arasan,sdhci-8.9a"; + status = "okay"; + clock-names = "clk_xin", "clk_ahb"; + clocks = <0x1 0x16 0x1 0x21>; + interrupt-parent = <0x3>; + interrupts = <0x0 0x2f 0x4>; + reg = <0xe0101000 0x1000>; + xlnx,has-cd = <0x1>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + }; + + clkwizard: clkwizard@43c20000 { + compatible = "xlnx,clk-wizard-5.1"; + reg = <0x43c20000 0x10000>; + clocks = <&clkc 0xf>, <&clkc 0xf>; + clock-names = "aclk", "clk_in1"; + #clock-cells = <1>; + xlnx,clk-wizard-num-outputs = <2>; + phandle = <0x12>; + }; + +/* v11 */ +/* + clkwizard: clkwizard@43c20000 { + #clock-cells = <1>; + reg = <0x43c20000 0x1000>; + compatible = "xlnx,clocking-wizard"; + xlnx,speed-grade = <1>; + xlnx,nr-outputs = <6>; + clock-names = "clk_in1", "s_axi_aclk"; + clocks = <&clkc 18>, <&clkc 18>; + }; +*/ + + spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>; + reg-names = "regs", "dirmap"; + clocks = <&clkwizard 0x0>, <&clkwizard 0x1>, <&clkc 0xf>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + #compatible = "spi-nand"; + compatible = "jedec,spi-nor"; + reg = <0>; + #nand-use-soft-ecc-engine; + #nand-ecc-algo = "bch"; + #nand-ecc-strength = <8>; + #nand-ecc-step-size = <512>; + spi-max-frequency = <25000000>; + spi-tx-bus-width = <8>; + spi-rx-bus-width = <8>; + #address-cells = <0x1>; + #size-cells = <0x1>; + }; + }; + +/* + nand: mxic-nfc@43c30000 { + compatible = "mxic,multi-itfc-v009-nand-controller"; + reg = <0x43c30000 0x10000>; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>; + clock-names = "send", "send_dly", "ps"; + interrupt-parent = <&intc>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + + nand@0 { + reg = <0>; + label = "main-storage"; + + nand-use-soft-ecc-engine; + nand-ecc-algo = "bch"; + nand-ecc-algo = "hamming"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + }; + + }; +*/ +}; + +&clkc { + ps-clk-frequency = <33333333>; +}; + +&gem0 { + status = "okay"; + phy-mode = "rgmii-id"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index c30d0d396f7a..f16464abacf5 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -510,6 +510,7 @@ source "drivers/clk/visconti/Kconfig" source "drivers/clk/x86/Kconfig" source "drivers/clk/xilinx/Kconfig" source "drivers/clk/zynqmp/Kconfig" +source "drivers/clk/zynq/Kconfig" # Kunit test cases config CLK_KUNIT_TEST diff --git a/drivers/clk/zynq/Kconfig b/drivers/clk/zynq/Kconfig new file mode 100644 index 000000000000..240ff17daa8f --- /dev/null +++ b/drivers/clk/zynq/Kconfig @@ -0,0 +1,6 @@ +config CLK_ZYNQ_CLK_WIZARD + tristate "Xilinx clocking wizard driver" + depends on ARCH_ZYNQ || COMPILE_TEST + help + Enable the driver for Xilinx clocking wizard IP. + diff --git a/drivers/clk/zynq/Makefile b/drivers/clk/zynq/Makefile index a5bb696de943..b1a1628048fb 100644 --- a/drivers/clk/zynq/Makefile +++ b/drivers/clk/zynq/Makefile @@ -2,3 +2,4 @@ # Zynq clock specific Makefile obj-y += clkc.o pll.o +obj-$(CONFIG_CLK_ZYNQ_CLK_WIZARD) += clk-wizard.o diff --git a/drivers/clk/zynq/clk-wizard.c b/drivers/clk/zynq/clk-wizard.c new file mode 100644 index 000000000000..3b217f8a8ffa --- /dev/null +++ b/drivers/clk/zynq/clk-wizard.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Zynq Clocking Wizard driver + * + * Copyright (C) 2018 Macronix + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SRR 0x0 + +#define SR 0x4 +#define SR_LOCKED BIT(0) + +#define CCR(x) (0x200 + ((x) * 4)) + +#define FBOUT_CFG CCR(0) +#define FBOUT_DIV(x) (x) +#define FBOUT_GET_DIV(x) ((x) & GENMASK(7, 0)) +#define FBOUT_MUL(x) ((x) << 8) +#define FBOUT_GET_MUL(x) (((x) & GENMASK(15, 8)) >> 8) +#define FBOUT_FRAC(x) ((x) << 16) +#define FBOUT_GET_FRAC(x) (((x) & GENMASK(25, 16)) >> 16) +#define FBOUT_FRAC_EN BIT(26) + +#define FBOUT_PHASE CCR(1) + +#define OUT_CFG(x) CCR(2 + ((x) * 3)) +#define OUT_DIV(x) (x) +#define OUT_GET_DIV(x) ((x) & GENMASK(7, 0)) +#define OUT_FRAC(x) ((x) << 8) +#define OUT_GET_FRAC(x) (((x) & GENMASK(17, 8)) >> 8) +#define OUT_FRAC_EN BIT(18) + +#define OUT_PHASE(x) CCR(3 + ((x) * 3)) +#define OUT_DUTY(x) CCR(4 + ((x) * 3)) + +#define CTRL CCR(23) +#define CTRL_SEN BIT(2) +#define CTRL_SADDR BIT(1) +#define CTRL_LOAD BIT(0) + +struct clkwzd; + +struct clkwzd_fbout { + struct clk_hw base; + struct clkwzd *wzd; +}; + +static inline struct clkwzd_fbout *to_clkwzd_fbout(struct clk_hw *hw) +{ + return container_of(hw, struct clkwzd_fbout, base); +} + +struct clkwzd_out { + struct clk_hw base; + struct clkwzd *wzd; + unsigned int id; +}; + +static inline struct clkwzd_out *to_clkwzd_out(struct clk_hw *hw) +{ + return container_of(hw, struct clkwzd_out, base); +} + +#define CLKWZD_MAX_OUTPUT 7 + +struct clkwzd { + struct mutex lock; + struct clk *aclk; + struct clk *clk_in1; + void __iomem *regs; + struct clkwzd_out out[CLKWZD_MAX_OUTPUT]; + struct clkwzd_fbout fbout; + struct clk_hw_onecell_data *onecell; +}; + + +static int clkwzd_is_locked(struct clkwzd *wzd) +{ + bool prepared; + + mutex_lock(&wzd->lock); + prepared = readl(wzd->regs + SR) & SR_LOCKED; + mutex_unlock(&wzd->lock); + + return prepared; +} + +static int clkwzd_apply_conf(struct clkwzd *wzd) +{ + int ret; + u32 val; + + mutex_lock(&wzd->lock); + ret = readl_poll_timeout(wzd->regs + SR, val, val & SR_LOCKED, 1, 100); + if (!ret) { + writel(CTRL_SEN | CTRL_SADDR | CTRL_LOAD, wzd->regs + CTRL); + writel(CTRL_SADDR, wzd->regs + CTRL); + ret = readl_poll_timeout(wzd->regs + SR, val, val & SR_LOCKED, + 1, 100); + } + mutex_unlock(&wzd->lock); + + return 0; +} + +static int clkwzd_fbout_is_prepared(struct clk_hw *hw) +{ + struct clkwzd_fbout *fbout = to_clkwzd_fbout(hw); + + return clkwzd_is_locked(fbout->wzd); +} + +static int clkwzd_fbout_prepare(struct clk_hw *hw) +{ + struct clkwzd_fbout *fbout = to_clkwzd_fbout(hw); + + return clkwzd_apply_conf(fbout->wzd); +} + +static unsigned long clkwzd_fbout_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clkwzd_fbout *fbout = to_clkwzd_fbout(hw); + unsigned long rate; + u32 cfg; + + cfg = readl(fbout->wzd->regs + FBOUT_CFG); + if (cfg & FBOUT_FRAC_EN) + rate = DIV_ROUND_DOWN_ULL((u64)parent_rate * + ((FBOUT_GET_MUL(cfg) * 1000) + + FBOUT_GET_FRAC(cfg)), + 1000); + else + rate = parent_rate * FBOUT_GET_MUL(cfg); + + rate /= FBOUT_GET_DIV(cfg); + + return rate; +} + +static int clkwzd_fbout_set_phase(struct clk_hw *hw, int degrees) +{ + struct clkwzd_fbout *fbout = to_clkwzd_fbout(hw); + + writel(degrees * 1000, fbout->wzd->regs + FBOUT_PHASE); + + return 0; +} + +static int clkwzd_fbout_get_phase(struct clk_hw *hw) +{ + struct clkwzd_fbout *fbout = to_clkwzd_fbout(hw); + + return readl(fbout->wzd->regs + FBOUT_PHASE) / 1000; +} + +const struct clk_ops fbout_ops = { + .is_prepared = clkwzd_fbout_is_prepared, + .prepare = clkwzd_fbout_prepare, + .recalc_rate = clkwzd_fbout_recalc_rate, + .set_phase = clkwzd_fbout_set_phase, + .get_phase = clkwzd_fbout_get_phase, +}; + +static int clkwzd_out_is_prepared(struct clk_hw *hw) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + + return clkwzd_is_locked(out->wzd); +} + +static int clkwzd_out_prepare(struct clk_hw *hw) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + + return clkwzd_apply_conf(out->wzd); +} + +static unsigned long clkwzd_out_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + unsigned long rate; + u32 cfg; + + cfg = readl(out->wzd->regs + OUT_CFG(out->id)); + if (cfg & OUT_FRAC_EN) + rate = DIV_ROUND_DOWN_ULL((u64)parent_rate * 1000, + ((OUT_GET_DIV(cfg) * 1000) + + OUT_GET_FRAC(cfg))); + else + rate = parent_rate / OUT_GET_DIV(cfg); + + return rate; +} + +static int clkwzd_out_set_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long parent_rate) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + u64 div; + u32 cfg; + + div = DIV_ROUND_DOWN_ULL((u64)parent_rate * 1000, rate); + if (div < 1000 || div > 255999) + return -EINVAL; + + cfg = OUT_DIV((u32)div / 1000); + + if ((u32)div % 1000) + cfg |= OUT_FRAC_EN | OUT_FRAC((u32)div % 1000); + + writel(cfg, out->wzd->regs + OUT_CFG(out->id)); + + /* Set duty cycle to 50%. */ + writel(50000, out->wzd->regs + OUT_DUTY(out->id)); + + return 0; +} + +static long clkwzd_out_round_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long *parent_rate) +{ + u64 div; + + div = DIV_ROUND_CLOSEST_ULL((u64)(*parent_rate) * 1000, rate); + if (div < 1000) + return *parent_rate; + + if (div > 255999) + div = 255999; + + return DIV_ROUND_DOWN_ULL((u64)(*parent_rate) * 1000, (u32)div); +} + +static int clkwzd_out_set_phase(struct clk_hw *hw, int degrees) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + + writel(degrees * 1000, out->wzd->regs + OUT_PHASE(out->id)); + + return 0; +} + +static int clkwzd_out_get_phase(struct clk_hw *hw) +{ + struct clkwzd_out *out = to_clkwzd_out(hw); + + return readl(out->wzd->regs + OUT_PHASE(out->id)) / 1000; +} + +static const struct clk_ops out_ops = { + .is_prepared = clkwzd_out_is_prepared, + .prepare = clkwzd_out_prepare, + .recalc_rate = clkwzd_out_recalc_rate, + .round_rate = clkwzd_out_round_rate, + .set_rate = clkwzd_out_set_rate, + .set_phase = clkwzd_out_set_phase, + .get_phase = clkwzd_out_get_phase, +}; + +static int zynq_clkwzd_probe(struct platform_device *pdev) +{ + struct clk_init_data fboutinit = { }; + const char *clk_in_name; + struct resource *res; + struct clkwzd *wzd; + u32 i, noutputs = 0; + int ret; + + wzd = devm_kzalloc(&pdev->dev, sizeof(*wzd), GFP_KERNEL); + if (!wzd) + return -ENOMEM; + + wzd->aclk = devm_clk_get(&pdev->dev, "aclk"); + if (IS_ERR(wzd->aclk)) + return PTR_ERR(wzd->aclk); + + wzd->clk_in1 = devm_clk_get(&pdev->dev, "clk_in1"); + if (IS_ERR(wzd->clk_in1)) + return PTR_ERR(wzd->clk_in1); + + of_property_read_u32(pdev->dev.of_node, "xlnx,clk-wizard-num-outputs", + &noutputs); + if (!noutputs || noutputs >= CLKWZD_MAX_OUTPUT) + return -EINVAL; + + wzd->onecell = devm_kzalloc(&pdev->dev, + sizeof(*wzd->onecell) + + (sizeof(*wzd->onecell->hws) * noutputs), + GFP_KERNEL); + if (!wzd->onecell) + return -ENOMEM; + + clk_in_name = __clk_get_name(wzd->clk_in1); + if (!clk_in_name) + return -EINVAL; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + wzd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(wzd->regs)) + return PTR_ERR(wzd->regs); + + mutex_init(&wzd->lock); + + wzd->fbout.wzd = wzd; + fboutinit.ops = &fbout_ops; + fboutinit.flags = CLK_SET_RATE_GATE; + fboutinit.num_parents = 1; + fboutinit.parent_names = &clk_in_name; + fboutinit.flags = CLK_SET_RATE_GATE; + + fboutinit.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-fbout", + dev_name(&pdev->dev)); + if (!fboutinit.name) + return -ENOMEM; + + ret = clk_prepare_enable(wzd->aclk); + if (ret) + return ret; + + wzd->fbout.base.init = &fboutinit; + ret = devm_clk_hw_register(&pdev->dev, &wzd->fbout.base); + if (ret) + goto err_disable_aclk; + + for (i = 0; i < noutputs; i++) { + struct clk_init_data outinit = { }; + + wzd->out[i].id = i; + wzd->out[i].wzd = wzd; + outinit.ops = &out_ops; + outinit.num_parents = 1; + outinit.parent_names = &fboutinit.name; + outinit.flags = CLK_SET_RATE_GATE; + wzd->out[i].base.init = &outinit; + outinit.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "%s-out%d", + dev_name(&pdev->dev), i); + if (!outinit.name) { + ret = -ENOMEM; + goto err_disable_aclk; + } + + ret = devm_clk_hw_register(&pdev->dev, &wzd->out[i].base); + if (ret) + goto err_disable_aclk; + + wzd->onecell->hws[i] = &wzd->out[i].base; + } + + wzd->onecell->num = noutputs; + ret = devm_of_clk_add_hw_provider(&pdev->dev, + of_clk_hw_onecell_get, + wzd->onecell); + if (ret) + goto err_disable_aclk; + + platform_set_drvdata(pdev, wzd); + + return 0; + +err_disable_aclk: + clk_disable_unprepare(wzd->aclk); + + return ret; +} + +static int zynq_clkwzd_remove(struct platform_device *pdev) +{ + struct clkwzd *wzd = platform_get_drvdata(pdev); + + clk_disable_unprepare(wzd->aclk); + + return 0; +} + +static const struct of_device_id zynq_clkwzd_of_ids[] = { + { .compatible = "xlnx,clk-wizard-5.1" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, zynq_clkwzd_of_ids); + +static struct platform_driver zynq_clkwzd_driver = { + .probe = zynq_clkwzd_probe, + .remove = zynq_clkwzd_remove, + .driver = { + .name = "zynq-clk-wizard", + .of_match_table = zynq_clkwzd_of_ids, + }, +}; +module_platform_driver(zynq_clkwzd_driver); + +MODULE_AUTHOR("Boris Brezillon "); +MODULE_DESCRIPTION("Xilinx Clocking Wizard driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c index 60c9f3048ac9..28c324d7200a 100644 --- a/drivers/spi/spi-mxic.c +++ b/drivers/spi/spi-mxic.c @@ -323,7 +323,7 @@ static u32 mxic_spi_mem_prep_op_cfg(const struct spi_mem_op *op, (op->addr.dtr ? OP_ADDR_DDR : 0); if (op->dummy.nbytes) - cfg |= OP_DUMMY_CYC(op->dummy.nbytes); + cfg |= OP_DUMMY_CYC((op->dummy.nbytes) * (op->data.buswidth)); /* Direct mapping data.nbytes field is not populated */ if (data_len) { @@ -390,7 +390,7 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf, static ssize_t mxic_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, u64 offs, size_t len, void *buf) { - struct mxic_spi *mxic = spi_controller_get_devdata(desc->mem->spi->controller); + struct mxic_spi *mxic = spi_master_get_devdata(desc->mem->spi->master); int ret; u32 sts; @@ -434,7 +434,7 @@ static ssize_t mxic_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc, u64 offs, size_t len, const void *buf) { - struct mxic_spi *mxic = spi_controller_get_devdata(desc->mem->spi->controller); + struct mxic_spi *mxic = spi_master_get_devdata(desc->mem->spi->master); u32 sts; int ret; @@ -481,9 +481,9 @@ static bool mxic_spi_mem_supports_op(struct spi_mem *mem, op->dummy.buswidth > 8 || op->cmd.buswidth > 8) return false; - if (op->data.nbytes && op->dummy.nbytes && - op->data.buswidth != op->dummy.buswidth) - return false; + //if (op->data.nbytes && op->dummy.nbytes && + // op->data.buswidth != op->dummy.buswidth) + // return false; if (op->addr.nbytes > 7) return false; @@ -493,7 +493,7 @@ static bool mxic_spi_mem_supports_op(struct spi_mem *mem, static int mxic_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc) { - struct mxic_spi *mxic = spi_controller_get_devdata(desc->mem->spi->controller); + struct mxic_spi *mxic = spi_master_get_devdata(desc->mem->spi->master); if (!mxic->linear.map) return -EINVAL; @@ -510,7 +510,7 @@ static int mxic_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc) static int mxic_spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) { - struct mxic_spi *mxic = spi_controller_get_devdata(mem->spi->controller); + struct mxic_spi *mxic = spi_master_get_devdata(mem->spi->master); int i, ret; u8 addr[8], cmd[2]; @@ -543,7 +543,7 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem, if (ret) goto out; - ret = mxic_spi_data_xfer(mxic, NULL, NULL, op->dummy.nbytes); + ret = mxic_spi_data_xfer(mxic, NULL, NULL, (op->dummy.nbytes) * (op->data.buswidth)); if (ret) goto out; @@ -565,9 +565,9 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem, static const struct spi_controller_mem_ops mxic_spi_mem_ops = { .supports_op = mxic_spi_mem_supports_op, .exec_op = mxic_spi_mem_exec_op, - .dirmap_create = mxic_spi_mem_dirmap_create, - .dirmap_read = mxic_spi_mem_dirmap_read, - .dirmap_write = mxic_spi_mem_dirmap_write, + //.dirmap_create = mxic_spi_mem_dirmap_create, + //.dirmap_read = mxic_spi_mem_dirmap_read, + //.dirmap_write = mxic_spi_mem_dirmap_write, }; static const struct spi_controller_mem_caps mxic_spi_mem_caps = { @@ -577,7 +577,7 @@ static const struct spi_controller_mem_caps mxic_spi_mem_caps = { static void mxic_spi_set_cs(struct spi_device *spi, bool lvl) { - struct mxic_spi *mxic = spi_controller_get_devdata(spi->controller); + struct mxic_spi *mxic = spi_master_get_devdata(spi->master); if (!lvl) { writel(readl(mxic->regs + HC_CFG) | HC_CFG_MAN_CS_EN, @@ -592,11 +592,11 @@ static void mxic_spi_set_cs(struct spi_device *spi, bool lvl) } } -static int mxic_spi_transfer_one(struct spi_controller *host, +static int mxic_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *t) { - struct mxic_spi *mxic = spi_controller_get_devdata(host); + struct mxic_spi *mxic = spi_master_get_devdata(master); unsigned int busw = OP_BUSW_1; int ret; @@ -632,7 +632,7 @@ static int mxic_spi_transfer_one(struct spi_controller *host, if (ret) return ret; - spi_finalize_current_transfer(host); + spi_finalize_current_transfer(master); return 0; } @@ -713,8 +713,8 @@ static int mxic_spi_mem_ecc_probe(struct platform_device *pdev, static int __maybe_unused mxic_spi_runtime_suspend(struct device *dev) { - struct spi_controller *host = dev_get_drvdata(dev); - struct mxic_spi *mxic = spi_controller_get_devdata(host); + struct spi_master *master = dev_get_drvdata(dev); + struct mxic_spi *mxic = spi_master_get_devdata(master); mxic_spi_clk_disable(mxic); clk_disable_unprepare(mxic->ps_clk); @@ -724,8 +724,8 @@ static int __maybe_unused mxic_spi_runtime_suspend(struct device *dev) static int __maybe_unused mxic_spi_runtime_resume(struct device *dev) { - struct spi_controller *host = dev_get_drvdata(dev); - struct mxic_spi *mxic = spi_controller_get_devdata(host); + struct spi_master *master = dev_get_drvdata(dev); + struct mxic_spi *mxic = spi_master_get_devdata(master); int ret; ret = clk_prepare_enable(mxic->ps_clk); @@ -744,21 +744,21 @@ static const struct dev_pm_ops mxic_spi_dev_pm_ops = { static int mxic_spi_probe(struct platform_device *pdev) { - struct spi_controller *host; + struct spi_master *master; struct resource *res; struct mxic_spi *mxic; int ret; - host = devm_spi_alloc_host(&pdev->dev, sizeof(struct mxic_spi)); - if (!host) + master = devm_spi_alloc_master(&pdev->dev, sizeof(struct mxic_spi)); + if (!master) return -ENOMEM; - platform_set_drvdata(pdev, host); + platform_set_drvdata(pdev, master); - mxic = spi_controller_get_devdata(host); + mxic = spi_master_get_devdata(master); mxic->dev = &pdev->dev; - host->dev.of_node = pdev->dev.of_node; + master->dev.of_node = pdev->dev.of_node; mxic->ps_clk = devm_clk_get(&pdev->dev, "ps_clk"); if (IS_ERR(mxic->ps_clk)) @@ -786,19 +786,19 @@ static int mxic_spi_probe(struct platform_device *pdev) } pm_runtime_enable(&pdev->dev); - host->auto_runtime_pm = true; + master->auto_runtime_pm = true; - host->num_chipselect = 1; - host->mem_ops = &mxic_spi_mem_ops; - host->mem_caps = &mxic_spi_mem_caps; + master->num_chipselect = 1; + master->mem_ops = &mxic_spi_mem_ops; + master->mem_caps = &mxic_spi_mem_caps; - host->set_cs = mxic_spi_set_cs; - host->transfer_one = mxic_spi_transfer_one; - host->bits_per_word_mask = SPI_BPW_MASK(8); - host->mode_bits = SPI_CPOL | SPI_CPHA | - SPI_RX_DUAL | SPI_TX_DUAL | - SPI_RX_QUAD | SPI_TX_QUAD | - SPI_RX_OCTAL | SPI_TX_OCTAL; + master->set_cs = mxic_spi_set_cs; + master->transfer_one = mxic_spi_transfer_one; + master->bits_per_word_mask = SPI_BPW_MASK(8); + master->mode_bits = SPI_CPOL | SPI_CPHA | + SPI_RX_DUAL | SPI_TX_DUAL | + SPI_RX_QUAD | SPI_TX_QUAD | + SPI_RX_OCTAL | SPI_TX_OCTAL; mxic_spi_hw_init(mxic); @@ -808,9 +808,9 @@ static int mxic_spi_probe(struct platform_device *pdev) return ret; } - ret = spi_register_controller(host); + ret = spi_register_master(master); if (ret) { - dev_err(&pdev->dev, "spi_register_controller failed\n"); + dev_err(&pdev->dev, "spi_register_master failed\n"); pm_runtime_disable(&pdev->dev); mxic_spi_mem_ecc_remove(mxic); } @@ -820,12 +820,12 @@ static int mxic_spi_probe(struct platform_device *pdev) static void mxic_spi_remove(struct platform_device *pdev) { - struct spi_controller *host = platform_get_drvdata(pdev); - struct mxic_spi *mxic = spi_controller_get_devdata(host); + struct spi_master *master = platform_get_drvdata(pdev); + struct mxic_spi *mxic = spi_master_get_devdata(master); pm_runtime_disable(&pdev->dev); mxic_spi_mem_ecc_remove(mxic); - spi_unregister_controller(host); + spi_unregister_master(master); } static const struct of_device_id mxic_spi_of_ids[] = { From patchwork Thu Nov 9 11:24:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1861935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=o2y/QDuM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=bT9QA2w1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR05C4Z3bz1yRQ for ; Thu, 9 Nov 2023 22:26:07 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=MuvaMjdaVl6iv+bB1XxVViT8tTThvF5qHTW7fhCLK5U=; b=o2y/QDuM+GGxV/ TP04GTDazh6irSlKdie1Y532UtXw1v0tGwTxjLX+ElKgwX4YlSsUOfAnO1jS8b5/1BTbWweC6q3TT 21+DkGM6sZfNASzFk0NVE7N7SqKhSmmcdpIco4npox1vvfiZ+gQnS2469NB4uKhMVsIbedk/J1PSC KyqdIzJe1AhnwLAhPI4Tf3ebUOm1zlxwJ6F6SzBT+/PohgZsEr40l0e2yOgNum5mXhUNz8tKsOVEr frPc07mZbN9EhXVG/OtVWIBkpMKzbGwc/6ON0chP6aR9d849Z+Kf1m/7NYLWNVjDL+xB3/RyP3rNH JF//rzwTx4Nd1biOERyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r13AD-0063X9-1N; Thu, 09 Nov 2023 11:25:33 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r13A9-0063Tp-2r for linux-mtd@lists.infradead.org; Thu, 09 Nov 2023 11:25:31 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b7f0170d7bso797076b3a.2 for ; Thu, 09 Nov 2023 03:25:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699529126; x=1700133926; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=p19gz0pvmUr9WwyXQ4dXMb3io5xq3Mq3immW42vKGSA=; b=bT9QA2w1Kg+Q41WqRaorqovXn/nTQE2Y4gsCRKuCmRTvfMjIHiUq1OWX0FWWqyA80b eIQLBzcFscXNib75YSu5icDfiPm8YmXli/uc4bZr5mauDdzQbpt8gjZwW7JHfg61Xzqu HKx0ijPRsmqTMgOyxvypkXM7yxOYIS8dTISa64t4MEH+Yv2kBnwjJ3ZIWEQnBQjQUDd+ MSbmnrFeT+3C8jUhEod1l9zLrkvWtFL3xZlEOvGr3VIxwKH1BOA4YPqW+tv39mc5xXFV MKTo93XaNURYe6pF9H7zuwrwkqUy/xKNZKo1SfpPU8NCkHc0fxYUGBaIxkMgrQA2OoAl 4oHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699529126; x=1700133926; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p19gz0pvmUr9WwyXQ4dXMb3io5xq3Mq3immW42vKGSA=; b=dehc7Il3CZul/tHKgk21ylir036DOiMMwMW7O8iAK4F8tFNXQX18falwX74q2yTm9m KabfRFuXqdHw+GUUjVlIst8HfR5+rMI7xwTjK2vY3oIkyZBuotr5NMGrwjXEpjbItmaO Qy0U9wqsbZwA7rJuGUUJ1PLVsvBzzElx1HqsbF/sXPk+Fh0lHqOgAcP69hk8biRtnOS7 XN5Be9B5Xrc35rU10cNypY3yohWIvPvnlEp787TsBL11d2YYg4KW4PFVcxMkdfkl6LyC 2ojuV+OSsgIFWL+FnDMJu6fGK14Gq7aOv6rV7hXskI2XyCI1HD/+tWIHZ37nSQmY2C2a fNrw== X-Gm-Message-State: AOJu0Yye/jeLEMx/mu78++ePEPjEvhnzkbR4zcv4rfKhjJbEQm4hLaB5 gUvNkxNxI0I5GqHEYPSIh+b6L7FYIbI= X-Google-Smtp-Source: AGHT+IFezaWjfyPhQ4EtGd2FdGwqg6QZMuQQXwtrCCdd1O0q+2Mk54aA3K1mnUsrNmpwATo5CMNWpw== X-Received: by 2002:a05:6a00:179e:b0:6bf:50df:2df5 with SMTP id s30-20020a056a00179e00b006bf50df2df5mr4807795pfg.13.1699529126212; Thu, 09 Nov 2023 03:25:26 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id y36-20020a056a00182400b0068790c41ca2sm10455953pfa.27.2023.11.09.03.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 03:25:26 -0800 (PST) From: JaimeLiao X-Google-Original-From: JaimeLiao To: linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, richard@nod.at Cc: jaimeliao@mxic.com.tw, jaimeliao.tw@gmail.com, angyanyu13@gmail.com Subject: [PATCH v3 2/5] mtd: spinand: Add support continuous read mode Date: Thu, 9 Nov 2023 19:24:57 +0800 Message-Id: <20231109112500.4966-3-jaimeliao@mxic.com.tw> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109112500.4966-1-jaimeliao@mxic.com.tw> References: <20231109112500.4966-1-jaimeliao@mxic.com.tw> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_032529_923736_24BEABC3 X-CRM114-Status: GOOD ( 10.01 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The patch supports setting the "CONT" bit of the configuration register and create spinand_continuous_read_enable/disable functions. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/core.c | 11 +++++++++++ include/linux/mtd/spinand.h | 1 + 2 files changed, 12 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:434 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jaimeliao.tw[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The patch supports setting the "CONT" bit of the configuration register and create spinand_continuous_read_enable/disable functions. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/core.c | 11 +++++++++++ include/linux/mtd/spinand.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 849ccfedbc72..cfc295f5e31b 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -193,6 +193,17 @@ static int spinand_init_quad_enable(struct spinand_device *spinand) enable ? CFG_QUAD_ENABLE : 0); } +static int spinand_continuous_read_enable(struct spinand_device *spinand) +{ + return spinand_upd_cfg(spinand, CFG_CONT_READ_ENABLE, + CFG_CONT_READ_ENABLE); +} + +static int spinand_continuous_read_disable(struct spinand_device *spinand) +{ + return spinand_upd_cfg(spinand, CFG_CONT_READ_ENABLE, 0); +} + static int spinand_ecc_enable(struct spinand_device *spinand, bool enable) { diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index badb4c1ac079..bb9288ffd898 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -154,6 +154,7 @@ #define REG_CFG 0xb0 #define CFG_OTP_ENABLE BIT(6) #define CFG_ECC_ENABLE BIT(4) +#define CFG_CONT_READ_ENABLE BIT(2) #define CFG_QUAD_ENABLE BIT(0) /* status register */ From patchwork Thu Nov 9 11:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1861938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=28aN6JJ+; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Q7Y5SRLI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR05F1cgSz1yRT for ; Thu, 9 Nov 2023 22:26:08 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=XThMUGp8IB2j8bMSZPV8xRqdn1agD2bFEXpscP9O64E=; b=28aN6JJ+EO4RQE JbBsJXWgVGqsPS2jaOsy5EFG3NG5iiijwCd58rgcGpT4j8YKv0PxL1G9LbXdnlDooju02hDaaYFce RrkBvpnUeXivQ/VpMl8wSKKrGntqHcxuU8ziR6Kf41cwfjzsCEA9MqHrPYXmDZ2Zr8F/bj8vxk+6Q RU900MiByQ+Cu6ejTkG9CJTRd6iExuGkkdfD32gciwSkziqufapJNz0ts+mG4lf/RvdLiquLLmbxn 34gFY5/6Dlt9nINmYPwIuU5AbtqnFhdBNVUBCNME8LFf1TuXIslnhGJySMbEXifNe5UHZJhG1aPFM PawvB3czTMNJMAoM+NYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r13AG-0063YP-17; Thu, 09 Nov 2023 11:25:36 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r13AB-0063Uj-0b for linux-mtd@lists.infradead.org; Thu, 09 Nov 2023 11:25:33 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1f0f160e293so438672fac.0 for ; Thu, 09 Nov 2023 03:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699529129; x=1700133929; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ypE+Qzvt1gTVx9DZDy2dJJ+msX4RkhEYGySvFwz3Rtk=; b=Q7Y5SRLItTsoyAxhjjp3e+GIJU0ZtjoJF+ClDHG5DjzCka9Vj/8W8hA6TfsR5W57LE rIAdgLryluN7lSUa3xx6uTJT+VB/klemFV7tjR0jX+0moSp9z+a3HsRZhJGiTSXmhMdJ 6BT9YjRpZpcW9MG8iASgJgMJkb6FUNA/rxWTxrMlaSTUswJJA4VeGabQberV3QCNZj/D NgdLcoxyHZdHTLGzb+dUCpHGJwuiB+ejACYdf1KP7wQfoN7+HUm4mftTRIN70to1bdZT /1mkMJ0dIzUaYOUFRvvUfqESZEYeQ0VKGnqL9FmTELp+03a3HDf+hTrEvS6iE7TzbErq fuyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699529129; x=1700133929; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ypE+Qzvt1gTVx9DZDy2dJJ+msX4RkhEYGySvFwz3Rtk=; b=qh9t0rgFhLwncjLG2x5W9CeR0NJeOMZT0RW0TJrbNyo7+5lDtfeJ+b2DkcHC0ZbtUK kuWmwe6O3rFLKfh62vio8zaHFK4VWW4ogsrtJeXfxFWRow/47hNNG9Z9kWVvwuG/8s9D YIbnwKKKFewnZfbrm1YMw+4hb++7MjTHKamlz1AettixG48KTRLBQ2GrOQLL8kefkArf EGkdm7sGpsHZJJi1KDrLb9zii7rlTCRcTxZMlfUwYGOMULIvKgx3za7OINKdr9Mrg7qy t9Me58FirXrf2lmDgzE/4+tyap9oTHSIbTRpFWJM9jmLr2G7CMOf5mQ2rb+UPJEeVDUc ZsKQ== X-Gm-Message-State: AOJu0Yzn/tVwAQEe10jfI59ICrLyWcQWpZR/bwJIS8RcdNlE9mI39Qh8 q5vQn+Na8aG7nwlKoXB6uhuIFTd27Qg= X-Google-Smtp-Source: AGHT+IGkfRwcoNspq+YllcJae0kcoegnaVUYs8mFjq8oEAEaLhfiVwHx2LVjpsCt/x5TYZhypy3HNw== X-Received: by 2002:a05:6870:1049:b0:1e9:bda0:771 with SMTP id 9-20020a056870104900b001e9bda00771mr4132854oaj.4.1699529128834; Thu, 09 Nov 2023 03:25:28 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id y36-20020a056a00182400b0068790c41ca2sm10455953pfa.27.2023.11.09.03.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 03:25:28 -0800 (PST) From: JaimeLiao X-Google-Original-From: JaimeLiao To: linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, richard@nod.at Cc: jaimeliao@mxic.com.tw, jaimeliao.tw@gmail.com, angyanyu13@gmail.com Subject: [PATCH v3 3/5] mtd: spinand: Add continuous read state Date: Thu, 9 Nov 2023 19:24:58 +0800 Message-Id: <20231109112500.4966-4-jaimeliao@mxic.com.tw> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109112500.4966-1-jaimeliao@mxic.com.tw> References: <20231109112500.4966-1-jaimeliao@mxic.com.tw> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_032531_230398_1DCB62EC X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add continuous read state and initialize state to default false. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/core.c | 8 ++++++++ include/linux/mtd/spinand.h | 2 ++ 2 files changed, 10 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:4860:4864:20:0:0:0:2e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jaimeliao.tw[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add continuous read state and initialize state to default false. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/core.c | 8 ++++++++ include/linux/mtd/spinand.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index cfc295f5e31b..33ad401d3a34 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -193,6 +193,11 @@ static int spinand_init_quad_enable(struct spinand_device *spinand) enable ? CFG_QUAD_ENABLE : 0); } +static void spinand_init_continuous_read(struct spinand_device *spinand) +{ + spinand->use_continuous_read = false; +} + static int spinand_continuous_read_enable(struct spinand_device *spinand) { return spinand_upd_cfg(spinand, CFG_CONT_READ_ENABLE, @@ -1307,6 +1312,9 @@ static int spinand_init(struct spinand_device *spinand) goto err_cleanup_ecc_engine; } + /* Init continuous read */ + spinand_init_continuous_read(spinand); + return 0; err_cleanup_ecc_engine: diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index bb9288ffd898..263420b2338e 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -422,6 +422,7 @@ struct spinand_dirmap { * because the spi-mem interface explicitly requests that buffers * passed in spi_mem_op be DMA-able, so we can't based the bufs on * the stack + * @use_continuous_read: record the continuous read status * @manufacturer: SPI NAND manufacturer information * @priv: manufacturer private data */ @@ -450,6 +451,7 @@ struct spinand_device { u8 *databuf; u8 *oobbuf; u8 *scratchbuf; + bool use_continuous_read; const struct spinand_manufacturer *manufacturer; void *priv; }; From patchwork Thu Nov 9 11:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1861939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=SkG7/Ckv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=TD64UFbH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR05F4HsWz1yRV for ; Thu, 9 Nov 2023 22:26:09 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=DZ1b6L8sYb7ncweLzmnfV3jc4MJ0FQsneTOj3qJD8YE=; b=SkG7/CkvgU6NwG UhG+Z8b2ncAN+JpaRXICx275fH+0ysSeUSN/ksl5ZDZLFiA6Ltl2PVhT1s9mulME5rGGus1hV9z7k /CwCcS9JcHsD3YSwTqCIQOzAAQsqJ9tt6nXIkNuzKA7kv4PKjt13i3kaamROwIh92kWDdWYFJihhu NlXG/XQPnpcWB44fR6hXucM9r/9L6N/6Mu7DzWWp/XGYVW2MbB2AwW1aJJl2tZEQa8ejuAAFsTYA2 2oISqsxcb/EBW0z9ornD2u/3ul93WMmUzTCck7NgyTOh0ytTkyjoY0Edhdgx3J2Dc1zB6rKsoJWvd 15tr0GnhozhovsapPIQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r13AI-0063ZE-34; Thu, 09 Nov 2023 11:25:38 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r13AF-0063Wf-0y for linux-mtd@lists.infradead.org; Thu, 09 Nov 2023 11:25:37 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6c4b06af98bso476761b3a.2 for ; Thu, 09 Nov 2023 03:25:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699529131; x=1700133931; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=25nFi6OrBOjRJBr2BP/Tv/yTs9/pG21udy9nCvdLQVE=; b=TD64UFbH2whJNDQHtQfXHOKHGDkC4eBzHKaFJ67QgiUlahp9jho9/ZKTvYmX5Nsee/ lvu8htqNkqTXCfJ2PEnLJv57XePhClVlLwbi/+4/Xu5Y3fIHNEYsuPDc5Z1JN6mLRIjI W8KIve/4M09aEu21r+mlwAsyTzD0A4UBXTtjV78VCHQE2NB2P/1gaCmOPQuct/Ze9n3t RUAXF/uqfiZZaWZ8V4i/92EwAdQE/0cd6cv5jR+vrwVrs9F+pFwq2LX2qtqQ4ZVP859V zTjbB3qpkQZfIYr0LAZk0ogALJ1vhPGOsJ8vLQTez2rM4sB4ml/KJIK6ZAFqwVWcDHRM A+jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699529131; x=1700133931; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=25nFi6OrBOjRJBr2BP/Tv/yTs9/pG21udy9nCvdLQVE=; b=MOpqcNKTjkq0BoGTKybnOslqGGTbnSx0lAF6qq0h4d7ZET8ZaqTXpkyZerwdxSSlNj UEZ6JO3qHQXu3pL8uTEi4WNd9zMHwTzpPtzgUwRoUPDjGu2rssynUB3f9lO3FOWyTDsp mFS/lpnwQghABpjI3ZTPCgBZIl3PAiEjYbXq9KfCNcPihJFcmHp4DFko18jsTqe9H9YM UNUJCQ7A6dQyj9qNrgd6SXlMJ67tuZAt2nB++8saOjr04eWfamdk41JHkhizOOYpGlfo I4n6YFoUgLmQMLIGaqBvEmxRJZs1pcuOglXXyGENjThNgLEDSERwNPdaybghp+liFBPK 4QWA== X-Gm-Message-State: AOJu0YwqLG2/WzL10J77Aqog2VzyD7OIlA8DJS3si+S0LnuIHJTqNk+B zGYLz8cH1q+yomdfcvDfBkPoIPR0JX4= X-Google-Smtp-Source: AGHT+IE3pumuyUfExy8vq18k16MMw1DVRXpIRs9iI19I84gFBv8XCYhlJciouC2wX5CoCVLArUVE5A== X-Received: by 2002:a05:6a20:3b15:b0:136:e26b:6401 with SMTP id c21-20020a056a203b1500b00136e26b6401mr3749129pzh.16.1699529131451; Thu, 09 Nov 2023 03:25:31 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id y36-20020a056a00182400b0068790c41ca2sm10455953pfa.27.2023.11.09.03.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 03:25:31 -0800 (PST) From: JaimeLiao X-Google-Original-From: JaimeLiao To: linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, richard@nod.at Cc: jaimeliao@mxic.com.tw, jaimeliao.tw@gmail.com, angyanyu13@gmail.com Subject: [PATCH v3 4/5] mtd: spinand: Add support continuous read operation Date: Thu, 9 Nov 2023 19:24:59 +0800 Message-Id: <20231109112500.4966-5-jaimeliao@mxic.com.tw> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109112500.4966-1-jaimeliao@mxic.com.tw> References: <20231109112500.4966-1-jaimeliao@mxic.com.tw> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_032535_338498_A989449D X-CRM114-Status: GOOD ( 28.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The continuous read operation includes three phases: Firstly, starting with the page read command and the 1st page data will be read into the cache after the read latency tRD. Secondly, Issuing the Re [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jaimeliao.tw[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The continuous read operation includes three phases: Firstly, starting with the page read command and the 1st page data will be read into the cache after the read latency tRD. Secondly, Issuing the Read From Cache commands (03h/0Bh/3Bh/6Bh/BBh/EBh) to read out the data from cache continuously. After all the data is read out, the host should pull CS# high to terminate this continuous read operation and wait tRST for the NAND device resets read operation. To prevent read data length bigger than controller limitation, create a temperate operation for checking controller limitation and read data length. Exit continuous read mode and back to original read page method if data length bigger than controller limitation. Continuous reads have a positive impact when reading more than one page and the column address is don't care in this operation, a full page data will be read out for each page. The performance of continuous read mode is as follows. Set the flash to QUAD mode and run 25MHz direct mapping mode on the SPI bus and use the MTD test module to show the performance of continuous reads. As below is the test result on two cases. We could reduce time on continuous read when multiple page read. ===============Continuous====================== mtd_speedtest: MTD device: 0 count: 100 mtd_speedtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 64 mtd_test: scanning for bad eraseblocks mtd_test: scanned 100 eraseblocks, 0 are bad mtd_speedtest: testing eraseblock write speed mtd_speedtest: eraseblock write speed is 1298 KiB/s mtd_speedtest: testing eraseblock read speed mtd_speedtest: eraseblock read speed is 11053 KiB/s mtd_speedtest: testing page write speed mtd_speedtest: page write speed is 1291 KiB/s mtd_speedtest: testing page read speed mtd_speedtest: page read speed is 3240 KiB/s mtd_speedtest: testing 2 page write speed mtd_speedtest: 2 page write speed is 1289 KiB/s mtd_speedtest: testing 2 page read speed mtd_speedtest: 2 page read speed is 2909 KiB/s mtd_speedtest: Testing erase speed mtd_speedtest: erase speed is 45229 KiB/s mtd_speedtest: Testing 2x multi-block erase speed mtd_speedtest: 2x multi-block erase speed is 62135 KiB/s mtd_speedtest: Testing 4x multi-block erase speed mtd_speedtest: 4x multi-block erase speed is 60093 KiB/s mtd_speedtest: Testing 8x multi-block erase speed mtd_speedtest: 8x multi-block erase speed is 61244 KiB/s mtd_speedtest: Testing 16x multi-block erase speed mtd_speedtest: 16x multi-block erase speed is 61538 KiB/s mtd_speedtest: Testing 32x multi-block erase speed mtd_speedtest: 32x multi-block erase speed is 61835 KiB/s mtd_speedtest: Testing 64x multi-block erase speed mtd_speedtest: 64x multi-block erase speed is 60663 KiB/s mtd_speedtest: finished ================================================= ===============Normal============================ mtd_speedtest: MTD device: 0 count: 100 mtd_speedtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128 mtd_test: scanning for bad eraseblocks mtd_test: scanned 100 eraseblocks, 0 are bad mtd_speedtest: testing eraseblock write speed mtd_speedtest: eraseblock write speed is 4467 KiB/s mtd_speedtest: testing eraseblock read speed mtd_speedtest: eraseblock read speed is 2278 KiB/s mtd_speedtest: testing page write speed mtd_speedtest: page write speed is 4447 KiB/s mtd_speedtest: testing page read speed mtd_speedtest: page read speed is 2204 KiB/s mtd_speedtest: testing 2 page write speed mtd_speedtest: 2 page write speed is 4479 KiB/s mtd_speedtest: testing 2 page read speed mtd_speedtest: 2 page read speed is 2274 KiB/s mtd_speedtest: Testing erase speed mtd_speedtest: erase speed is 44982 KiB/s mtd_speedtest: Testing 2x multi-block erase speed mtd_speedtest: 2x multi-block erase speed is 33766 KiB/s mtd_speedtest: Testing 4x multi-block erase speed mtd_speedtest: 4x multi-block erase speed is 66876 KiB/s mtd_speedtest: Testing 8x multi-block erase speed mtd_speedtest: 8x multi-block erase speed is 67518 KiB/s mtd_speedtest: Testing 16x multi-block erase speed mtd_speedtest: 16x multi-block erase speed is 67792 KiB/s mtd_speedtest: Testing 32x multi-block erase speed mtd_speedtest: 32x multi-block erase speed is 67964 KiB/s mtd_speedtest: Testing 64x multi-block erase speed mtd_speedtest: 64x multi-block erase speed is 68101 KiB/s mtd_speedtest: finished ================================================= Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/core.c | 116 ++++++++++++++++++++++++++++++++++++ include/linux/mtd/spinand.h | 1 + 2 files changed, 117 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 33ad401d3a34..537302ea8281 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -386,6 +386,10 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, if (req->datalen) { buf = spinand->databuf; nbytes = nanddev_page_size(nand); + if (spinand->use_continuous_read) { + buf = req->databuf.in; + nbytes = req->datalen; + } column = 0; } @@ -415,6 +419,9 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, buf += ret; } + if (spinand->use_continuous_read) + goto finish; + if (req->datalen) memcpy(req->databuf.in, spinand->databuf + req->dataoffs, req->datalen); @@ -430,6 +437,7 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, req->ooblen); } +finish: return 0; } @@ -646,6 +654,92 @@ static int spinand_write_page(struct spinand_device *spinand, return nand_ecc_finish_io_req(nand, (struct nand_page_io_req *)req); } +static int spinand_mtd_continuous_read(struct mtd_info *mtd, loff_t from, + struct mtd_oob_ops *ops, + struct nand_io_iter *iter) +{ + struct spinand_device *spinand = mtd_to_spinand(mtd); + struct nand_device *nand = mtd_to_nanddev(mtd); + int ret = 0; + + /* + * Prevent data length bigger than controller limitation, create + * a temperate operation for checking. + */ + struct spi_mem_op op = SPINAND_READID_OP(0, 0, spinand->scratchbuf, ops->len); + ret = spi_mem_adjust_op_size(spinand->spimem, &op); + if (ret) { + return ret; + } + + if (op.data.nbytes != ops->len) { + pr_debug("%s: data length bigger than controller limitation\n", __func__); + return -ENOTSUPP; + } + + if (from & (nanddev_page_size(nand) - 1)) { + pr_debug("%s: unaligned address\n", __func__); + return -ENOTSUPP; + } + + /* + * Continuous read mode could reduce some operation in On-die ECC free + * flash when read page sequentially. + */ + iter->req.type = NAND_PAGE_READ; + iter->req.mode = MTD_OPS_RAW; + iter->req.dataoffs = nanddev_offs_to_pos(nand, from, &iter->req.pos); + iter->req.databuf.in = ops->datbuf; + iter->req.datalen = ops->len; + + ret = spinand_continuous_read_enable(spinand); + if (ret) + return ret; + + spinand->use_continuous_read = true; + + ret = spinand_select_target(spinand, iter->req.pos.target); + if (ret) + return ret; + + /* + * The continuous read operation including: firstly, starting with the + * page read command and the 1 st page data will be read into the cache + * after the read latency tRD. Secondly, Issuing the Read From Cache + * commands (03h/0Bh/3Bh/6Bh/BBh/EBh) to read out the data from cache + * continuously. + * + * The cache is divided into two halves, while one half of the cache is + * outputting the data, the other half will be loaded for the new data; + * therefore, the host can read out the data continuously from page to + * page. Multiple of Read From Cache commands can be issued in one + * continuous read operation, each Read From Cache command is required + * to read multiple 4-byte data exactly; otherwise, the data output will + * be out of sequence from one Read From Cache command to another Read + * From Cache command. + * + * After all the data is read out, the host should pull CS# high to + * terminate this continuous read operation and wait a 6us of tRST for + * the NAND device resets read operation. The data output for each page + * will always start from byte 0 and a full page data should be read out + * for each page. + */ + ret = spinand_read_page(spinand, &iter->req); + if (ret) + goto continuous_read_error; + + ret = spinand_reset_op(spinand); + if (ret) + goto continuous_read_error; + +continuous_read_error: + spinand->use_continuous_read = false; + ops->retlen = iter->req.datalen; + + ret = spinand_continuous_read_disable(spinand); + return ret; +} + static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { @@ -665,6 +759,28 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, old_stats = mtd->ecc_stats; + /* + * If the device support continuous read mode and read length larger + * than one page size will enter the continuous read mode. This mode + * helps avoid issuing a page read command and read from cache command + * again, and improves read performance for continuous addresses. + */ + if ((spinand->flags & SPINAND_HAS_CONT_READ_BIT) && + (ops->len > nanddev_page_size(nand))) { + ret = spinand_mtd_continuous_read(mtd, from, ops, &iter); + + mutex_unlock(&spinand->lock); + + if (ret == -ENOTSUPP) + goto read_each_page; + + if (ecc_failed && !ret) + ret = -EBADMSG; + + return ret ? ret : max_bitflips; + } + +read_each_page: nanddev_io_for_each_page(nand, NAND_PAGE_READ, from, ops, &iter) { if (disable_ecc) iter.req.mode = MTD_OPS_RAW; diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 263420b2338e..4b8fe27eb6b8 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -313,6 +313,7 @@ struct spinand_ecc_info { #define SPINAND_HAS_QE_BIT BIT(0) #define SPINAND_HAS_CR_FEAT_BIT BIT(1) +#define SPINAND_HAS_CONT_READ_BIT BIT(2) /** * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure From patchwork Thu Nov 9 11:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1861940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bnu+GuNz; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=giR+aPl5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR05H5D1sz1yQl for ; Thu, 9 Nov 2023 22:26:11 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=SQ2P5I8oCMliAyHJYEmb1cnEvmExRntN2S1cy+BoqTU=; b=bnu+GuNzH+IxdC mouhnM0yc8fkBSWUU6Fs2+4T8C4bJoE43UpK7mzakKkfT5Tjd/0rZ7fEaPVId+rxzJaFfSJOKBHVp a5GDjUXIoaSDIot6wMLltT4uGGBY2zIteq4AB0TKlejoEjmHEXHocAEdUDT3b13SAutvmKaZZI4Y9 SLz72kehLs6BHqvEusXUUt06o5ZF0cAu9W/c1Hf45hJBJcm1yaWHUCb1aJ3+Whxd8MjdQZd3eFLIU aKy12AWliZAMUwb0zksYosKLSjNO1z6uVX4HWCnGP9LWgjt44U7ATmW0VOWP+vDkR4qGOl2/HzBI5 TgSYiFeJblwQqhgluCBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r13AL-0063Zm-1x; Thu, 09 Nov 2023 11:25:41 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r13AH-0063Xf-2b for linux-mtd@lists.infradead.org; Thu, 09 Nov 2023 11:25:39 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so787870b3a.0 for ; Thu, 09 Nov 2023 03:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699529134; x=1700133934; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=il4/PY5BDyM7db87KIoCyHawc+72HGUS4y4nNXmHSKk=; b=giR+aPl5Ipr6zTkOSuBZEN3v3T9mWKBRj5iy0TPF/eQpFowBE/+z/OzA2E0j/zu95w FWtntduQNSFHQ1m4sOyLQ+zcsWx/Ax/nKq1kMzaVj7aOTxSk0/Rp6INakNUeZhreJm+l 81/hdrbOswpoF2ql3fGBj7zBzqkCoDsxlvSP7s9wMhWDhc6ej8E3wT73FPyQp/bhqKW8 SS6F0+8e2e0bSheHOec4VVv0cKlcYVddW+i3J86Xu/kgmTQ41A67Qvq9TLcBkQl4pFJn ovDDpAgnRDw9NlbeVB0lcJKIfYJikcAYyYHfedGFUj6z11PieY6BmzSLGrE50C83U+GK e2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699529134; x=1700133934; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=il4/PY5BDyM7db87KIoCyHawc+72HGUS4y4nNXmHSKk=; b=dFRxR014P6JW68rwAWs3uzuq7zwOTwP/S1qkpoM3PkiMPqRx0tt5eevcLK30I5Za9g gfCsX6zKusi5bdaUQ47DLhTjKFWu81hC0wXkJXkVmhbWMxqdQiWziynFMRvr53EO4PSU urGGFtg9O9RfRNyBaRIOHDt6RwVFSBYuQGA61WzgrlVkzSKygT+kq83Xcx/69XF8uvAR pmZAu8kmybzNaquwcxKTcsQgQ0VBtkBdQNyRZx//kTiSXSR3i2MbgpIZEfrEfftvbiuS 4Gx4JWflOTqGwcHWwp+3Rm4dInjykbp0kNirh8zUJeSxx3iGB/mNiz+lV2hJ9uy/g8Ar Fetw== X-Gm-Message-State: AOJu0YxJCdLdy8/pXmEysTtYrdhKSO2N7fRjbKZPD07vqj4lVsKlP+74 XrDFMoXtt928OAvD5JGaY6VwULXwYTM= X-Google-Smtp-Source: AGHT+IH4KByi/3QO2YnGLvXN8gr/rdNKMxFQ0xrMvOGSIQte2LBEM0lvN7nNttxtNoaEZ6gJg+AJ6g== X-Received: by 2002:a05:6a00:888:b0:6be:319:446b with SMTP id q8-20020a056a00088800b006be0319446bmr5396051pfj.21.1699529134342; Thu, 09 Nov 2023 03:25:34 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id y36-20020a056a00182400b0068790c41ca2sm10455953pfa.27.2023.11.09.03.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 03:25:34 -0800 (PST) From: JaimeLiao X-Google-Original-From: JaimeLiao To: linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, richard@nod.at Cc: jaimeliao@mxic.com.tw, jaimeliao.tw@gmail.com, angyanyu13@gmail.com Subject: [PATCH v3 5/5] mtd: spinand: macronix: Add continuous read support for Macronix Flash Date: Thu, 9 Nov 2023 19:25:00 +0800 Message-Id: <20231109112500.4966-6-jaimeliao@mxic.com.tw> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109112500.4966-1-jaimeliao@mxic.com.tw> References: <20231109112500.4966-1-jaimeliao@mxic.com.tw> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_032537_843984_D77E0730 X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add continuous read flag for those flash with continuous read feature. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/macronix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:431 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jaimeliao.tw[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add continuous read flag for those flash with continuous read feature. Signed-off-by: JaimeLiao --- drivers/mtd/nand/spi/macronix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c index 3dfc7e1e5241..69c9c9dfe672 100644 --- a/drivers/mtd/nand/spi/macronix.c +++ b/drivers/mtd/nand/spi/macronix.c @@ -127,7 +127,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35LF4GE4AD", @@ -137,7 +137,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35LF1G24AD", @@ -215,7 +215,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35UF2G14AC", @@ -245,7 +245,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35UF2GE4AC", @@ -255,7 +255,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35UF1G14AC", @@ -285,7 +285,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), SPINAND_INFO("MX35UF1GE4AC", @@ -295,7 +295,7 @@ static const struct spinand_info macronix_spinand_table[] = { SPINAND_INFO_OP_VARIANTS(&read_cache_variants, &write_cache_variants, &update_cache_variants), - SPINAND_HAS_QE_BIT, + SPINAND_HAS_QE_BIT | SPINAND_HAS_CONT_READ_BIT, SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)),