From patchwork Tue Sep 6 19:13:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 666709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sTGX52R70z9rxl for ; Wed, 7 Sep 2016 05:15:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhLos-0003K4-G9; Tue, 06 Sep 2016 19:14:06 +0000 Received: from ch3vs02.rockwellcollins.com ([205.175.226.29]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhLoo-00037j-4M for linux-mtd@lists.infradead.org; Tue, 06 Sep 2016 19:14:03 +0000 Received: from ofwch3n02.rockwellcollins.com (HELO crulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs02.rockwellcollins.com with ESMTP; 06 Sep 2016 14:13:38 -0500 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by crulimr02.rockwellcollins.com (Postfix) with ESMTP id 33348600F1; Tue, 6 Sep 2016 14:13:38 -0500 (CDT) From: Matt Weber To: linux-mtd@lists.infradead.org Subject: [PATCH] fsl_ifc_nand: Added random output enable cmd Date: Tue, 6 Sep 2016 14:13:17 -0500 Message-Id: <1473189197-45191-1-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160906_121402_343261_3C66A769 X-CRM114-Status: UNSURE ( 8.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -8.3 (--------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-8.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [205.175.226.29 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , boris.brezillon@free-electrons.com, Ronak Desai , Dipen.Dudhat@freescale.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch adds random output enable command support in IFC nand controller driver. This command implements change read column (05h-E0h). Signed-off-by: Matthew Weber Signed-off-by: Ronak Desai --- drivers/mtd/nand/fsl_ifc_nand.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index 4e9e5fd..230919f 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -387,10 +387,11 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command, /* * although currently it's 8 bytes for READID, we always read - * the maximum 256 bytes(for PARAM) + * the maximum 8192 bytes(for PARAM) supported by IFC controller + * as extended page may be available for some NAND devices. */ - ifc_out32(256, &ifc->ifc_nand.nand_fbcr); - ifc_nand_ctrl->read_bytes = 256; + ifc_out32(0, &ifc->ifc_nand.nand_fbcr); /* Read whole page */ + ifc_nand_ctrl->read_bytes = 8192; /* Maximum supported page by IFC */ set_addr(mtd, 0, 0, 0); fsl_ifc_run_command(mtd); @@ -530,6 +531,29 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command, fsl_ifc_run_command(mtd); return; + case NAND_CMD_RNDOUT: { + __le16 Tccs = 0; + chip->onfi_version ? (Tccs = chip->onfi_params.t_ccs) + : (Tccs = chip->jedec_params.t_ccs); + ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | + (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) | + (IFC_FIR_OP_CMD1 << IFC_NAND_FIR0_OP2_SHIFT) | + (IFC_FIR_OP_NWAIT << IFC_NAND_FIR0_OP3_SHIFT), + &ifc->ifc_nand.nand_fir0); + + ifc_out32((NAND_CMD_RNDOUT << IFC_NAND_FCR0_CMD0_SHIFT) | + (NAND_CMD_RNDOUTSTART << IFC_NAND_FCR0_CMD1_SHIFT), + &ifc->ifc_nand.nand_fcr0); + + /* Wait for minimum change column set-up time. But it does not harm + * to wait more time, so calculated based on 333.3 MHz input IFC clock + */ + ifc_out32((0xFF & (le16_to_cpu(Tccs)/3)), &ifc->ifc_nand.ncfgr); + set_addr(mtd, column, 0, 0); + fsl_ifc_run_command(mtd); + return; + } + default: dev_err(priv->dev, "%s: error, unsupported command 0x%x.\n", __func__, command);