Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp620225imm; Wed, 8 Aug 2018 02:49:56 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx+hI2L7alecX2qujzWDa38Lsc+LU8oCGmGzuzLsQMFWQm6a6kw2f+7cejdT3pOZj4js4BI X-Received: by 2002:a62:3a5b:: with SMTP id h88-v6mr2155554pfa.61.1533721796186; Wed, 08 Aug 2018 02:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533721796; cv=none; d=google.com; s=arc-20160816; b=oGMgBMmEkuiTrubXVT/WpqJkqicRV3Agld4Ih9Pr6iylvZOAvbfPebVbDIZizJsHuK cf1XK0WC8CViRHZwCgOBdSnbA/f6wfzmVXaKSyksgQ3K6rNUNFeIrjDCyzkls+OPfebT eRUvB7uSJvh8PKeh7koV3GAYLB5bCtGO70FQp+xqtJBoOuOovZTgJ4sncaC8o/Q5APA6 xWG9AKhmQGykmV1pudaIEIyHJXbtbmQaQmbcPCJk6n2xvxoUA3/+WJcEd9rGAQiIQlLp r17Yr9glP7C5ue6bNet2hra63nJjhxjJ2iJWajlSu4H1TWMEmsoj/AqVPsjbv4TKuvsX ECBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=FA7bjCPOO9Njlshs68weYiAUBz8ew2bQvsVv+bsSZ3k=; b=arPy/QAnevlWyKs7QPQLD+Xc2k0EGyF4Gsf1ejaLxAKUJ0ULxBMdTpN8f/VljaoEa7 ilv1VnoZCjpypd618LWVraaBrQgC9JTdhMPRBqSINJyUUJt1SHlS6Fa1avdqcTh46hJP XH+H8DeqcY46aZDf9u0IUl3w7lokGPUAoyBjFR0hcDFPi6mfd4ZYwPCxioivUA7jr/Uu 9c1UV2zJ6TvdlYIGehbE1G2ePpJM5YlB7drfE+cXcFnkguTqFulZibbm7HR44lachFmi B0vGKJwyfSeA4mN3wG3bN8l79TfQrfi69ti04M6f2QBCIU4PTmgPuMi22WhhJRHd65hf M0gg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e67-v6si2915882plb.272.2018.08.08.02.49.41; Wed, 08 Aug 2018 02:49:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbeHHMHj convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Aug 2018 08:07:39 -0400 Received: from mail.bootlin.com ([62.4.15.54]:54585 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726542AbeHHMHj (ORCPT ); Wed, 8 Aug 2018 08:07:39 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id AB3AE207AB; Wed, 8 Aug 2018 11:48:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (AAubervilliers-681-1-99-143.w90-88.abo.wanadoo.fr [90.88.4.143]) by mail.bootlin.com (Postfix) with ESMTPSA id 579AF20763; Wed, 8 Aug 2018 11:48:31 +0200 (CEST) Date: Wed, 8 Aug 2018 11:48:32 +0200 From: Miquel Raynal To: Kurt Kanzenbach Cc: Boris Brezillon , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Masahiro Yamada , Gregory CLEMENT , Jane Wan , Jagdish Gediya , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mtd: nand: fsl-ifc: fixup SRAM init for newer ctrl versions Message-ID: <20180808114832.61d31c29@xps13> In-Reply-To: <20180806092137.9287-3-kurt@linutronix.de> References: <20180806092137.9287-1-kurt@linutronix.de> <20180806092137.9287-3-kurt@linutronix.de> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kurt, Subject prefix should be "mtd: rawnand: fsl_ifc:". Kurt Kanzenbach wrote on Mon, 6 Aug 2018 11:21:37 +0200: > Newer versions of the IFC controller use a different method of initializing the > internal SRAM: Instead of reading from flash, a bit in the NAND configuration > register has to be set in order to trigger the self-initializing process. > > Signed-off-by: Kurt Kanzenbach > --- > drivers/mtd/nand/raw/fsl_ifc_nand.c | 18 ++++++++++++++++++ > include/linux/fsl_ifc.h | 2 ++ > 2 files changed, 20 insertions(+) > > diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c > index e4f5792dc589..384d5e12b05c 100644 > --- a/drivers/mtd/nand/raw/fsl_ifc_nand.c > +++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > > #define ERR_BYTE 0xFF /* Value returned for read > bytes when read failed */ > @@ -769,6 +770,23 @@ static int fsl_ifc_sram_init(struct fsl_ifc_mtd *priv) > uint32_t csor = 0, csor_8k = 0, csor_ext = 0; > uint32_t cs = priv->bank; > > + if (ctrl->version > FSL_IFC_VERSION_1_1_0) { This is redundant and fsl_ifc_sram_init() is called only if "ctrl->version > FSL_FC_VERSION_1_1_0". So this means this function has never worked? If this is the case, there should be at least a Fixes: tag. Maybe it would be cleaner to always call fsl_ifc_sram_init() from the probe(), and just exit with a "return 0" here if the version is old? (I'll let you choose the way you prefer). > + u32 ncfgr, status; > + int ret; > + > + /* Trigger auto initialization */ > + ncfgr = ifc_in32(&ifc_runtime->ifc_nand.ncfgr); > + ifc_out32(ncfgr | IFC_NAND_NCFGR_SRAM_INIT_EN, &ifc_runtime->ifc_nand.ncfgr); > + > + /* Wait until done */ > + ret = readx_poll_timeout(ifc_in32, &ifc_runtime->ifc_nand.ncfgr, > + status, !(status & IFC_NAND_NCFGR_SRAM_INIT_EN), > + 10, 1000); Nit: I always prefer when delays/timeouts are defined (and may be reused). > + if (ret) > + dev_err(priv->dev, "Failed to initialize SRAM!\n"); Space > + return ret; > + } > + > /* Save CSOR and CSOR_ext */ > csor = ifc_in32(&ifc_global->csor_cs[cs].csor); > csor_ext = ifc_in32(&ifc_global->csor_cs[cs].csor_ext); > diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h > index 3fdfede2f0f3..5f343b796ad9 100644 > --- a/include/linux/fsl_ifc.h > +++ b/include/linux/fsl_ifc.h > @@ -274,6 +274,8 @@ > */ > /* Auto Boot Mode */ > #define IFC_NAND_NCFGR_BOOT 0x80000000 > +/* SRAM Initialization */ > +#define IFC_NAND_NCFGR_SRAM_INIT_EN 0x20000000 > /* Addressing Mode-ROW0+n/COL0 */ > #define IFC_NAND_NCFGR_ADDR_MODE_RC0 0x00000000 > /* Addressing Mode-ROW0+n/COL0+n */ Thanks, Miquèl