public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mtd: support ONFI multi lun NAND
@ 2012-09-17 21:21 Matthieu CASTET
  2012-09-17 22:22 ` Scott Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu CASTET @ 2012-09-17 21:21 UTC (permalink / raw)
  To: u-boot

With onfi a flash is organized into one or more logical units (LUNs).
A logical unit (LUN) is the minimum unit that can independently execute
commands and report status.

Mtd does not exploit LUN, so make it see a big single flash where size is
lun_size * number_of_lun.

Without this patch MT29F8G08ADBDAH4 size is 512MiB instead of 1GiB.

Artem: split long line on 2 shorter ones.

This is commit 637957551c0ac80de8dfc7650d320c5a98c2c0c0 from Linux

Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com>
Acked-by: Florian Fainelli <ffainelli@freebox.fr>
Signed-off-by:  Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
[scottwood at freescale.com: picked from Linux into U-Boot]
Reported-by: Rafael Beims <rafael.beims@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
Rafael submitted http://patchwork.ozlabs.org/patch/168820/ to fix this,
but the patch was corrupt so I picked the equivalent fix out of Linux
(better to have them synced anyway).

Applied to u-boot-nand-flash.

 drivers/mtd/nand/nand_base.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index bfd668f..50bfb65 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2573,7 +2573,8 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
 	mtd->writesize = le32_to_cpu(p->byte_per_page);
 	mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
 	mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
-	chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
+	chip->chipsize = le32_to_cpu(p->blocks_per_lun);
+	chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count;
 	*busw = 0;
 	if (le16_to_cpu(p->features) & 1)
 		*busw = NAND_BUSWIDTH_16;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] mtd: support ONFI multi lun NAND
  2012-09-17 21:21 [U-Boot] [PATCH] mtd: support ONFI multi lun NAND Matthieu CASTET
@ 2012-09-17 22:22 ` Scott Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2012-09-17 22:22 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 04:21:09 PM, Matthieu CASTET wrote:
> With onfi a flash is organized into one or more logical units (LUNs).
> A logical unit (LUN) is the minimum unit that can independently  
> execute
> commands and report status.
> 
> Mtd does not exploit LUN, so make it see a big single flash where  
> size is
> lun_size * number_of_lun.
> 
> Without this patch MT29F8G08ADBDAH4 size is 512MiB instead of 1GiB.
> 
> Artem: split long line on 2 shorter ones.
> 
> This is commit 637957551c0ac80de8dfc7650d320c5a98c2c0c0 from Linux
> 
> Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com>
> Acked-by: Florian Fainelli <ffainelli@freebox.fr>
> Signed-off-by:  Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> [scottwood at freescale.com: picked from Linux into U-Boot]
> Reported-by: Rafael Beims <rafael.beims@gmail.com>
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Sigh, this was posted by me, not Matthieu -- I forgot to fix up the  
output of git format-patch before running mutt on it.  Please don't  
reply to Matthieu (at least regarding anything U-Boot specific).

-Scott

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-17 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17 21:21 [U-Boot] [PATCH] mtd: support ONFI multi lun NAND Matthieu CASTET
2012-09-17 22:22 ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox