From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-gy0-f177.google.com ([209.85.160.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QszXg-0004Um-SY for linux-mtd@lists.infradead.org; Mon, 15 Aug 2011 15:57:34 +0000 Received: by gyh20 with SMTP id 20so3451732gyh.36 for ; Mon, 15 Aug 2011 08:57:31 -0700 (PDT) Subject: Re: [PATCH v2] mtd/nand : workaround for Freescale FCM to support large-page Nand chip From: Artem Bityutskiy To: b35362@freescale.com Date: Mon, 15 Aug 2011 18:59:09 +0300 In-Reply-To: <1310446122-18050-1-git-send-email-b35362@freescale.com> References: <1310446122-18050-1-git-send-email-b35362@freescale.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Message-ID: <1313423954.8691.17.camel@sauron> Mime-Version: 1.0 Cc: scottwood , linuxppc-dev@ozlabs.org, Li Yang , dwmw2@infradead.org, linux-mtd@lists.infradead.org Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, 2011-07-12 at 12:48 +0800, b35362@freescale.com wrote: > + /* > + * Hack for supporting the flash chip whose writesize is > + * larger than 2K bytes. > + */ > + if (mtd->writesize > 2048) { > + elbc_fcm_ctrl->subpage_shift = ffs(mtd->writesize >> 11) - 1; > + elbc_fcm_ctrl->subpage_mask = > + (1 << elbc_fcm_ctrl->subpage_shift) - 1; > + /* > + * Rewrite mtd->writesize, mtd->oobsize, chip->page_shift > + * and chip->pagemask. > + */ > + mtd->writesize = 2048; > + mtd->oobsize = 64; > + chip->page_shift = ffs(mtd->writesize) - 1; > + chip->pagemask = (chip->chipsize >> chip->page_shift) - 1; > + } So basically if the flash has 4KiB NAND pages, you are considering it as a flash with 2KiB NAND pages. But surely this will work only if the underlying flash has NOP 2 at least. Or even, if you consider that JFFS2 and YAFFS want to write to OOB, you need NOP 4 (2 ECC writes and 2 writes from YAFFS/JFFS2) ? So this won't work for NOP1 flashes? Isn't it an ugly hack? -- Best Regards, Artem Bityutskiy