X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fmaps%2Fpb1xxx-flash.c;h=b6b8ccf48d9fd58b0c19cbac42702cb87663b720;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=713c52b0e729f4eec43b40a72e1c8436be4b1653;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/mtd/maps/pb1xxx-flash.c b/drivers/mtd/maps/pb1xxx-flash.c index 713c52b0e..b6b8ccf48 100644 --- a/drivers/mtd/maps/pb1xxx-flash.c +++ b/drivers/mtd/maps/pb1xxx-flash.c @@ -3,14 +3,14 @@ * * (C) 2001 Pete Popov * - * $Id: pb1xxx-flash.c,v 1.9 2003/06/23 11:48:18 dwmw2 Exp $ + * $Id: pb1xxx-flash.c,v 1.11 2004/07/12 21:59:44 dwmw2 Exp $ */ #include #include #include -#include #include +#include #include #include @@ -26,102 +26,87 @@ #endif #ifdef CONFIG_MIPS_PB1000 + #define WINDOW_ADDR 0x1F800000 #define WINDOW_SIZE 0x800000 -#endif - - -static struct map_info pb1xxx_map = { - .name = "Pb1xxx flash", -}; - - -#ifdef CONFIG_MIPS_PB1000 -static unsigned long flash_size = 0x00800000; -static unsigned char flash_buswidth = 4; static struct mtd_partition pb1xxx_partitions[] = { { - .name = "yamon env", - .size = 0x00020000, - .offset = 0, - .mask_flags = MTD_WRITEABLE - },{ - .name = "User FS", - .size = 0x003e0000, - .offset = 0x20000, - },{ - .name = "boot code", - .size = 0x100000, - .offset = 0x400000, - .mask_flags = MTD_WRITEABLE - },{ - .name = "raw/kernel", - .size = 0x300000, - .offset = 0x500000 - } + .name = "yamon env", + .size = 0x00020000, + .offset = 0, + .mask_flags = MTD_WRITEABLE}, + { + .name = "User FS", + .size = 0x003e0000, + .offset = 0x20000,}, + { + .name = "boot code", + .size = 0x100000, + .offset = 0x400000, + .mask_flags = MTD_WRITEABLE}, + { + .name = "raw/kernel", + .size = 0x300000, + .offset = 0x500000} }; #elif defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100) -static unsigned char flash_buswidth = 4; #if defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER) -/* both 32MiB banks will be used. Combine the first 32MiB bank and the - * first 28MiB of the second bank together into a single jffs/jffs2 +/* both 32MB banks will be used. Combine the first 32MB bank and the + * first 28MB of the second bank together into a single jffs/jffs2 * partition. */ -static unsigned long flash_size = 0x04000000; #define WINDOW_ADDR 0x1C000000 #define WINDOW_SIZE 0x4000000 static struct mtd_partition pb1xxx_partitions[] = { { - .name = "User FS", - .size = 0x3c00000, - .offset = 0x0000000 + .name = "User FS", + .size = 0x3c00000, + .offset = 0x0000000 },{ - .name = "yamon", - .size = 0x0100000, - .offset = 0x3c00000, - .mask_flags = MTD_WRITEABLE + .name = "yamon", + .size = 0x0100000, + .offset = 0x3c00000, + .mask_flags = MTD_WRITEABLE },{ - .name = "raw kernel", - .size = 0x02c0000, - .offset = 0x3d00000 + .name = "raw kernel", + .size = 0x02c0000, + .offset = 0x3d00000 } }; #elif defined(CONFIG_MTD_PB1500_BOOT) && !defined(CONFIG_MTD_PB1500_USER) -static unsigned long flash_size = 0x02000000; #define WINDOW_ADDR 0x1E000000 #define WINDOW_SIZE 0x2000000 static struct mtd_partition pb1xxx_partitions[] = { { - .name = "User FS", - .size = 0x1c00000, - .offset = 0x0000000 + .name = "User FS", + .size = 0x1c00000, + .offset = 0x0000000 },{ - .name = "yamon", - .size = 0x0100000, - .offset = 0x1c00000, - .mask_flags = MTD_WRITEABLE + .name = "yamon", + .size = 0x0100000, + .offset = 0x1c00000, + .mask_flags = MTD_WRITEABLE },{ - .name = "raw kernel", - .size = 0x02c0000, - .offset = 0x1d00000 + .name = "raw kernel", + .size = 0x02c0000, + .offset = 0x1d00000 } }; #elif !defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER) -static unsigned long flash_size = 0x02000000; #define WINDOW_ADDR 0x1C000000 #define WINDOW_SIZE 0x2000000 static struct mtd_partition pb1xxx_partitions[] = { { - .name = "User FS", - .size = 0x1e00000, - .offset = 0x0000000 + .name = "User FS", + .size = 0x1e00000, + .offset = 0x0000000 },{ - .name = "raw kernel", - .size = 0x0200000, - .offset = 0x1e00000, + .name = "raw kernel", + .size = 0x0200000, + .offset = 0x1e00000, } }; #else @@ -131,8 +116,20 @@ static struct mtd_partition pb1xxx_partitions[] = { #error Unsupported board #endif -static struct mtd_partition *parsed_parts; -static struct mtd_info *mymtd; +#define NAME "Pb1x00 Linux Flash" +#define PADDR WINDOW_ADDR +#define BUSWIDTH 4 +#define SIZE WINDOW_SIZE +#define PARTITIONS 4 + +static struct map_info pb1xxx_mtd_map = { + .name = NAME, + .size = SIZE, + .bankwidth = BUSWIDTH, + .phys = PADDR, +}; + +static struct mtd_info *pb1xxx_mtd; int __init pb1xxx_mtd_init(void) { @@ -140,49 +137,38 @@ int __init pb1xxx_mtd_init(void) int nb_parts = 0; char *part_type; - /* Default flash buswidth */ - pb1xxx_map.buswidth = flash_buswidth; - /* * Static partition definition selection */ part_type = "static"; parts = pb1xxx_partitions; nb_parts = ARRAY_SIZE(pb1xxx_partitions); - pb1xxx_map.size = flash_size; /* * Now let's probe for the actual flash. Do it here since * specific machine settings might have been set above. */ printk(KERN_NOTICE "Pb1xxx flash: probing %d-bit flash bus\n", - pb1xxx_map.buswidth*8); - pb1xxx_map.phys = WINDOW_ADDR; - pb1xxx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); + BUSWIDTH*8); + pb1xxx_mtd_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); - simple_map_init(&pb1xxx_map); + simple_map_init(&pb1xxx_mtd_map); - mymtd = do_map_probe("cfi_probe", &pb1xxx_map); - if (!mymtd) { - iounmap(pb1xxx_map.virt); - return -ENXIO; - } - mymtd->owner = THIS_MODULE; + pb1xxx_mtd = do_map_probe("cfi_probe", &pb1xxx_mtd_map); + if (!pb1xxx_mtd) return -ENXIO; + pb1xxx_mtd->owner = THIS_MODULE; - add_mtd_partitions(mymtd, parts, nb_parts); + add_mtd_partitions(pb1xxx_mtd, parts, nb_parts); return 0; } static void __exit pb1xxx_mtd_cleanup(void) { - if (mymtd) { - del_mtd_partitions(mymtd); - map_destroy(mymtd); - if (parsed_parts) - kfree(parsed_parts); + if (pb1xxx_mtd) { + del_mtd_partitions(pb1xxx_mtd); + map_destroy(pb1xxx_mtd); + iounmap((void *) pb1xxx_mtd_map.virt); } - if (pb1xxx_map.virt) - iounmap(pb1xxx_map.virt); } module_init(pb1xxx_mtd_init);