From patchwork Wed Apr 8 06:08:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 25706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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 ozlabs.org (Postfix) with ESMTPS id 68538DDF31 for ; Wed, 8 Apr 2009 16:10:55 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LrQxR-0001FF-H8; Wed, 08 Apr 2009 06:08:21 +0000 Received: from smtp118.sbc.mail.sp1.yahoo.com ([69.147.64.91]) by bombadil.infradead.org with smtp (Exim 4.69 #1 (Red Hat Linux)) id 1LrQxB-0001CB-VD for linux-mtd@lists.infradead.org; Wed, 08 Apr 2009 06:08:18 +0000 Received: (qmail 24856 invoked from network); 8 Apr 2009 06:08:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=aqSo2YxbCDqgR1zwpnBux9BfoDdXTsVwsxnHF5+piGLGm+bSKpwR93SlVqFvekVBU4xGEy8g/oAP2tCL9ot1k7wOn4C4cOdhR4EDiGCsau3UnA/3GrrT9jt+Nt7u6XsA2+dKKp8AwiwCRhUUe7CrCDGmmbMPGfu/YURBSYl9nUc= ; Received: from unknown (HELO albert) (david-b@69.226.223.132 with plain) by smtp118.sbc.mail.sp1.yahoo.com with SMTP; 8 Apr 2009 06:08:03 -0000 X-YMail-OSG: DUi5NBAVM1khu89Xkr5GznKw7hhmFGpW1kPHkSyKGzvk2Y3vFoYdf1PTzq37AWgO7pIPX69Na1wiwVJLiPWysvHPGOiP3gQWgwNycwFIkzBfb72V32AAXTFBz02GTBRd.jSNchVGA2YFHw0Ia4SBwMTDyr0hrtPcT8a8JSWXenNCWryuZ5RLvhZyjp3Zej9KePFvyU2Ec6Srhhhl9WLZv7e6P3IRyuymd5ZY76w0xMGfQnWqcMB6nYHKJf0zHOvUBr7aV4YSqo5_DAtWzdfDXQir7wYubNYVhe1TleYAOUOgzVk7SV1y5KtZ2K1x85I3WdPbMw-- X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: DaVinci , Linux MTD Subject: [patch 2.6.30-rc1] NAND: minor davinci_nand cleanup Date: Tue, 7 Apr 2009 23:08:02 -0700 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200904072308.02757.david-b@pacbell.net> X-Spam-Score: 0.0 (/) Cc: Thomas Gleixner , dwmw2@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: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: David Brownell Make the DaVinci NAND driver require platform_data with board-specific configuration. We can't actually do any kind of sane job of configuring it otherwise. Also fix the comment about picking the "best" ECC mode. We can't do that any more; it relied on knowing what kind of CPU we're using, they don't all support 4-bit ECC. Signed-off-by: David Brownell --- Applies to the DaVinci tree too. FWIW, I've sanity tested the davinci_nand driver in mainline (dm6446evm) -- works! drivers/mtd/nand/davinci_nand.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c @@ -306,6 +306,10 @@ static int __init nand_davinci_probe(str uint32_t val; nand_ecc_modes_t ecc_mode; + /* insist on board-specific configuration */ + if (!pdata) + return -ENODEV; + /* which external chipselect will we be managing? */ if (pdev->id < 0 || pdev->id > 3) return -ENODEV; @@ -351,7 +355,7 @@ static int __init nand_davinci_probe(str info->chip.select_chip = nand_davinci_select_chip; /* options such as NAND_USE_FLASH_BBT or 16-bit widths */ - info->chip.options = pdata ? pdata->options : 0; + info->chip.options = pdata->options; info->ioaddr = (uint32_t __force) vaddr; @@ -360,14 +364,8 @@ static int __init nand_davinci_probe(str info->mask_chipsel = pdata->mask_chipsel; /* use nandboot-capable ALE/CLE masks by default */ - if (pdata && pdata->mask_ale) - info->mask_ale = pdata->mask_cle; - else - info->mask_ale = MASK_ALE; - if (pdata && pdata->mask_cle) - info->mask_cle = pdata->mask_cle; - else - info->mask_cle = MASK_CLE; + info->mask_ale = pdata->mask_cle ? : MASK_ALE; + info->mask_cle = pdata->mask_cle ? : MASK_CLE; /* Set address of hardware control function */ info->chip.cmd_ctrl = nand_davinci_hwcontrol; @@ -377,11 +375,8 @@ static int __init nand_davinci_probe(str info->chip.read_buf = nand_davinci_read_buf; info->chip.write_buf = nand_davinci_write_buf; - /* use board-specific ECC config; else, the best available */ - if (pdata) - ecc_mode = pdata->ecc_mode; - else - ecc_mode = NAND_ECC_HW; + /* Use board-specific ECC config */ + ecc_mode = pdata->ecc_mode; switch (ecc_mode) { case NAND_ECC_NONE: @@ -469,7 +464,7 @@ static int __init nand_davinci_probe(str info->mtd.name = master_name; } - if (mtd_parts_nb <= 0 && pdata) { + if (mtd_parts_nb <= 0) { mtd_parts = pdata->parts; mtd_parts_nb = pdata->nr_parts; } @@ -482,7 +477,7 @@ static int __init nand_davinci_probe(str info->partitioned = true; } - } else if (pdata && pdata->nr_parts) { + } else if (pdata->nr_parts) { dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n", pdata->nr_parts, info->mtd.name); }