From patchwork Wed Apr 22 15:31:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Barinov X-Patchwork-Id: 26318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 5C783B6F44 for ; Thu, 23 Apr 2009 01:36:50 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LweQi-0005fU-8Z; Wed, 22 Apr 2009 15:32:09 +0000 Received: from mail-bw0-f160.google.com ([209.85.218.160]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LweQY-0005dT-6b for linux-mtd@lists.infradead.org; Wed, 22 Apr 2009 15:32:05 +0000 Received: by bwz4 with SMTP id 4so26421bwz.18 for ; Wed, 22 Apr 2009 08:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=PHpPPW7V7wJwmqI/w7VJHE5oxqyAgQK4MLlqzmODwCM=; b=bAB5Ieo5b7aam+O2JG2AWEAOwsuXezW6tWBsR1pf3fIq2NmOTjNa8yitC83YNuTs/E 9REwqZb8raAzEHl72OEDppFi53bueqbHC770k51wF7TvOE/DW/YaxGkAa0qmJ7c9Kzhj tW2hvzG3vT7xlOUTi+ml7/aBVRYErDBajkuu8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=c+xO1thZxWwqR37iYdVfiINRzBeqINkYjI3tiqmPTYFW2GlOLGBZzViMbo06v2dwp2 5avG5LAuH9Lmo5hgM+Wg7VPtCH+/Ak3Aa8dUOtMXrfWconxjjRSzpUNhq/dciewUkQ1P kjrUp3q+UwERZk62xgZ+jxSFeRJPLO2HQtY4g= Received: by 10.103.92.10 with SMTP id u10mr4631357mul.22.1240414315677; Wed, 22 Apr 2009 08:31:55 -0700 (PDT) Received: from localhost.localdomain (85-114-25-162.obit.ru [85.114.25.162]) by mx.google.com with ESMTPS id 14sm233450muo.36.2009.04.22.08.31.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 22 Apr 2009 08:31:54 -0700 (PDT) From: Vladimir Barinov To: dwmw2@infradead.org Subject: [PATCH] [MTD] MXC NAND driver fixes (v4) Date: Wed, 22 Apr 2009 19:31:50 +0400 Message-Id: <1240414310-9245-1-git-send-email-vbarinov@embeddedalley.com> X-Mailer: git-send-email 1.6.0.6 X-Spam-Score: 0.0 (/) Cc: linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The following patch fixes: - re-initialization of host->col_addr which is used as byte index between the successive READID flash commands. - compile error when CONFIG_PM is enabled - pass on the error code from clk_get() - return -ENOMEM in case of failed ioremap() - pass on the return value of platform_driver_probe() directly - remove excessive printk - let command line partition table parsing with mxc_nand name. The cmd_line parsing is done via name that differs from mxc_nand by default and looks like "NAND 256MiB 1,8V 8-bit" Signed-off-by: Vladimir Barinov Signed-off-by: Lothar Wassmann Acked-by: Sascha Hauer --- drivers/mtd/nand/mxc_nand.c | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index bad048a..d4dbcbe 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -831,6 +831,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, break; case NAND_CMD_READID: + host->col_addr = 0; send_read_id(host); break; @@ -866,6 +867,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) mtd = &host->mtd; mtd->priv = this; mtd->owner = THIS_MODULE; + mtd->name = "mxc_nand"; /* 50 us command delay time */ this->chip_delay = 5; @@ -881,8 +883,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) this->verify_buf = mxc_nand_verify_buf; host->clk = clk_get(&pdev->dev, "nfc"); - if (IS_ERR(host->clk)) + if (IS_ERR(host->clk)) { + err = PTR_ERR(host->clk); goto eclk; + } clk_enable(host->clk); host->clk_act = 1; @@ -895,7 +899,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) host->regs = ioremap(res->start, res->end - res->start + 1); if (!host->regs) { - err = -EIO; + err = -ENOMEM; goto eres; } @@ -1010,30 +1014,35 @@ static int __devexit mxcnd_remove(struct platform_device *pdev) #ifdef CONFIG_PM static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) { - struct mtd_info *info = platform_get_drvdata(pdev); + struct mtd_info *mtd = platform_get_drvdata(pdev); + struct nand_chip *nand_chip = mtd->priv; + struct mxc_nand_host *host = nand_chip->priv; int ret = 0; DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); - if (info) - ret = info->suspend(info); - - /* Disable the NFC clock */ - clk_disable(nfc_clk); /* FIXME */ + if (mtd) { + ret = mtd->suspend(mtd); + /* Disable the NFC clock */ + clk_disable(host->clk); + } return ret; } static int mxcnd_resume(struct platform_device *pdev) { - struct mtd_info *info = platform_get_drvdata(pdev); + struct mtd_info *mtd = platform_get_drvdata(pdev); + struct nand_chip *nand_chip = mtd->priv; + struct mxc_nand_host *host = nand_chip->priv; int ret = 0; DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); - /* Enable the NFC clock */ - clk_enable(nfc_clk); /* FIXME */ - if (info) - info->resume(info); + if (mtd) { + /* Enable the NFC clock */ + clk_enable(host->clk); + mtd->resume(mtd); + } return ret; } @@ -1054,13 +1063,7 @@ static struct platform_driver mxcnd_driver = { static int __init mxc_nd_init(void) { - /* Register the device driver structure. */ - pr_info("MXC MTD nand Driver\n"); - if (platform_driver_probe(&mxcnd_driver, mxcnd_probe) != 0) { - printk(KERN_ERR "Driver register failed for mxcnd_driver\n"); - return -ENODEV; - } - return 0; + return platform_driver_probe(&mxcnd_driver, mxcnd_probe); } static void __exit mxc_nd_cleanup(void)