Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2915918ybb; Sun, 22 Mar 2020 10:44:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsB1UooVwdyv8CUz5A9TdPhpWFDr+CeRDewy127B9LyXQ33JUuMRMMyL56vYlA/7dBXil3e X-Received: by 2002:a9d:7397:: with SMTP id j23mr5067278otk.269.1584899085703; Sun, 22 Mar 2020 10:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584899085; cv=none; d=google.com; s=arc-20160816; b=O6jr9POEWYjODuopu0JDtlx+PiXMuc3ax/oI5ChlZ08h09Buxtxx2OyQehHvCzxYCz IwsVfdpL5dl18rXmw0R1g6iSDeE4jQO4Ug+Kde1md8lOiY0bmfHmbcW0MTe+xFnaeaDA m1Lr77Jxj+95sRZ45idv+T6xd0mkSraWOzsiRW+KqeTU27o9uH2dzqb06KkMC9HQEWVy bq2prg1cG8F/DsuW9AANwoPj8cQkCHZwPl3JcK8wBlyA4S4JTRQT+iuhxY9WFLPBGKDD J7t+t3xheyoWfInDcUqqWE5c54HAxjzlxtmigCIR7IXzWZXqSimvJu5vouy4oPakf95L FoNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=5VWidLyAxVr+JeX12AUe51S3Q/Q1o/QNC542fp0/ac0=; b=P0O6+s5X5ZYPHW9/1OKu36hJ8YQx6zYg5dYGrJkyiOPdfJfAu2tKndtyhUXauOGj7p rv/ggHmWts2TlWR/7+gLVk2kl2Hvw7e/AAbRxnarLHD5TCwKpZKv1J79lHFmteEDXW6s 0Tfp1z024uJzMN0UKJAw/Lpm+tJWyrCJGTW7QFhW0DMlj0Y7QNV94yEPk4BdDlBQxofw JDP4nTmK+/EIR/1SW1uBesmsVvR+1QrUAGoG7KlnKaIUjQH+RI/pYnX9SH4fM2vQMeqp r+VMtRWMyDUxsT6rA0aPInTrq5Lm0xQgPvlj21kr2AqfbQL1CmGXkFQGGW3wzFiImMUf ivmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lELr3M2T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si6305198oib.135.2020.03.22.10.44.33; Sun, 22 Mar 2020 10:44:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lELr3M2T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726470AbgCVRnj (ORCPT + 99 others); Sun, 22 Mar 2020 13:43:39 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:33735 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgCVRni (ORCPT ); Sun, 22 Mar 2020 13:43:38 -0400 Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 02MHhOn6003701 for ; Mon, 23 Mar 2020 02:43:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 02MHhOn6003701 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1584899005; bh=5VWidLyAxVr+JeX12AUe51S3Q/Q1o/QNC542fp0/ac0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lELr3M2T1b2z+PTuaN61NmzZA0ZJpltxAm+qO8LVscXqyGM7PDKOQz1ybEPSrRM9k w6AdPPZroYYf9yp/T5jE8nmjVRmNyXGOVQXy8Bz+Zg8gKjCe3t/5e7oebKCavPSBJv KjAVX+308yXcIg1uqgblfU8Ap1hIH/xxdyZJ+4hnmf4wRZDdlzwYXenCZUOua1caIN xwCHTcYk8fkmF9jGn6KgQhTe/kUhuKsKtj1WoYcnhW7PZIY4D9MQZv4u5sSwWIQN9r I1eGP6JR4dlyOvEZetdkQY2/YWZBtmkFVV0PpbLXnFommVUdYxYDb0x3Cl56cmLWiW mV6H1D7M8bLQQ== X-Nifty-SrcIP: [209.85.221.173] Received: by mail-vk1-f173.google.com with SMTP id q8so3160201vka.8 for ; Sun, 22 Mar 2020 10:43:25 -0700 (PDT) X-Gm-Message-State: ANhLgQ2xqvu7g6PRCjO7Ed6eVfvxuIdT2gWd8OTf92N2ACu44bGW9hA3 U00PCi6JbI/Bbf0NI2tWOnf3igSsAQnSpnjaoS0= X-Received: by 2002:a1f:3806:: with SMTP id f6mr4073980vka.12.1584899004183; Sun, 22 Mar 2020 10:43:24 -0700 (PDT) MIME-Version: 1.0 References: <20200316104307.1891-1-yamada.masahiro@socionext.com> <20200320181159.5004099f@xps13> <2d02c851-4249-053c-99e9-69b209bffad2@denx.de> In-Reply-To: <2d02c851-4249-053c-99e9-69b209bffad2@denx.de> From: Masahiro Yamada Date: Mon, 23 Mar 2020 02:42:48 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mtd: rawnand: denali: add more delays before latching incoming data To: Marek Vasut Cc: Miquel Raynal , linux-mtd , Richard Weinberger , Vignesh Raghavendra , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 21, 2020 at 2:15 AM Marek Vasut wrote: > > On 3/20/20 6:11 PM, Miquel Raynal wrote: > > Hi Marek, > > > > Masahiro Yamada wrote on Mon, 16 Mar > > 2020 19:43:07 +0900: > > > >> The Denali IP have several registers to specify how many clock cycles > >> should be waited between falling/rising signals. You can improve the > >> NAND access performance by programming these registers with optimized > >> values. > >> > >> Because struct nand_sdr_timings represents the device requirement > >> in pico seconds, denali_setup_data_interface() computes the register > >> values by dividing the device timings with the clock period. > >> > >> Marek Vasut reported this driver in the latest kernel does not work > >> on his SOCFPGA board. (The on-board NAND chip is mode 5) > >> > >> The suspicious parameter is acc_clks, so this commit relaxes it. > >> > >> The Denali NAND Flash Memory Controller User's Guide describes this > >> register as follows: > >> > >> acc_clks > >> signifies the number of bus interface clk_x clock cycles, > >> controller should wait from read enable going low to sending > >> out a strobe of clk_x for capturing of incoming data. > >> > >> Currently, acc_clks is calculated only based on tREA, the delay on the > >> chip side. This does not include additional delays that come from the > >> data path on the PCB and in the SoC, load capacity of the pins, etc. > >> > >> This relatively becomes a big factor on faster timing modes like mode 5. > >> > >> Before supporting the ->setup_data_interface() hook (e.g. Linux 4.12), > >> the Denali driver hacks acc_clks in a couple of ways [1] [2] to support > >> the timing mode 5. > >> > >> We would not go back to the hard-coded acc_clks, but we need to include > >> this factor into the delay somehow. Let's say the amount of the additional > >> delay is 10000 pico sec. > >> > >> In the new calculation, acc_clks is determined by timings->tREA_max + > >> data_setup_on_host. > >> > >> Also, prolong the RE# low period to make sure the data hold is met. > >> > >> Finally, re-center the data latch timing for extra safety. > >> > >> [1] https://github.com/torvalds/linux/blob/v4.12/drivers/mtd/nand/denali.c#L276 > >> [2] https://github.com/torvalds/linux/blob/v4.12/drivers/mtd/nand/denali.c#L282 > >> > >> Reported-by: Marek Vasut > >> Signed-off-by: Masahiro Yamada > >> --- > > > > Can you please give this patch a try and report the result? > > It's on my list, don't worry. Preferably, please test v2. Thanks. -- Best Regards Masahiro Yamada