Message ID | 20230524000551.581491-1-chris.packham@alliedtelesis.co.nz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2501986vqo; Tue, 23 May 2023 17:21:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nDV0TaFvs69+stLt+tOVxLh+7rEtMutuPVAjO5Fl8hJUrNxs95exiwE5IVTiVwZ5wvXYk X-Received: by 2002:a17:903:1c7:b0:1ac:aee4:d75 with SMTP id e7-20020a17090301c700b001acaee40d75mr20184229plh.52.1684887668468; Tue, 23 May 2023 17:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684887668; cv=none; d=google.com; s=arc-20160816; b=W4Pa8oTjqFtuw4UdHrssq7Z+KT3Xs0tS3DqB8veBwpGM5YJUgPaiQh0qfcOdOciHvL 9Dm0zdFWLYqqQyu26xBKrKCEMfzoUi+5oEOx0Wzi/+P5434o1EoemEcrh4voCVmP1Zue x7Mv8Oe8namvIjDk3FOoeHvNzkOMrx46ZfRp/3Vsns1MgN8wYxUFNKyzz6NiWgrfijfO vh6mQurvaJP959jcjHAS0n8p6iSB//9eXzUanqD0UUes7taMwLtcsUemX1Poa4LXNoyO fZro/ulD6UCCAmiSZacFqX2f54+5JWuggrzI0F/wzMlCLJE9mqMI+Z6ct+i15a+0H/PQ 35Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=9ckj42E7r4z+2OmcX0Fs7Wo4NBzRrDQ5JisNoca+09Q=; b=rpMUs2sjRHuK/CelPmjczuLSzX70HqaRq8SsI3ZHXyKsE6Bxe8NoJzejAUgqJm+/y+ nCQl6ttPg+65iURagFMmrXg34BCFfTOY4IQu0tXe8pQ6UE3GyKlUMG3Zm2agYOkYHwn6 56zmrtueAgjUO3wSNyHjl5bw++K/zfdVzixLr2RBqHf3/WQA4ABUd6ZxQKcH5w2l7iqI NRdKN7G0VdC5lUV7Jkv9q9q8JC64uRCM6Lh6sGx2rT/LNfqXoh4S+fa4Bj8/FBEjagEg z4v3ea5ThCfTxzK4HkZE+GI5dS7X5s6/PIRQIlp2z63VE/613Bu9sQ3lhCKKtkEpbigL dVjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=NWObuiax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170902680e00b001a242dbbd27si3716159plk.513.2023.05.23.17.20.52; Tue, 23 May 2023 17:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=NWObuiax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238929AbjEXAGO (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Tue, 23 May 2023 20:06:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjEXAGM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 23 May 2023 20:06:12 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC9D83 for <linux-kernel@vger.kernel.org>; Tue, 23 May 2023 17:06:09 -0700 (PDT) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 5A16C2C0274; Wed, 24 May 2023 12:05:56 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1684886756; bh=9ckj42E7r4z+2OmcX0Fs7Wo4NBzRrDQ5JisNoca+09Q=; h=From:To:Cc:Subject:Date:From; b=NWObuiaxTIXbPxrj78Uf8naQrnFLNHVoh9J45Q10ZxZgzGat/G5PSJUu6PYcVfWxo GX6agTNub69NEMRvgEzuHttCN1S2I7bqw3jPM4GjV8y3nRd43upm6srjCrHgF79EPC /VVKftGB7M+kU7MPEKjtca/zFeX6UmYy9+N6w3EKkiTKE14Ammq7/PvhMQpyTmur/X GOCfHbEQfqGe7VT4HxRn6jcbucpCaKpNhKP8JBgXKianOyQZ+zcN7OW6Nnc7ej1Uws jdFp7fdGJCMZJrEgff9lsWmcdxiwaJry1S6BZOrlj8Y28AUhV0MVboMVJ+pDpk1yKe Z2ObitlFBLRwQ== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id <B646d54e40000>; Wed, 24 May 2023 12:05:56 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 2221913EE41; Wed, 24 May 2023 12:05:56 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 1B6C32838AE; Wed, 24 May 2023 12:05:56 +1200 (NZST) From: Chris Packham <chris.packham@alliedtelesis.co.nz> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, bbrezillon@kernel.org Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Chris Packham <chris.packham@alliedtelesis.co.nz> Subject: [PATCH v2] mtd: rawnand: marvell: ensure timing values are written Date: Wed, 24 May 2023 12:05:51 +1200 Message-Id: <20230524000551.581491-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.3 cv=cLieTWWN c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=P0xRbXHiH_UA:10 a=P-IC7800AAAA:8 a=txcOHvV6KX-ElXq2eNMA:9 a=d3PnA9EDa4IxuAV0gXij:22 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766653634975160121?= X-GMAIL-MSGID: =?utf-8?q?1766732772028156644?= |
Series |
[v2] mtd: rawnand: marvell: ensure timing values are written
|
|
Commit Message
Chris Packham
May 24, 2023, 12:05 a.m. UTC
When new timing values are calculated in marvell_nfc_setup_interface()
ensure that they will be applied in marvell_nfc_select_target() by
clearing the selected_chip pointer.
Fixes: b25251414f6e ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
Suggested-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
This at least gets me to a point where I can illustrated the problem
reported to me. It appears that despite the chip correctly reporting
support for SDR timing modes up to 4 the observed tWC is 20ns. I've not
seen any actual problem running in this state the only complaint is that
the datasheet says the minimum tWC is 25ns.
If I make a change to my bootloader such that the NAND Clock Frequency
Select bit (0xF2440700:0) to 1 before booting the kernel _and_ I remove
the extra factor of 2 from the period_ns calculation I observe tWC of
about 60ns. If I don't remove the factor of 2 the NAND interface doesn't
work (can't write BBT).
Changes in v2:
- reword comment per suggestion from Miquel, add fixes tag
drivers/mtd/nand/raw/marvell_nand.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On 24/05/23 12:05, Chris Packham wrote: > When new timing values are calculated in marvell_nfc_setup_interface() > ensure that they will be applied in marvell_nfc_select_target() by > clearing the selected_chip pointer. > > Fixes: b25251414f6e ("mtd: rawnand: marvell: Stop implementing ->select_chip()") > Suggested-by: Miquel Raynal <miquel.raynal@bootlin.com> > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > This at least gets me to a point where I can illustrated the problem > reported to me. It appears that despite the chip correctly reporting > support for SDR timing modes up to 4 the observed tWC is 20ns. I've not > seen any actual problem running in this state the only complaint is that > the datasheet says the minimum tWC is 25ns. > > If I make a change to my bootloader such that the NAND Clock Frequency > Select bit (0xF2440700:0) to 1 before booting the kernel _and_ I remove > the extra factor of 2 from the period_ns calculation I observe tWC of > about 60ns. If I don't remove the factor of 2 the NAND interface doesn't > work (can't write BBT). > > Changes in v2: > - reword comment per suggestion from Miquel, add fixes tag Actually thinking about this I should probably also include a change to drop the unconditional NAND Clock Frequency select. Some marvell_nand users probably aren't getting the best timings without this change but those with a system controller will probably end up with timings faster than intended (which may work depending on design tolerances). > > drivers/mtd/nand/raw/marvell_nand.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c > index afb424579f0b..f1fcf136ad03 100644 > --- a/drivers/mtd/nand/raw/marvell_nand.c > +++ b/drivers/mtd/nand/raw/marvell_nand.c > @@ -2457,6 +2457,12 @@ static int marvell_nfc_setup_interface(struct nand_chip *chip, int chipnr, > NDTR1_WAIT_MODE; > } > > + /* > + * Reset nfc->selected_chip so the next command will cause the timing > + * registers to be updated in marvell_nfc_select_target(). > + */ > + nfc->selected_chip = NULL; > + > return 0; > } >
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index afb424579f0b..f1fcf136ad03 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c @@ -2457,6 +2457,12 @@ static int marvell_nfc_setup_interface(struct nand_chip *chip, int chipnr, NDTR1_WAIT_MODE; } + /* + * Reset nfc->selected_chip so the next command will cause the timing + * registers to be updated in marvell_nfc_select_target(). + */ + nfc->selected_chip = NULL; + return 0; }