Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3309945imm; Mon, 6 Aug 2018 02:24:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuUGGCvTMUjzn5zfPeq2pwdUNsczadtks/4jiVP9ldtqxaWwzLNWknkQXsKtB3eZu0z28X X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr13092355plb.299.1533547473663; Mon, 06 Aug 2018 02:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533547473; cv=none; d=google.com; s=arc-20160816; b=0pyZqlDAyAl16S46BT16hKe+jEtKIfynMUk81WbnlYJ6n0x+8mJ7PI4vJ6xNMjwVIS nF0DYJlRnoLc9uI9AcmaEnnB6jGAmnxQqJszWgKYKtmCM7/0urh4TIEgJYHRB8YFLcsU 5/fgTh+Jb6sjw8r9KfqujAn33bFWoK8loDRvsRPsUQqF2Suw6vwJ7JAdp5f+N+kWu61q ZyZE0BZuSWZlNqAASelouthgxG+ZOMRoecIYv+s+vPBK40dJXT3Y9r6KEez992xhdYOB iS/IkuUQyl4xq0UR2LiGNhglVSXDblIV5fs7cMbyHodel6zihEomWIwDf/X2UZbXY9y7 PzDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ct4sbZGyBEq/Xbv/TyPglj7HYhK8XHEdEco5qg+tvqQ=; b=ruYUlNYNSUxTG7a1OEF8ijbFJTY3HTAzmao7RD+elvr59S+pQRQ4o9McXw0pDs/Erb oY09KxIsgCFUXv5k4F3ygkotyAZAxWnNcsIX3WbfeyAdPDUyJk1Tzf65EOUUqkbCvvm+ sUBG8+QmGC19+wWyXzDvTCfOvieZExbKM+pivu0nN0rEuchIr+6iuT7vGNfOAMBjJYn3 pRQdeXg+wh6XsOg4YdcVRX3lLsr0wd/V+oiQdmIFAibZi2hD7r7gFiwOrJP6qPbx4MaO O5HOzzdRD7PuHaeR6ocPnBlbzwU1Rq8dSj7TCaSI2eevsf7+JLSB3XYWTIh6B9tLDqgo Kh4g== 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 h65-v6si15212064pfb.70.2018.08.06.02.24.19; Mon, 06 Aug 2018 02:24:33 -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 S1729655AbeHFLaY (ORCPT + 99 others); Mon, 6 Aug 2018 07:30:24 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:44769 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727490AbeHFLaX (ORCPT ); Mon, 6 Aug 2018 07:30:23 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=kurt.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fmbiA-0002UC-JT; Mon, 06 Aug 2018 11:21:58 +0200 From: Kurt Kanzenbach To: Boris Brezillon Cc: Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Masahiro Yamada , Kurt Kanzenbach , Gregory CLEMENT , Jane Wan , Jagdish Gediya , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mtd: nand: fsl-ifc: fixup SRAM init for newer ctrl versions Date: Mon, 6 Aug 2018 11:21:37 +0200 Message-Id: <20180806092137.9287-3-kurt@linutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180806092137.9287-1-kurt@linutronix.de> References: <20180806092137.9287-1-kurt@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { + 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); + if (ret) + dev_err(priv->dev, "Failed to initialize SRAM!\n"); + 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 */ -- 2.11.0