From patchwork Fri Aug 24 06:41:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 179771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B464F2C00C9 for ; Fri, 24 Aug 2012 16:38:09 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4nVj-0002DQ-8a; Fri, 24 Aug 2012 06:36:51 +0000 Received: from mga11.intel.com ([192.55.52.93]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4nVg-0002DC-AT for linux-mtd@lists.infradead.org; Fri, 24 Aug 2012 06:36:49 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 23 Aug 2012 23:36:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,302,1344236400"; d="asc'?scan'208";a="213314227" Received: from linux.jf.intel.com (HELO linux.intel.com) ([10.23.219.25]) by fmsmga002.fm.intel.com with ESMTP; 23 Aug 2012 23:36:39 -0700 Received: from [10.237.72.96] (sauron.fi.intel.com [10.237.72.96]) by linux.intel.com (Postfix) with ESMTP id B8E092C8001; Thu, 23 Aug 2012 23:36:38 -0700 (PDT) Message-ID: <1345790488.2848.252.camel@sauron.fi.intel.com> Subject: Re: [PATCH 1/2] nand: nand_bbt: Export nand_update_bbt From: Artem Bityutskiy To: Huang Shijie Date: Fri, 24 Aug 2012 09:41:28 +0300 In-Reply-To: References: <1343514565-8983-1-git-send-email-festevam@gmail.com> <1343514565-8983-2-git-send-email-festevam@gmail.com> <1345734503.2848.247.camel@sauron.fi.intel.com> X-Mailer: Evolution 3.2.3 (3.2.3-3.fc16) Mime-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dedekind1[at]gmail.com) -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.55.52.93 listed in list.dnswl.org] 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: Fabio Estevam , dwmw2@infradead.org, b32955@freescale.com, linux-mtd@lists.infradead.org, marex.vasut@denx.de, kernel@pengutronix.de, shawn.guo@linaro.org, Fabio Estevam X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: dedekind1@gmail.com 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 On Thu, 2012-08-23 at 11:36 -0400, Huang Shijie wrote: > On Thu, Aug 23, 2012 at 11:08 AM, Artem Bityutskiy wrote: > > On Sat, 2012-07-28 at 19:29 -0300, Fabio Estevam wrote: > >> From: Fabio Estevam > >> > >> When building MTD_NAND_GPMI_NAND as module, the following error shows up: > >> > >> ERROR: "nand_update_bbt" [drivers/mtd/nand/gpmi-nand/gpmi_nand.ko] undefined! > >> > >> Export nand_update_bbt to fix it > >> > >> Signed-off-by: Fabio Estevam > > > > Why this driver redefined ->block_markbad() at all, it is not supposed > For hardware reason, in mx23, the bad block mark is stored in the > first byte of the nand page; > in mx28/mx50/mx6q, the bad block mark is stored in the first byte of the OOB. > > That's why the driver redefined the ->block_markbad(). The default function seem to do the same as your function does. You select where you keep your OOB using chip options, and the default function does the right thing, no? From 5cdff78da6dde1e2eef472dcbbe7ca8f7fd64061 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 24 Aug 2012 09:26:29 +0300 Subject: [PATCH] gpmi-nand: use the default implementation of block_markbad Signed-off-by: Artem Bityutskiy --- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 46 -------------------------------- 1 file changed, 46 deletions(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 8c0d2f0..8e193fb 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -1179,51 +1179,6 @@ gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) return -EPERM; } -static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) -{ - struct nand_chip *chip = mtd->priv; - struct gpmi_nand_data *this = chip->priv; - int block, ret = 0; - uint8_t *block_mark; - int column, page, status, chipnr; - - /* Get block number */ - block = (int)(ofs >> chip->bbt_erase_shift); - if (chip->bbt) - chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); - - /* Do we have a flash based bad block table ? */ - if (chip->bbt_options & NAND_BBT_USE_FLASH) - ret = nand_update_bbt(mtd, ofs); - else { - chipnr = (int)(ofs >> chip->chip_shift); - chip->select_chip(mtd, chipnr); - - column = this->swap_block_mark ? mtd->writesize : 0; - - /* Write the block mark. */ - block_mark = this->data_buffer_dma; - block_mark[0] = 0; /* bad block marker */ - - /* Shift to get page */ - page = (int)(ofs >> chip->page_shift); - - chip->cmdfunc(mtd, NAND_CMD_SEQIN, column, page); - chip->write_buf(mtd, block_mark, 1); - chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); - - status = chip->waitfunc(mtd, chip); - if (status & NAND_STATUS_FAIL) - ret = -EIO; - - chip->select_chip(mtd, -1); - } - if (!ret) - mtd->ecc_stats.badblocks++; - - return ret; -} - static int nand_boot_set_geometry(struct gpmi_nand_data *this) { struct boot_rom_geometry *geometry = &this->rom_geometry; @@ -1562,7 +1517,6 @@ static int __devinit gpmi_nfc_init(struct gpmi_nand_data *this) chip->ecc.write_oob = gpmi_ecc_write_oob; chip->scan_bbt = gpmi_scan_bbt; chip->badblock_pattern = &gpmi_bbt_descr; - chip->block_markbad = gpmi_block_markbad; chip->options |= NAND_NO_SUBPAGE_WRITE; chip->ecc.mode = NAND_ECC_HW; chip->ecc.size = 1;