From patchwork Fri Dec 20 11:31:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182233 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp401360ilf; Fri, 20 Dec 2019 03:32:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwUygQIqfaSrvPubhi/FDvxk0g1rsiWQP0qz5zW2jD9j6tRMGLlvnFZ5qVHzDq6yybJAsqB X-Received: by 2002:a65:640e:: with SMTP id a14mr13269454pgv.402.1576841567750; Fri, 20 Dec 2019 03:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841567; cv=none; d=google.com; s=arc-20160816; b=Gs5Ixy4YjlrMDTMdeANZTzUiNgKntNiCslKAWVSYeme3pSF7P3jfJJeQp0t5FUU9aa NWjaRT+IcpgZ9rclRLyMzuYtpcxZa89iUp9UOILNkNIOrscr3TU4rT109MfY4VxG2ab/ 9A+q/r41ItC7U25Jp+Jii1VypwzEsciHdiI1RI44l3swYqE9G7NJOZSQZ4SPLWmB/DEj n+AIFH1vTYP6XZIl2+CRAY+PdRvHasX4fm20mAE/8rRRX9B3/fKmJzvsqXqfWzvHDy07 MfhAOfR7ZKICwLiCUluIrU3JJLimKjuKP7n8uQVQIPgd1PULe7LCE3VFUD+JSkeehku/ 32lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=NjqJCYHhSiFWuE3VDpaD3AaSrzULMYvDZNr68qdQ+Gk=; b=N/s7ZmOJVQr9TGQVmtbIuCtBZoRfDmrKhWCdpgGzTI3KaewuzVM7LWNATGUiD+RIX+ 6zNxDf0JXBeon2XiBINKWx9hLkl3WNOOVG/ONbSKbSyk/hHltChCvRx6YiXG8vNS2bjV AxD+WIn61scL9UMZ/B+b17vOpFEEbkUI1/6cAMas9IyUC+5A4X0hEnOmz8CQEBrAI4hd w/k7VOCJpuKthK4jNN29U3V5qDQ/2OTH6fy5glIxAQY5ZrubGfoNSbx4+kVNr/ElRJKx Zv3Rh4WnJGmgiPQYoxizsBh+8evTTv45cFJm9koqNKip4J49KWDJ0oOXTyg2WOWR81F7 Bjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VBEo+jVy; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=pL9OgSTY; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id d4si8713227pgb.140.2019.12.20.03.32.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:32:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VBEo+jVy; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=pL9OgSTY; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NjqJCYHhSiFWuE3VDpaD3AaSrzULMYvDZNr68qdQ+Gk=; b=VBEo+jVywdU7UHtXwev3ptuljP yuI+wqwV27nfykkbV9Trz6RWPmqSnZ4PcC4PY1Ih3KCq2Z6Jau5BCax/HoH/7BqVeIgwxUrdw+OS8 os48KXIL0FZUpZrWdLnHwscIpCJUz1HPyjc6Y+zLnOr5siPfRKa7I8rb4dg/zGpwOTnZjIKloysXo u5EZzOxuwr6Ros6BTWLuij2Nz8/aHR1eggqNupnrS+MdLebHqa/3zCqFg+fzZEOXS9iKZgKMMTZPO s7OfbURws+DnF9DUdQXT0LHYDYPiRuT04O6woW2hYJ1G0nu2FcHIYHX1cDoFSX6Cy+CIVuWy4JRJU aBVlkQVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWL-00009d-8S; Fri, 20 Dec 2019 11:32:37 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWH-000081-C8 for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:35 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2Wu010984; Fri, 20 Dec 2019 20:32:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2Wu010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841525; bh=WGVhzVxsVRHHV9K5PX1qsTPL9sZ/TX/2a6e9iLEFkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pL9OgSTYihHRsBMj0HJjckEVg+6jPwcYJ1MVymxrrVFMOSwkVPwH7zMi6+cqfTCpH waSMA/0JLXDGt1amff3gogIeH8tQIeV5TIkhEp2veEcozWQkOyN1cDfw4CG9S9mzme VmWg0vxUnZMBUwaYk9yc+DBk5l32sknvf8bf3mW1erkUZix5UhNzdBni865Gv6eH/c sH7HiR2XHewDHs29xNJCrqoBlyd3Nc+9MS6sLcsGT3qRvd3uMmk1ax8dGPrrOuQ3Q+ J6o0e8RgsGWUsXhszV0iZoHaqDbv4dJ/MQYhcl8JCrwjZE1oWUjazczErtLbQ09cbS E1FDCqDymC9iw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 1/5] mtd: rawnand: denali_dt: error out if platform has no associated data Date: Fri, 20 Dec 2019 20:31:51 +0900 Message-Id: <20191220113155.28177-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033233_778909_74662682 X-CRM114-Status: UNSURE ( 8.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org denali->ecc_caps is a mandatory parameter. If it were left unset, nand_ecc_choose_conf() would end up with NULL pointer access. So, every compatible must be associated with proper denali_dt_data. If of_device_get_match_data() returns NULL, let it fail immediately. Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali_dt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 8b779a899dcf..276187939689 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -118,11 +118,12 @@ static int denali_dt_probe(struct platform_device *pdev) denali = &dt->controller; data = of_device_get_match_data(dev); - if (data) { - denali->revision = data->revision; - denali->caps = data->caps; - denali->ecc_caps = data->ecc_caps; - } + if (WARN_ON(!data)) + return -EINVAL; + + denali->revision = data->revision; + denali->caps = data->caps; + denali->ecc_caps = data->ecc_caps; denali->dev = dev; denali->irq = platform_get_irq(pdev, 0); From patchwork Fri Dec 20 11:31:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182234 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp401490ilf; Fri, 20 Dec 2019 03:32:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyBm3x3pZ0jvLzwebJq3sJZqWRmd2zWtCx5MEDrAQ3bp+OgGlsU9X0+YSEXJn3Jknmw8i2v X-Received: by 2002:a17:90a:a88d:: with SMTP id h13mr7176413pjq.48.1576841573761; Fri, 20 Dec 2019 03:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841573; cv=none; d=google.com; s=arc-20160816; b=CFOpe2BB/dZyZj4A2gxvGcBMan/qNNZGXoD5ooFMLbpbMJb+vmvG4jFzi2ML8uCV4E +v4m4e7jD8G9DyRf+5bLk9HRquidMIEYm/LrH04eP70arb1Tuo5kAmMGiBDYsWBFx+T7 bXcsebKgNFfSDq8GUsIJ8rCj7sULTzizgQMvsOlkaKOJF8AMUCgZ/8pxlr5QXcRyk8en EbRz6xcoWuDuCwQ0omqUFp9L9ir4453lBNiIwpStoFxU/57vVyJm0Wv/vwOWE6y33sMJ sksB259NEZpEqAi1qjLM/nk7QWznjfqlN8qCGiPiPMU25bz+X/KPjVlBrOPg8LbI03c+ v9gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=XvWjCVoT5tkYoNuQ+zWVdRuG33AV7RPm5vATnSLpBPo=; b=eqs+nKg8pNEjbjCIOzWRiKfpGrmQdXfZnnAWYWANsQdztj3KmYewP9QefbJW6EVBhO CESdph4FEMqg6af04124myAAMXYJ2rHnofXUP4/5dh7RGDhP43ZnTNqqXXtsn0Uu70E9 +QmvB43PwPDntetghX8veJ7InHfxh5BwCbGv2Y9Bwcfj9E+zmnLPdkUszWSx9iMnzvbb s58/X4LoLRQyQ5ffKnpr/FRXwTV89ZqtFOSU69nJzA1N4wTlzt2BtJnCpPHrRODguSVO S3gn8hkahw4sVP2c3dhtFcc7E3bTT3B0e2azPQMh+q1EQ6zrLA4vY+t/CYQvDxST0EMp HKWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=E3RHGTXC; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=M98RO5g7; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id n6si8616491pgt.149.2019.12.20.03.32.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:32:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=E3RHGTXC; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=M98RO5g7; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XvWjCVoT5tkYoNuQ+zWVdRuG33AV7RPm5vATnSLpBPo=; b=E3RHGTXCDJ4JNT15H3k24g37XA i3wlk0iNzSkM2aHKPtUnHmSqGFThp+h2WnmtQgHHKyAxrlb1hzZgnS2inOGGsWL/2pP3Z9U3vzqnj gin0UwerhNxOM+FI2iMjywSs0NUBbdMu+Gpr9S33pNNFMKKuy60nuRdtPooDzMTn14vVggMG/V1Ry ZsWsJZa6u+dNYfN4pAiWFl3lTWTBEYI7ZvthRruv48fz2hIowKlkzbQOoljLdmIWLJOUpK3a8vBT0 ymyTDmAR9Cdz5bgKav+83OA541o4vWyO8+4h3O63ThzRImqGOv8QWiaXZ6GAgneFbX2b9kUcN5E2a UhRnUV8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWS-0000II-JZ; Fri, 20 Dec 2019 11:32:44 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWH-00007z-Fe for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:35 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2Wv010984; Fri, 20 Dec 2019 20:32:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2Wv010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841526; bh=v9133Ufzc3+ic87B/K3hcV7PpJe8R3xx9bGS9VeHmEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M98RO5g7Dl+IAFl7CBY+mE2aAH6WsodGaRO14yB70GRQtJ/zXz5KxVoKOYBEwkVqD nvBZtrCP3vhs0Y+rqnXwygAFssqIuSPG5RA+th90akWkzXELLHOgpWbOJq6K4lPqmU DlG33DyVywWfSGPVGK2KL20+W0S1Po59s1hjfK0ux31s9VACxK60mKHCQD/TykjcPp hiHE44ptkLTt95kgcWQg5Ga6nB3OhwdmrHehB/FadonjX97MTSKx7S9pcUBuuej2ge OvxWrWQtlM4tv0vTZZL1tbkrP/EcwxIdqITIN0czJgAvnLTDGN1bzW7q/8wD0KFCoT GzswpdCvKwEaA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 2/5] mtd: rawnand: denali_dt: Add support for configuring SPARE_AREA_SKIP_BYTES Date: Fri, 20 Dec 2019 20:31:52 +0900 Message-Id: <20191220113155.28177-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033233_769721_E1F6C00D X-CRM114-Status: GOOD ( 17.99 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org From: Marek Vasut The SPARE_AREA_SKIP_BYTES register is reset when the controller reset signal is toggled. Yet, this register must be configured to match the content of the NAND OOB area. The current default value is always set to 8 and is programmed into the hardware in case the hardware was not programmed before (e.g. in a bootloader) with a different value. This however does not work when the block is reset properly by Linux. On Altera SoCFPGA CycloneV, ArriaV and Arria10, which are the SoCFPGA platforms which support booting from NAND, the SPARE_AREA_SKIP_BYTES value must be set to 2. On Socionext Uniphier, the value is 8. This patch adds support for preconfiguring the default value and handles the special SoCFPGA case by setting the default to 2 on all SoCFPGA platforms, while retaining the original behavior and default value of 8 on all the other platforms. Signed-off-by: Marek Vasut Cc: Miquel Raynal Cc: Richard Weinberger Cc: Vignesh Raghavendra To: linux-mtd@lists.infradead.org Reviewed-by: Tudor Ambarus Acked-by: Masahiro Yamada --- Changes in v3: [Masahiro] - Rebase and give my Acked-by Changes in v2: - V2: Move denali->oob_skip_bytes = data->oob_skip_bytes; right after of_device_get_match_data() drivers/mtd/nand/raw/denali.c | 13 ++++++++++--- drivers/mtd/nand/raw/denali_dt.c | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 3102ddbd8abd..b6c463d02167 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -1302,14 +1302,21 @@ int denali_init(struct denali_controller *denali) /* * Set how many bytes should be skipped before writing data in OOB. + * If a non-zero value has already been configured, update it in HW. * If a non-zero value has already been set (by firmware or something), * just use it. Otherwise, set the driver's default. */ - denali->oob_skip_bytes = ioread32(denali->reg + SPARE_AREA_SKIP_BYTES); - if (!denali->oob_skip_bytes) { - denali->oob_skip_bytes = DENALI_DEFAULT_OOB_SKIP_BYTES; + if (denali->oob_skip_bytes) { iowrite32(denali->oob_skip_bytes, denali->reg + SPARE_AREA_SKIP_BYTES); + } else { + denali->oob_skip_bytes = + ioread32(denali->reg + SPARE_AREA_SKIP_BYTES); + if (!denali->oob_skip_bytes) { + denali->oob_skip_bytes = DENALI_DEFAULT_OOB_SKIP_BYTES; + iowrite32(denali->oob_skip_bytes, + denali->reg + SPARE_AREA_SKIP_BYTES); + } } iowrite32(0, denali->reg + TRANSFER_SPARE_REG); diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 276187939689..699255fb2dd8 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -27,6 +27,7 @@ struct denali_dt { struct denali_dt_data { unsigned int revision; unsigned int caps; + unsigned int oob_skip_bytes; const struct nand_ecc_caps *ecc_caps; }; @@ -34,6 +35,7 @@ NAND_ECC_CAPS_SINGLE(denali_socfpga_ecc_caps, denali_calc_ecc_bytes, 512, 8, 15); static const struct denali_dt_data denali_socfpga_data = { .caps = DENALI_CAP_HW_ECC_FIXUP, + .oob_skip_bytes = 2, .ecc_caps = &denali_socfpga_ecc_caps, }; @@ -42,6 +44,7 @@ NAND_ECC_CAPS_SINGLE(denali_uniphier_v5a_ecc_caps, denali_calc_ecc_bytes, static const struct denali_dt_data denali_uniphier_v5a_data = { .caps = DENALI_CAP_HW_ECC_FIXUP | DENALI_CAP_DMA_64BIT, + .oob_skip_bytes = 8, .ecc_caps = &denali_uniphier_v5a_ecc_caps, }; @@ -51,6 +54,7 @@ static const struct denali_dt_data denali_uniphier_v5b_data = { .revision = 0x0501, .caps = DENALI_CAP_HW_ECC_FIXUP | DENALI_CAP_DMA_64BIT, + .oob_skip_bytes = 8, .ecc_caps = &denali_uniphier_v5b_ecc_caps, }; @@ -123,6 +127,7 @@ static int denali_dt_probe(struct platform_device *pdev) denali->revision = data->revision; denali->caps = data->caps; + denali->oob_skip_bytes = data->oob_skip_bytes; denali->ecc_caps = data->ecc_caps; denali->dev = dev; From patchwork Fri Dec 20 11:31:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182238 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp402524ilf; Fri, 20 Dec 2019 03:33:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyzyNPcwyOL3cVfGIkI4CXwHOvFeG87aH39W4jl8t9oKSx+mEUEwm/JFyW1pvyYzb1paUo3 X-Received: by 2002:a17:90a:f48a:: with SMTP id bx10mr2501169pjb.106.1576841630818; Fri, 20 Dec 2019 03:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841630; cv=none; d=google.com; s=arc-20160816; b=kwAVK2jZH95F+lLVYd7ohXPyvExsXMf+FiiyZUug5/o1dDp0Bw0IC8R9s0R/mgWX4e NIqGnU2Mc0iqJcOZrrkJTBRPdVAoRzAJdG00782OKp1WhitEOVEInhb76GyelLadPQBR N3Kon37yn+u4+9GjAy6DkuRj9akczUDzsEFUIz4oVH3vN6ZvxjqDvMIo7dWdNAOklx7n Vv9J8PNGXWswLllnxBBGDyMxHkQ4tSStv3B4lm+b0m3ErA/+hoC9yB3P2SBvfDFYF+7k EGfqxnek1ccVz/SLlURd2Mn1FOR6QGuDASLZzse5NYFCfUlnwrApFN8JC7z6mW5nMxZa PXrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=jKud0ho6WOa3AeIfoDIUEpbpy4JMYq3GhNKqwjtZZpM=; b=BOUWcEnp60OLQFup7Jnqma+aLCWiPAdfEJuA8wToJQJnxNsS8CSyP2VH4NLOvZvjIn jQvaeQNz0TkPthOIKGkv1ysgDSVyF7hQ7ucHtHxlDeNkMNeGoNW+xul1iIY4ohntjKw/ pkDUIb2QBdwwsYB6tgKr4TqCxN70+rgQUdf5fwyWmMZvVpu5dJ/in883HVlcqx8+t96u TXkScvA4sPUdIIxtETRIiTSe3t+VgS6P2055Zhtvx5Db/Wj89j95oelswIbmodTCFvQx cSq1QO/RPDA9T9eeSDNBtuOYnnuZ4gUIKX81nk3Xlm1VRLKmlHtNBiH71Bcr7SaXZcFu tr5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=TyaIW24t; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=q9tqyp34; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id c1si8631122plo.419.2019.12.20.03.33.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:33:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=TyaIW24t; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=q9tqyp34; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jKud0ho6WOa3AeIfoDIUEpbpy4JMYq3GhNKqwjtZZpM=; b=TyaIW24thue6VNc0CW2oYOWegH bGBAALiMKHf+ri3z2WPDjrU+d+4Qhv66EPC29rQpOT1w7Ab/Li+emTEe5pk1r2ZNLloZ0lPpOi6x+ OWuOO+YfMcsAWQ9hV5ZTGP+PM7tTcxWrlEASi80+p55VdcNUUszh31SpwbD4yuGTpYu0NDfCtd4fy iHSWc3F2/CJ52NUcFLbFhQVaVkUlVdRsRY2W+KCp6ZBVdL2KyU//FVTUg4ftFHb6vjLLfRFnfpGmE oa8r45mpY4VXMATG9/xiiosorS+6MoqrSytn8Lpbf7P3JyCE/ICuKiU/uY7VJm3mVTR0jU3Ctsoek sJYCHL0A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGXN-0001E2-Cz; Fri, 20 Dec 2019 11:33:41 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWK-00008z-0v for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:37 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2Ww010984; Fri, 20 Dec 2019 20:32:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2Ww010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841527; bh=ebkAQxjiSXSHSZJ50xrvpwnSGWgbaQckYjuIVK7i+/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9tqyp34bhuaZ8GMgUE6ux1iJpphWD4rLGw+wcOCE6Rmvg9RsG2iADpLVJq23mfEH EKszhamf4xolnnBF9Tk0a1T51iAqU7ozV67syYV0bhjRgOZwTMjiD0uz+7A+MPhhsd KrNKu4L6JeP8gJk9W68BijvkwYfn1N2tSDJ6Ul2f/pwakP53oMZNTbpVpNwOqV6p/6 y7dDFdFHv6qW4DFaiwqtHxF1OQI+s13YiYpijQCjUGiIpkuxxZJBdcYiUOL9n5csuR v//dM1ziup0I4YKIn1nhiMEdKFJWrNuyJeEgzyplbWpUZgmdZ2cLmL3Vzuf8uALnPo oFqGr1ohj2VOw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 3/5] dt-bindings: mtd: denali_dt: document reset property Date: Fri, 20 Dec 2019 20:31:53 +0900 Message-Id: <20191220113155.28177-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033236_287266_C2A4AC15 X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Mark Rutland , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , devicetree@vger.kernel.org, Rob Herring , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org According to the Denali NAND Flash Memory Controller User's Guide, this IP has two reset signals. rst_n: reset most of FFs in the controller core reg_rst_n: reset all FFs in the register interface, and in the initialization sequencer This commit specifies these reset signals. It is possible to control them separately from the IP point of view although they might be often tied up together in actual SoC integration. At least for the upstream platforms, Altera/Intel SOCFPGA and Socionext UniPhier, the reset controller seems to provide only 1-bit control for the NAND controller. If it is the case, the resets property should reference to the same phandles for "nand" and "reg" resets, like this: resets = <&nand_rst>, <&nand_rst>; reset-names = "nand", "reg"; Signed-off-by: Masahiro Yamada Acked-by: Rob Herring --- Changes in v3: None Changes in v2: - Split into two patches Documentation/devicetree/bindings/mtd/denali-nand.txt | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt b/Documentation/devicetree/bindings/mtd/denali-nand.txt index b32aed1db46d..98916a84bbf6 100644 --- a/Documentation/devicetree/bindings/mtd/denali-nand.txt +++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt @@ -14,6 +14,11 @@ Required properties: interface clock, and the ECC circuit clock. - clock-names: should contain "nand", "nand_x", "ecc" +Optional properties: + - resets: may contain phandles to the controller core reset, the register + reset + - reset-names: may contain "nand", "reg" + Sub-nodes: Sub-nodes represent available NAND chips. @@ -46,6 +51,8 @@ nand: nand@ff900000 { reg-names = "nand_data", "denali_reg"; clocks = <&nand_clk>, <&nand_x_clk>, <&nand_ecc_clk>; clock-names = "nand", "nand_x", "ecc"; + resets = <&nand_rst>, <&nand_reg_rst>; + reset-names = "nand", "reg"; interrupts = <0 144 4>; nand@0 { From patchwork Fri Dec 20 11:31:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182235 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp401662ilf; Fri, 20 Dec 2019 03:33:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxCm6Wo+pneDsO5KyPwFwEs0z5nG/KbaaJ0M6Tw11plT2tRiT4OAANWH48v6oBxwELWKYkv X-Received: by 2002:a63:1322:: with SMTP id i34mr14704570pgl.163.1576841583904; Fri, 20 Dec 2019 03:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841583; cv=none; d=google.com; s=arc-20160816; b=c62jTlMkn3sU48qijJ6itfY4GoIufE1bcC4gP21G07l1qp7wlQ2304Di3CugTylVcR 74yZu0KxJtlJH9WBZPJGDLY1aJFFs0Gv3cahvlUDM8okMFT4bawy7kn79FwWhFWN1yh2 8FRY9SaIfILnjvCMUx/pMJDbI2JMbcBG37lQCTPIIO/EK05Qyv0KMPglRLPBRI2w7CR5 1UxUtvqdqxXCSqcWitNyks13Bl3xqzpD7eBqe+5TsmOvdqnoRCRHUV7QCB1FoOBcvnum JeWhKyG33jAu1OO4PUmrME8vR0lWsr0a1bCnp5i/IGv+hRrjJcWMZlp7s9LtzJ7MaEkD OJQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=SDN+S/pmxufOyXnMNb6a8S1O3rnOHNNCkI+4kM0LRGA=; b=YKzl0JOaCvlAloO1333NQeQPM8tQLxfP2zQpjpvkVPwwi8f6xPFddZ+sc8ja+/sQtN iUHv+8VvDaPsu1gA6H9WKBIU2rLTWMGC9zU9dKVb0fLcOaiJkQIoKk2YtVyB6/D1N8jf EOf0LmFHZ+Nm3GYY/Cd5lH8YNX6XkU6pKAUyAhMj3EZK9tjcFAmafOC38Mdy9ymCh7e4 1G0ZHysoPdZY1lOs/vtoWtAmCqJf24l357zWtIRK/gQlqVbZTajV2cgpYrWpAdXiWfMi 3cNyU3opNX0kEiD1iJtZeCMyygcuuoUFj/Ozl85hXDASPnRLvJED+2CH5xlsnA4VqG/L x9pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=OWNPoN+S; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="GrQ/g5y0"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id y1si8910802pgh.459.2019.12.20.03.33.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:33:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=OWNPoN+S; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="GrQ/g5y0"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=SDN+S/pmxufOyXnMNb6a8S1O3rnOHNNCkI+4kM0LRGA=; b=OWNPoN+SQbO72XkRc8IyQV1+JT QQdzI/ktzFOwE1H8BC3zVQaFKFNlbhQa9yzfaC2T4myKf4Ip5wnib34cMdRbaGBr+K5qy4sk4yh8O NFrsqOETPbdiXGGMe0Vd0fpYN/ePzP5jyrib9kLG+IGcd4jWRnYXr3rVawYw5UxsQ4Jgjsvrie4Dn uqXpN0i03Z+/8knAYEqv8jVZrwHaZOjbvglrA6YTSrA/4VtB4JlT1pbrNv0RoGo3tCKZIk/1x5Be5 oec8B/LlRW3FKGsJxVRa/D9RXwxPbT2TIlpegtmE4apT7ZrWiLM8v/OicXbCA0WG1gaE7/Ofvhodl rnE7B8kw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWc-0000UG-B0; Fri, 20 Dec 2019 11:32:54 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWH-000080-DI for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:36 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2Wx010984; Fri, 20 Dec 2019 20:32:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2Wx010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841528; bh=my3TOmqDy5To4BV9jpt+Keyp543Zjs/fVShQ11GouiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrQ/g5y07vaA+qagWKN4ACyos7dSCu3OP+vo82RhtqmGC1SD66KHa/mcr8g6AdmZD vP+JYrQRNB8tyQa/GHNiy9PMwjfoj/Hs9CPu4RWQke/JbJFvCGMyDPnhbJYPkxZ2Gt ENEHjS6//KSTMqGFmWPEyG3eR9ZdfYuJ53QCoVVuYGEUFNJHPXviwjpP0809uJLJRE GURkaFBN915RVcg5jgbh6wctnpTXPcte0qNUnvt/AlsXcKFXUDO71gXrs0DVL2hk5l nALGwybjYsRnFXCiCtaa/L1H7NkXK6e/ppcT8MfY7j5shzl0e3h1kpLlI4hH3B4qck o4tEkPUQPE64A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 4/5] mtd: rawnand: denali_dt: add reset controlling Date: Fri, 20 Dec 2019 20:31:54 +0900 Message-Id: <20191220113155.28177-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033233_774451_970A329C X-CRM114-Status: GOOD ( 18.23 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , Philipp Zabel , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org According to the Denali NAND Flash Memory Controller User's Guide, this IP has two reset signals. rst_n: reset most of FFs in the controller core reg_rst_n: reset all FFs in the register interface, and in the initialization sequencer This commit supports controlling those reset signals. It is possible to control them separately from the IP point of view although they might be often tied up together in actual SoC integration. The IP spec says, asserting only the reg_rst_n without asserting rst_n will cause unpredictable behavior in the controller. So, the driver deasserts ->rst_reg and ->rst in this order. Another thing that should be kept in mind is the automated initialization sequence (a.k.a. 'bootstrap' process) is kicked off when reg_rst_n is deasserted. When the reset is deasserted, the controller issues a RESET command to the chip select 0, and attempts to read out the chip ID, and further more, ONFI parameters if it is an ONFI-compliant device. Then, the controller sets up the relevant registers based on the detected device parameters. This process might be useful for tiny boot firmware, but is redundant for Linux Kernel because nand_scan_ident() probes devices and sets up parameters accordingly. Rather, this hardware feature is annoying because it ends up with misdetection due to bugs. So, commit 0615e7ad5d52 ("mtd: nand: denali: remove Toshiba and Hynix specific fixup code") changed the driver to not rely on it. However, there is no way to prevent it from running. The IP provides the 'bootstrap_inhibit_init' port to suppress this sequence, but it is usually out of software control, and dependent on SoC implementation. As for the Socionext UniPhier platform, LD4 always enables it. For the later SoCs, the bootstrap sequence runs depending on the boot mode. I added usleep_range() to make the driver wait until the sequence finishes. Otherwise, the driver would fail to detect the chip due to the race between the driver and hardware-controlled sequence. Signed-off-by: Masahiro Yamada Reviewed-by: Philipp Zabel --- Changes in v3: None Changes in v2: - Split into two patches drivers/mtd/nand/raw/denali_dt.c | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 699255fb2dd8..f08740ae282b 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -14,6 +15,7 @@ #include #include #include +#include #include "denali.h" @@ -22,6 +24,8 @@ struct denali_dt { struct clk *clk; /* core clock */ struct clk *clk_x; /* bus interface clock */ struct clk *clk_ecc; /* ECC circuit clock */ + struct reset_control *rst; /* core reset */ + struct reset_control *rst_reg; /* register reset */ }; struct denali_dt_data { @@ -157,6 +161,14 @@ static int denali_dt_probe(struct platform_device *pdev) if (IS_ERR(dt->clk_ecc)) return PTR_ERR(dt->clk_ecc); + dt->rst = devm_reset_control_get_optional_shared(dev, "nand"); + if (IS_ERR(dt->rst)) + return PTR_ERR(dt->rst); + + dt->rst_reg = devm_reset_control_get_optional_shared(dev, "reg"); + if (IS_ERR(dt->rst_reg)) + return PTR_ERR(dt->rst_reg); + ret = clk_prepare_enable(dt->clk); if (ret) return ret; @@ -172,10 +184,30 @@ static int denali_dt_probe(struct platform_device *pdev) denali->clk_rate = clk_get_rate(dt->clk); denali->clk_x_rate = clk_get_rate(dt->clk_x); - ret = denali_init(denali); + /* + * Deassert the register reset, and the core reset in this order. + * Deasserting the core reset while the register reset is asserted + * will cause unpredictable behavior in the controller. + */ + ret = reset_control_deassert(dt->rst_reg); if (ret) goto out_disable_clk_ecc; + ret = reset_control_deassert(dt->rst); + if (ret) + goto out_assert_rst_reg; + + /* + * When the reset is deasserted, the initialization sequence is kicked + * (bootstrap process). The driver must wait until it finished. + * Otherwise, it will result in unpredictable behavior. + */ + usleep_range(200, 1000); + + ret = denali_init(denali); + if (ret) + goto out_assert_rst; + for_each_child_of_node(dev->of_node, np) { ret = denali_dt_chip_init(denali, np); if (ret) { @@ -190,6 +222,10 @@ static int denali_dt_probe(struct platform_device *pdev) out_remove_denali: denali_remove(denali); +out_assert_rst: + reset_control_assert(dt->rst); +out_assert_rst_reg: + reset_control_assert(dt->rst_reg); out_disable_clk_ecc: clk_disable_unprepare(dt->clk_ecc); out_disable_clk_x: @@ -205,6 +241,8 @@ static int denali_dt_remove(struct platform_device *pdev) struct denali_dt *dt = platform_get_drvdata(pdev); denali_remove(&dt->controller); + reset_control_assert(dt->rst); + reset_control_assert(dt->rst_reg); clk_disable_unprepare(dt->clk_ecc); clk_disable_unprepare(dt->clk_x); clk_disable_unprepare(dt->clk); From patchwork Fri Dec 20 11:31:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182236 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp402056ilf; Fri, 20 Dec 2019 03:33:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwgeTsAk3/ghcZRSXOSoOsozPSOcno+bkKma3T9d/ofFmCNqqzHhF2FNeh9/a4LGoSJUDT9 X-Received: by 2002:a62:1d90:: with SMTP id d138mr15319929pfd.93.1576841604880; Fri, 20 Dec 2019 03:33:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841604; cv=none; d=google.com; s=arc-20160816; b=RgiukmgMjJD8qE9+9hDkT5kZoIcrqCyYtQkHObctwmGiXMigyGWqLe0EmhxTZmzVQt 9gCuRpUa/Zq6ki5CsyIa1DC1lA6RkFueER25xmgKMBjPDzIhFKn30IQhxy3cH1PXJhrI ELH96MTLweTXeBcktYZAI07CfG1mE0dQ0oRO1MAwZYWKpt9WENQ+cXzbZ+3cMYijiIsG rZmhma47Gr7g/8QN3X5h6sS1+7zwfqx5TRNY705701ySVtxmCDFSXaPV4343E3gjsOq9 RG6N+oiUHz+uKAb3lthIh8aXBNY6jy8/PrO/eRJzNOOX1s1VZRoGUd5ZctKLrqsMU/mY Nytg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=ymkfW0/kT4DLfjgzY62/eUV4aeAkjPEDeT7JpJPNNPI=; b=O42aJowD514sYdu7OEb3fA7B6VP0JdkRbGtSBm4cEeHD+xD1/txAcJ7C2j/03T5rDk 2w2h20Q/V8C57P/R7fnWxPhCi5YEVJyWt+CoNPrMbDLhTc4VU8iIZgaN7BkvBtB1Al5y E8oxQOLL/wV1CEsOsrMvx3Z+3fUrCGAVg8BjEeRy8DxxoQ2FGYGbAkJUa5HbY/TMheYj OZQz0cGEZQzVVa5EB6SPZUrkG5JcPQERQiWY3BmLLaJ2yrIkurKVPAf6XDE17EyhfoTi ny2QonI86bi01079ql7NktaSRNFMYASltxTerU1QkSrYnORR4oV1Cm/yVA8A8u/FdzL2 gXUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=gJke6ZQ4; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=vJ9ZNkKc; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id e4si8602551pge.31.2019.12.20.03.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:33:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=gJke6ZQ4; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=vJ9ZNkKc; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ymkfW0/kT4DLfjgzY62/eUV4aeAkjPEDeT7JpJPNNPI=; b=gJke6ZQ4yRyrSsHEI0p8/PXHHI SfI+4gia0SjNrsFQbhEMOahcFWB8ipabyT+kF/IXjwfyE644D2wKn8+HrUsa3dXE3aY45tVhrMaDm bzCKhStN7gr6e2I7P/LRWbvn/hOzDpcxqEPkIibEHJUHVTCfoeoyVzl35iL40rHr/MB7Uak3lxW8U x1L1ygcUmtsbRgCXx+1C7prRQacZDq56Ju0nbXqMo5RAGOC/FLAqTQfJyBI79MTiB+EfqrGnoJu/r y+VXwRYR07wAeeF1UlCg4Z3bNgltHetVaNlDGvD9CNTy5ebwMU5NkhcX9XPofmj74eqWHBHhb04uL jieKKSBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWx-0000n4-W3; Fri, 20 Dec 2019 11:33:16 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWH-000082-DC for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:36 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2X0010984; Fri, 20 Dec 2019 20:32:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2X0010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841529; bh=FaE1Dy6PORZJLZr2fPoSaDCJ2/3nG0fTHRJYBhAtI20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJ9ZNkKccYowU4XwyMyk1kgJ+wlThcFKimxyMyfxqOs5uY6exrWz0FoCHerjFbbLW 39Dm0r+sC3zkRT2yGDJLLnwnN6qRFzDNm7NvgGGEv5LoDj3q5WbqsXQdUhQZs2piXI HViI9D9pFxujyGfh70LFHdYUvPpKeG9UmtuaxdN9I/HUQsjbKXUYOwds2ig+ef/Ltk tW9CzTGmWIJj+8GIsTswmHvcYoSdiYjNiV93VpDUvqljwt7guxUynFuDFzzIdyoeYh HONq89bXg5O55aqmuGvaVOVJpuW9z4t35HgkeZBSLOXvcH3r8Z617ZuQUgEr12tZiN olIjV5eQNagRw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 5/5] mtd: rawnand: denali: remove hard-coded DENALI_DEFAULT_OOB_SKIP_BYTES Date: Fri, 20 Dec 2019 20:31:55 +0900 Message-Id: <20191220113155.28177-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033233_779159_2C86F378 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org As commit 0d55c668b218 (mtd: rawnand: denali: set SPARE_AREA_SKIP_BYTES register to 8 if unset") says, there were three solutions discussed: [1] Add a DT property to specify the skipped bytes in OOB [2] Associate the preferred value with compatible [3] Hard-code the default value in the driver At that time, [3] was chosen because I did not have enough information about the other platforms than UniPhier. That commit also says "The preferred value may vary by platform. If so, please trade up to a different solution." My intention was to replace [3] with [2], not keep both [2] and [3]. Now that we have switched to [2] for SOCFPGA's SPARE_AREA_SKIP_BYTES=2, [3] should be removed. This should be OK because denali_pci.c just gets back to the original behavior. Signed-off-by: Masahiro Yamada --- Changes in v3: - New patch Changes in v2: None drivers/mtd/nand/raw/denali.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index b6c463d02167..fafd0a0aa8e2 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -21,7 +21,6 @@ #include "denali.h" #define DENALI_NAND_NAME "denali-nand" -#define DENALI_DEFAULT_OOB_SKIP_BYTES 8 /* for Indexed Addressing */ #define DENALI_INDEXED_CTRL 0x00 @@ -1302,22 +1301,16 @@ int denali_init(struct denali_controller *denali) /* * Set how many bytes should be skipped before writing data in OOB. - * If a non-zero value has already been configured, update it in HW. - * If a non-zero value has already been set (by firmware or something), - * just use it. Otherwise, set the driver's default. + * If a platform requests a non-zero value, set it to the register. + * Otherwise, read the value out, expecting it has already been set up + * by firmware. */ - if (denali->oob_skip_bytes) { + if (denali->oob_skip_bytes) iowrite32(denali->oob_skip_bytes, denali->reg + SPARE_AREA_SKIP_BYTES); - } else { - denali->oob_skip_bytes = - ioread32(denali->reg + SPARE_AREA_SKIP_BYTES); - if (!denali->oob_skip_bytes) { - denali->oob_skip_bytes = DENALI_DEFAULT_OOB_SKIP_BYTES; - iowrite32(denali->oob_skip_bytes, - denali->reg + SPARE_AREA_SKIP_BYTES); - } - } + else + denali->oob_skip_bytes = ioread32(denali->reg + + SPARE_AREA_SKIP_BYTES); iowrite32(0, denali->reg + TRANSFER_SPARE_REG); iowrite32(GENMASK(denali->nbanks - 1, 0), denali->reg + RB_PIN_ENABLED);