]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/voiceblue/voiceblue.c
Add common (with Linux) MTD partition scheme and "mtdparts" command
[people/ms/u-boot.git] / board / voiceblue / voiceblue.c
index 9691106581b04f72079c61c72a1cfb1e14c01ef6..7a2d243ef88f3855b40debc1cec2f9cae3102a0b 100644 (file)
@@ -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 = &current_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;
 }