Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752368AbdI2KlY (ORCPT ); Fri, 29 Sep 2017 06:41:24 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:57821 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752079AbdI2Kk5 (ORCPT ); Fri, 29 Sep 2017 06:40:57 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com v8TAcmAE012917 X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Masahiro Yamada , Cyrille Pitchen , linux-kernel@vger.kernel.org, Boris Brezillon , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse Subject: [PATCH v2 2/2] mtd: nand: denali: fix setup_data_interface to meet tCCS delay Date: Fri, 29 Sep 2017 19:38:40 +0900 Message-Id: <1506681520-13897-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506681520-13897-1-git-send-email-yamada.masahiro@socionext.com> References: <1506681520-13897-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1452 Lines: 42 The WE_2_RE register specifies the number of clock cycles inserted between the rising edge of #WE and the falling edge of #RE. The current setup_data_interface implementation takes care of tWHR, but tCCS is missing. Wait max(tCSS, tWHR) to meet the spec. With setup_data_interface() is properly programmed, the Denali NAND controller can observe the timing, so NAND_WAIT_{TCCS,TWHR} flag is unneeded. Say this in the comment block. Signed-off-by: Masahiro Yamada --- Changes in v2: - newly added drivers/mtd/nand/denali.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 0b268ec..332c022 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1004,8 +1004,14 @@ static int denali_setup_data_interface(struct mtd_info *mtd, int chipnr, tmp |= FIELD_PREP(RE_2_RE__VALUE, re_2_re); iowrite32(tmp, denali->reg + RE_2_RE); - /* tWHR -> WE_2_RE */ - we_2_re = DIV_ROUND_UP(timings->tWHR_min, t_clk); + /* + * tCCS, tWHR -> WE_2_RE + * + * With WE_2_RE properly set, the Denali controller automatically takes + * care of tCCS, tWHR; the driver need not set NAND_WAIT_{TCCS,TWHR}. + */ + we_2_re = DIV_ROUND_UP(max(timings->tCCS_min, timings->tWHR_min), + t_clk); we_2_re = min_t(int, we_2_re, TWHR2_AND_WE_2_RE__WE_2_RE); tmp = ioread32(denali->reg + TWHR2_AND_WE_2_RE); -- 2.7.4