]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
km/common: add support for second flash
authorAndreas Huber <andreas.huber@keymile.com>
Fri, 4 May 2012 08:30:16 +0000 (10:30 +0200)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 15 Jun 2012 22:07:11 +0000 (17:07 -0500)
Add support for a second flash.
By default, a single flash chip is set up:
- called 'boot'
- mtd name for ubi 'ubi0'
MTDIDS and MTDPARTS may be overwritten to add a second flash.
The 'ubiattach' command is featured in two versions:
- if CONFIG_KM_UBI_PARTITION_NAME_APP is not defined:
  this is the version as up to now
- if CONFIG_KM_UBI_PARTITION_NAME_APP is defined:
  a check on 'actual_bank' will be done to determine the flash to boot
  from.

Use CONFIG_KM_UBI_PARTITION_NAME_BOOT and
CONFIG_KM_UBI_PARTITION_NAME_APP to define where to put the bootloader
and the applications.

Example:
In the board config do:
... snip ...

       "boot:"                                                 \
               "768k(u-boot),"                                 \
               "128k(env),"                                    \
               "128k(envred),"                                 \
               "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");"     \
       "app:"                                                  \
               "-(" CONFIG_KM_UBI_PARTITION_NAME_APP ");"

... snap ...

You may also need to enable the second flash:
... snip ...
/* additional featured for COGE5 */
... snap ...

Signed-off-by: Andreas Huber <andreas.huber@keymile.com>
cc: Kim Phillips <kim.phillips@freescale.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
include/configs/km/keymile-common.h
include/configs/km/km82xx-common.h
include/configs/km/km83xx-common.h
include/configs/km/km_arm.h

index 7a01705496301cf4f15dd7200ec995b3dcde0bff..4f606a0210b35bd854f1c8f83bfb2603cc8a2163 100644 (file)
        "netdev=eth0\0"
 #endif
 
-#ifndef CONFIG_KM_UBI_PARTITION_NAME
-#define CONFIG_KM_UBI_PARTITION_NAME   "ubi0"
-#endif
-#ifndef CONFIG_KM_UBI_LINUX_MTD_NAME
-#define CONFIG_KM_UBI_LINUX_MTD_NAME   "ubi0"
-#endif
+#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
+#define CONFIG_KM_UBI_PARTITION_NAME_BOOT      "ubi0"
+#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
+
+#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
+/* one flash chip only called boot */
+/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
+# define CONFIG_KM_UBI_LINUX_MTD                                       \
+       "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
+# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI                              \
+       "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
+#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
+/* two flash chips called boot and app */
+/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
+/* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
+# define CONFIG_KM_UBI_LINUX_MTD                                       \
+       "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "                \
+       "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
+# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI                              \
+       "ubiattach=if test ${boot_bank} -eq 0; then; "                  \
+       "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "        \
+       "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
+#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
 
 #define xstr(s)        str(s)
 #define str(s) #s
                " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"        \
                " mem=${kernelmem} init=${init}"                        \
                " phram.phram=phvar,${varaddr}," xstr(CONFIG_KM_PHRAM)  \
-               " ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " "            \
+               " " CONFIG_KM_UBI_LINUX_MTD " "                         \
                CONFIG_KM_DEF_BOOT_ARGS_CPU                             \
                "\0"                                                    \
        "addpanic="                                                     \
 #define CONFIG_KM_DEF_ENV_FLASH_BOOT                                   \
        "cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0"                  \
        "cramfsloadkernel=cramfsload ${load_addr_r} uImage\0"           \
-       "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME "\0"         \
        "ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR)                  \
                        " bootfs${boot_bank}\0"                         \
-       ""
+       CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
 
 /*
  * constants
index 02a82a69bc2ab9d80b489ffb81db99c2d8c84312..2c763bb551b8ba1ed4efc46ff914b3ca4ad9e915 100644 (file)
@@ -73,7 +73,7 @@
                "128k(env),"                                            \
                "128k(envred),"                                         \
                "3072k(free),"                                          \
-               "-(" CONFIG_KM_UBI_PARTITION_NAME ")"
+               "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ")"
 
 /*
  * Default environment settings
index 06ecb8a3e96ca78f2dbe4785705c7f02b83accb9..2c266fae10e66636cb66094647d10397402492e2 100644 (file)
 #include "keymile-common.h"
 #include "km-powerpc.h"
 
-#define MTDIDS_DEFAULT         "nor0=boot"
-#define MTDPARTS_DEFAULT       "mtdparts="                     \
+#ifndef MTDIDS_DEFAULT
+# define MTDIDS_DEFAULT        "nor0=boot"
+#endif /* MTDIDS_DEFAULT */
+
+#ifndef MTDPARTS_DEFAULT
+# define MTDPARTS_DEFAULT      "mtdparts="                     \
        "boot:"                                                 \
                "768k(u-boot),"                                 \
                "128k(env),"                                    \
                "128k(envred),"                                 \
-               "-(" CONFIG_KM_UBI_PARTITION_NAME ")"
+               "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");"
+#endif /* MTDPARTS_DEFAULT */
 
 #define CONFIG_MISC_INIT_R
 /*
index c73a10c667d0cbd95c47db4d9dfc1c803bd36aa8..011f838106e0d40d23edcc302937d7dadfc82d22 100644 (file)
@@ -229,11 +229,15 @@ int get_scl(void);
 
 #define FLASH_GPIO_PIN                 0x00010000
 
-#define MTDIDS_DEFAULT         "nand0=orion_nand"
-/* test-only: partitioning needs some tuning, this is just for tests */
-#define MTDPARTS_DEFAULT       "mtdparts="                             \
-       "orion_nand:"                                                   \
-               "-(" CONFIG_KM_UBI_PARTITION_NAME ")"
+#ifndef MTDIDS_DEFAULT
+# define MTDIDS_DEFAULT                "nand0=orion_nand"
+#endif /* MTDIDS_DEFAULT */
+
+#ifndef MTDPARTS_DEFAULT
+# define MTDPARTS_DEFAULT      "mtdparts="                     \
+       "orion_nand:"                                           \
+               "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");"
+#endif /* MTDPARTS_DEFAULT */
 
 #define        CONFIG_KM_DEF_ENV_UPDATE                                        \
        "update="                                                       \
@@ -257,7 +261,6 @@ int get_scl(void);
        ""
 
 #if defined(CONFIG_SYS_NO_FLASH)
-#define CONFIG_KM_UBI_PARTITION_NAME   "ubi0"
 #undef CONFIG_FLASH_CFI_MTD
 #undef CONFIG_JFFS2_CMDLINE
 #endif