From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.linux-foundation.org ([140.211.169.13]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1QKKfv-00065l-Dx for linux-mtd@lists.infradead.org; Thu, 12 May 2011 01:26:48 +0000 Date: Wed, 11 May 2011 18:33:22 -0700 From: Andrew Morton To: Nitin Garg Subject: Re: Bug in MTD NAND ONFI chipsize detection Message-Id: <20110511183322.da0739c9.akpm@linux-foundation.org> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-mtd@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 11 May 2011 11:25:22 -0500 Nitin Garg wrote: > Hi All, > > The nand_flash_detect_onfi function in mtd/nand detects the NAND flash > device size using the ONFI parameters: > chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; > > The lun_count is not taken into consideration due to which we detect > wrong size for Micron MT29F8G08ADADAH4 as it has 2 logical units. > > We should change the chipsize calculation to: > chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * > (uint64_t)le32_to_cpu(p->lun_count) * mtd->erasesize; > > Pls suggest. > Please send a tested, changelogged patch to fix it. Be sure to cc the relevant maintainer and mailing list. Thanks.