X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=board%2Finnokom%2Fflash.c;h=298acc86a32d03af1231d985a225f162b739cc9c;hb=d4fc6012fd0a5c211b825691f44b06f8032c0551;hp=32c57d8d962dda1f7b5ef79c26e8ba25ccd8087a;hpb=dc7c9a1a52403093b9e4aef14ac4c5c014386e57;p=oweals%2Fu-boot.git diff --git a/board/innokom/flash.c b/board/innokom/flash.c index 32c57d8d96..298acc86a3 100644 --- a/board/innokom/flash.c +++ b/board/innokom/flash.c @@ -10,7 +10,8 @@ * Robert Schwebel, Pengutronix, * * (C) Copyright 2002 - * Kai-Uwe Bloem, GDS, + * Auerswald GmbH & Co KG, Germany + * Kai-Uwe Bloem * * See file CREDITS for list of people who contributed to this * project. @@ -34,14 +35,9 @@ #include #include -#if defined CFG_JFFS_CUSTOM_PART -#include -#endif - /* Debugging macros ------------------------------------------------------ */ #undef FLASH_DEBUG -//#define FLASH_DEBUG 1 /* Some debug macros */ #if (FLASH_DEBUG > 2 ) @@ -78,179 +74,6 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; - -#if defined CFG_JFFS_CUSTOM_PART - -/** - * jffs2_part_info - get information about a JFFS2 partition - * - * @part_num: number of the partition you want to get info about - * @return: struct part_info* in case of success, 0 if failure - */ - -static struct part_info part; -static int current_part = -1; - -#ifdef CONFIG_MTD_INNOKOM_16MB -#ifdef CONFIG_MTD_INNOKOM_64MB -#error Please define only one CONFIG_MTD_INNOKOM_XXMB option. -#endif -struct part_info* jffs2_part_info(int part_num) { - void *jffs2_priv_saved = part.jffs2_priv; - - PRINTK2("jffs2_part_info: part_num=%i\n",part_num); - - if (current_part == part_num) - return ∂ - - /* u-boot partition */ - if(part_num==0){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00000000; - part.size=256*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* primary OS+firmware partition */ - if(part_num==1){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00040000; - part.size=768*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* secondary OS+firmware partition */ - if(part_num==2){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00100000; - part.size=8*1024*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* data partition */ - if(part_num==3){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00900000; - part.size=7*1024*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - if (current_part == part_num) { - part.usr_priv = ¤t_part; - part.jffs2_priv = jffs2_priv_saved; - return ∂ - } - - PRINTK("jffs2_part_info: end of partition table\n"); - return 0; -} -#endif /* CONFIG_MTD_INNOKOM_16MB */ - -#ifdef CONFIG_MTD_INNOKOM_64MB -#ifdef CONFIG_MTD_INNOKOM_16MB -#error Please define only one CONFIG_MTD_INNOKOM_XXMB option. -#endif -struct part_info* jffs2_part_info(int part_num) { - void *jffs2_priv_saved = part.jffs2_priv; - - PRINTK2("jffs2_part_info: part_num=%i\n",part_num); - - if (current_part == part_num) - return ∂ - - /* u-boot partition */ - if(part_num==0){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00000000; - part.size=256*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* primary OS+firmware partition */ - if(part_num==1){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x00040000; - part.size=16*1024*1024-128*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* secondary OS+firmware partition */ - if(part_num==2){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x01020000; - part.size=16*1024*1024-128*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - /* data partition */ - if(part_num==3){ - memset(&part, 0, sizeof(part)); - - part.offset=(char*)0x02000000; - part.size=32*1024*1024; - - /* Mark the struct as ready */ - current_part = part_num; - - PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset); - PRINTK("part.size = 0x%08x\n",(unsigned int)part.size); - } - - if (current_part == part_num) { - part.usr_priv = ¤t_part; - part.jffs2_priv = jffs2_priv_saved; - return ∂ - } - - PRINTK("jffs2_part_info: end of partition table\n"); - return 0; -} -#endif /* CONFIG_MTD_INNOKOM_64MB */ -#endif /* defined CFG_JFFS_CUSTOM_PART */ - - /** * flash_init: - initialize data structures for flash chips * @@ -276,7 +99,7 @@ ulong flash_init(void) flashbase = PHYS_FLASH_1; break; default: - panic("configured to many flash banks!\n"); + panic("configured too many flash banks!\n"); break; } for (j = 0; j < flash_info[i].sector_count; j++) { @@ -334,13 +157,13 @@ void flash_print_info (flash_info_t *info) return; } - printf(" Size: %ld MB in %d Sectors\n", + printf(" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count); printf(" Sector Start Addresses:"); for (i = 0; i < info->sector_count; i++) { if ((i % 5) == 0) printf ("\n "); - + printf (" %08lX%s", info->start[i], info->protect[i] ? " (RO)" : " "); } @@ -369,7 +192,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) if ((info->flash_id & FLASH_VENDMASK) != (INTEL_MANUFACT & FLASH_VENDMASK)) return ERR_UNKNOWN_FLASH_VENDOR; - + prot = 0; for (sect=s_first; sect<=s_last; ++sect) { if (info->protect[sect]) prot++; @@ -419,13 +242,13 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) goto outahere; } } - + PRINTK("clearing status register\n"); - *addr = 0x0050; + *addr = 0x0050; PRINTK("resetting to read mode"); - *addr = 0x00FF; + *addr = 0x00FF; } - + printf("ok.\n"); } @@ -594,4 +417,3 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) return write_word(info, wp, data); } -