]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
davinci: DM644x: NAND: update partitioning
authorDavid Brownell <dbrownell@users.sourceforge.net>
Wed, 15 Apr 2009 19:19:21 +0000 (14:19 -0500)
committerKevin Hilman <khilman@deeprootsystems.com>
Mon, 27 Apr 2009 16:50:18 +0000 (09:50 -0700)
Update NAND partitioning for the dm6446 evm, unmasking the hidden
data at the beginning and letting the kernel be updated from Linux.

 - This is boot-compatible with TI's software (U-Boot 1.20 and both
   the 2.6.10 and 2.6.18 kernels), in terms of startup and loading
   kernels from flash.

 - In the same way, it's also boot-compatible with mainline U-Boot,
   which stores U-Boot params in block 0 not block 16.

 - It's not quite compatible with systems that previously used NAND
   partitions to hold (filesystem) data.  The compatibilities are a
   bit different based on which kernel was used previously
     + Users of TI/MV kernels no longer see mtd2 "params"
       (mainline u-boot env is in a different place)
* Filesystem is now mtd2 ... vs mtd3
     + Users of GIT kernels now see mtd0 and mtd1 partitions
* Filesystem partition starts 640 KBytes earlier
* Filesystem is now mtd2 ... vs mtd0
     * Linux now *uses* the flash-resident BBT
* Removes annoying slowdown/hiccup during boot
* Potentially ~64KB less space available with TI/MV kernels

If you *used* NAND partitions from Linux, there is no solution that's
fully compatible with all previous kernels in those respects ... ergo
this "best compromise".  It'd be good to back back up the filesystem
data; or, carry your own backwards-compatibility patch for awhile.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/board-dm644x-evm.c

index 5387e6b2040586f1556938e57a14f79c7218884e..c039674fe99e7c7c9ebe428d27a22ce6a7acb4ff 100644 (file)
 #include <linux/gpio.h>
 #include <linux/leds.h>
 #include <linux/memory.h>
+#include <linux/etherdevice.h>
 
 #include <linux/i2c.h>
 #include <linux/i2c/pcf857x.h>
 #include <linux/i2c/at24.h>
-#include <linux/etherdevice.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -113,20 +114,49 @@ static struct platform_device davinci_evm_norflash_device = {
        .resource       = &davinci_evm_norflash_resource,
 };
 
+/* DM644x EVM includes a 64 MByte small-page NAND flash (16K blocks).
+ * It may used instead of the (default) NOR chip to boot, using TI's
+ * tools to install the secondary boot loader (UBL) and U-Boot.
+ */
 struct mtd_partition davinci_evm_nandflash_partition[] = {
-       /* 5 MB space at the beginning for bootloader and kernel */
+       /* Bootloader layout depends on whose u-boot is installed, but we
+        * can hide all the details.
+        *  - block 0 for u-boot environment ... in mainline u-boot
+        *  - block 1 for UBL (plus up to four backup copies in blocks 2..5)
+        *  - blocks 6...? for u-boot
+        *  - blocks 16..23 for u-boot environment ... in TI's u-boot
+        */
+       {
+               .name           = "bootloader",
+               .offset         = 0,
+               .size           = SZ_256K + SZ_128K,
+               .mask_flags     = MTD_WRITEABLE,        /* force read-only */
+       },
+       /* Kernel */
        {
-               .name           = "NAND filesystem",
-               .offset         = 5 * SZ_1M,
+               .name           = "kernel",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           = SZ_4M,
+               .mask_flags     = 0,
+       },
+       /* File system (older GIT kernels started this on the 5MB mark) */
+       {
+               .name           = "filesystem",
+               .offset         = MTDPART_OFS_APPEND,
                .size           = MTDPART_SIZ_FULL,
                .mask_flags     = 0,
        }
+       /* A few blocks at end hold a flash BBT ... created by TI's CCS
+        * using flashwriter_nand.out, but ignored by TI's versions of
+        * Linux and u-boot.  We boot faster by using them.
+        */
 };
 
 static struct davinci_nand_pdata davinci_evm_nandflash_data = {
        .parts          = davinci_evm_nandflash_partition,
        .nr_parts       = ARRAY_SIZE(davinci_evm_nandflash_partition),
        .ecc_mode       = NAND_ECC_HW,
+       .options        = NAND_USE_FLASH_BBT,
 };
 
 static struct resource davinci_evm_nandflash_resource[] = {
@@ -151,14 +181,14 @@ static struct platform_device davinci_evm_nandflash_device = {
        .resource       = davinci_evm_nandflash_resource,
 };
 
-static u64 davinci_fb_dma_mask = DMA_32BIT_MASK;
+static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device davinci_fb_device = {
        .name           = "davincifb",
        .id             = -1,
        .dev = {
                .dma_mask               = &davinci_fb_dma_mask,
-               .coherent_dma_mask      = DMA_32BIT_MASK,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
        .num_resources = 0,
 };