From patchwork Tue May 23 03:21:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 97715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1865372vqo; Mon, 22 May 2023 20:23:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6h5PJThKJKwHrJgnQhWzZguzI0T7ly0CefWy9mi85zK1kVjpHpLsbLj8Y5MpTXut1Hin94 X-Received: by 2002:a17:902:f641:b0:1ac:5d9b:d971 with SMTP id m1-20020a170902f64100b001ac5d9bd971mr15306902plg.34.1684812197463; Mon, 22 May 2023 20:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684812197; cv=none; d=google.com; s=arc-20160816; b=HCTd3cLjeLJN1hIKwc197z5AFQOAuJmaDhT+Q/b7thfjVX4lGRO97xmYWMQb+JsUYn GAzTUmbLKrGC8Q+7SeOXJ92eSzDpViwFboNW9wuG1r44Sz0zwLxWlLWJyUjnplfXUagM Pbf0zlFWTYpyffDnzkJ8w4A7o1xy3JUBH72f9XUq6V1VL56FbuTvEipjrE2Rim0CbjwE FKDFhCRYg7fEJl0tskvLvSNPhKcQIuhmBcLlY5ZdTK+5lzAb6AypKgu0ihxNqIXhNiBq /HGgyaS9YVN5FS3VBMMjparOEJf+C5xrGORUKbCehnojLMXcBHNYNvBObZaoedkl7vii Tx2A== 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=PvacrSuZu2RET2CmOngVt/QPNG7tALbTJoLo7+/4eIc=; b=VmMNnsuIeU8QkbgZ08KYsSiOGhrsketsnrTUGLSQ8UE6m86Y/EiNNOOog9BsJKbnb4 YSlMmJJUkp57WAZrmkQn+D7C8vbAJjFPpdUz3ZQjpjdOa8ldxnPDG+SwjqKSpt8UGJSr 953Tqg/utRwOavpGe7kpw7/pf3tBQ1fb4nkYcYQzZILJDxP3ZKlbGgbwzf6XfxM4XrDZ rEGDZk/Zu8xlupb7CLr9nFHx0UCRnYi2F9CBSFfkmxHY8vkJn32NdaDBmaUwFVcZx4sY /qoZVi6xMte2ocVEvA+/6UYYhTI2jqFGfmSre6Tf2RzCyYOZZFIfLXm7PIuMRJ7gU+E7 yx/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=BFamZ64e; 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 i8-20020a170902c94800b001a63889512csi6032245pla.135.2023.05.22.20.23.03; Mon, 22 May 2023 20:23:17 -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=BFamZ64e; 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 S232236AbjEWDVV (ORCPT + 99 others); Mon, 22 May 2023 23:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjEWDVS (ORCPT ); Mon, 22 May 2023 23:21:18 -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 9A02991 for ; Mon, 22 May 2023 20:21:14 -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 163F22C04A5; Tue, 23 May 2023 15:21:05 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1684812065; bh=PvacrSuZu2RET2CmOngVt/QPNG7tALbTJoLo7+/4eIc=; h=From:To:Cc:Subject:Date:From; b=BFamZ64ekRb3dM58kiAyPEuxOGFjByrYaY+BRpA/lKLvTa3YzaeFZebzy0p6JHDc0 DogCmal9IN40R2E0RHbaUk+GjrTkx6Z/2jWhjnKRvciiX+rtxWbulbXbTi8DIe3ZRf vEQ/gF/7QFCXNnh0gqn2dPHOq/9jB+FBjqRb06ojzM3rgnYEn4dE5FIJrB4YeJ3Pkk UZWuE/vRSiprfK6nAEyGRyowPGjNHMBDfRfRKs2AmjKJjQ2E19cipc/woc9WnEsRt9 rllrn+x9F4Spoy6oGYTjL6D0RscBvmSZRwIofnNYn467x2T3uCTJfHca//EFZx5hfi JWbEtOHGCJEow== 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 ; Tue, 23 May 2023 15:21:04 +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 D64A113EDE9; Tue, 23 May 2023 15:21:04 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id D219C283910; Tue, 23 May 2023 15:21:04 +1200 (NZST) From: Chris Packham To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH] mtd: rawnand: marvell: ensure timing values are written Date: Tue, 23 May 2023 15:21:03 +1200 Message-Id: <20230523032103.208213-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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: 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?1766653634975160121?= 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. Suggested-by: Miquel Raynal Signed-off-by: Chris Packham --- 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). 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..3b5e4d5d220f 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 restored in marvell_nfc_select_target(). + */ + nfc->selected_chip = NULL; + return 0; }