diff options
author | Wolfgang Denk <wd@pollux.denx.de> | 2005-08-08 01:03:24 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@pollux.denx.de> | 2005-08-08 01:03:24 +0200 |
commit | 700a0c648df72f2c8e0589c0d0470b5ffd7cab7b (patch) | |
tree | 819928504de4b8fc80e632fa5c485204fd7542a7 /board/voiceblue | |
parent | 452e8e72ada5141f58008a902e1d4be42ce15abb (diff) | |
download | u-boot-imx-700a0c648df72f2c8e0589c0d0470b5ffd7cab7b.zip u-boot-imx-700a0c648df72f2c8e0589c0d0470b5ffd7cab7b.tar.gz u-boot-imx-700a0c648df72f2c8e0589c0d0470b5ffd7cab7b.tar.bz2 |
Add common (with Linux) MTD partition scheme and "mtdparts" command
Old, obsolete and duplicated code was cleaned up and replace by the
new partitioning method. There are two possible approaches now:
* define a single, static partition
* use mtdparts command line option and dynamic partitioning
Default is static partitioning.
Diffstat (limited to 'board/voiceblue')
-rw-r--r-- | board/voiceblue/voiceblue.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/board/voiceblue/voiceblue.c b/board/voiceblue/voiceblue.c index 9691106..7a2d243 100644 --- a/board/voiceblue/voiceblue.c +++ b/board/voiceblue/voiceblue.c @@ -56,90 +56,10 @@ int dram_init(void) return 0; } -#ifndef VOICEBLUE_SMALL_FLASH - -#include <jffs2/jffs2.h> - -extern flash_info_t flash_info[]; -static struct part_info partinfo; -static int current_part = -1; - -/* Partition table (Linux MTD see it this way) - * - * 0 - U-Boot - * 1 - env - * 2 - redundant env - * 3 - data1 (jffs2) - * 4 - data2 (jffs2) - */ - -static struct { - ulong offset; - ulong size; -} part[5]; - -static void partition_flash(flash_info_t *info) -{ - char mtdparts[128]; - int i, n, size, psize; - const ulong plen[3] = { CFG_MONITOR_LEN, CFG_ENV_SIZE, CFG_ENV_SIZE }; - - size = n = 0; - for (i = 0; i < 4; i++) { - part[i].offset = info->start[n]; - psize = i < 3 ? plen[i] : (info->size - size) / 2; - while (part[i].size < psize) { - if (++n > info->sector_count) { - printf("Partitioning error. System halted.\n"); - while (1) ; - } - part[i].size += info->start[n] - info->start[n - 1]; - } - size += part[i].size; - } - part[4].offset = info->start[n]; - part[4].size = info->start[info->sector_count - 1] - info->start[n]; - - sprintf(mtdparts, "omapflash.0:" - "%dk(U-Boot)ro,%dk(env),%dk(r_env),%dk(data1),-(data2)", - part[0].size >> 10, part[1].size >> 10, - part[2].size >> 10, part[3].size >> 10); - setenv ("mtdparts", mtdparts); -} - -struct part_info* jffs2_part_info(int part_num) -{ - void *jffs2_priv_saved = partinfo.jffs2_priv; - - if (part_num != 3 && part_num != 4) - return NULL; - - if (current_part != part_num) { - memset(&partinfo, 0, sizeof(partinfo)); - current_part = part_num; - partinfo.offset = (char*) part[part_num].offset; - partinfo.size = part[part_num].size; - partinfo.usr_priv = ¤t_part; - partinfo.jffs2_priv = jffs2_priv_saved; - } - - return &partinfo; -} - -#endif - int misc_init_r(void) { *((volatile unsigned short *) VOICEBLUE_LED_REG) = 0x55; -#ifndef VOICEBLUE_SMALL_FLASH - if (flash_info[0].flash_id == FLASH_UNKNOWN) { - printf("Unknown flash. System halted.\n"); - while (1) ; - } - partition_flash(&flash_info[0]); -#endif - return 0; } |