From: Pete P. <pp...@us...> - 2002-02-15 19:47:32
|
Update of /cvsroot/linux-mips/linux/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv7382/drivers/mtd/maps Modified Files: Config.in Makefile pb1xxx-flash.c Log Message: * removed runtime copyright prints * Added Pb1500 support (only pcmcia not working at this time) and modified all drivers as necessary * renamed most Au1000 registers to match latest databook * better Au1000 usb hardware fixes for early silicon * updated mtd driver to support Pb1500 partitioning Index: Config.in =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/mtd/maps/Config.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Config.in 28 Nov 2001 22:50:42 -0000 1.1 +++ Config.in 15 Feb 2002 19:47:27 -0000 1.2 @@ -37,7 +37,12 @@ fi if [ "$CONFIG_MIPS" = "y" ]; then - dep_tristate ' Alchemy Pb1000 boot flash device' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000 + dep_tristate ' Pb1000 boot flash device' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000 + dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500 + if [ "$CONFIG_MTD_PB1500" = "y" -o "$CONFIG_MTD_PB1500" = "m" ]; then + bool ' Pb1500 boot flash device' CONFIG_MTD_PB1500_BOOT + bool ' Pb1500 user flash device (2nd 32MB bank)' CONFIG_MTD_PB1500_USER + fi dep_tristate ' Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board' CONFIG_MTD_CSTM_MIPS_IXX $CONFIG_MTD_CFI $CONFIG_MTD_JEDEC $CONFIG_MTD_PARTITIONS if [ "$CONFIG_MTD_CSTM_MIPS_IXX" = "y" -o "$CONFIG_MTD_CSTM_MIPS_IXX" = "m" ]; then hex ' Physical start address of flash mapping' CONFIG_MTD_CSTM_MIPS_IXX_START 0x8000000 Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/mtd/maps/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 28 Nov 2001 22:50:42 -0000 1.1 +++ Makefile 15 Feb 2002 19:47:27 -0000 1.2 @@ -30,5 +30,6 @@ obj-$(CONFIG_MTD_OCELOT) += ocelot.o obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o obj-$(CONFIG_MTD_PB1000) += pb1xxx-flash.o +obj-$(CONFIG_MTD_PB1500) += pb1xxx-flash.o include $(TOPDIR)/Rules.make Index: pb1xxx-flash.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/mtd/maps/pb1xxx-flash.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pb1xxx-flash.c 28 Nov 2001 22:50:42 -0000 1.1 +++ pb1xxx-flash.c 15 Feb 2002 19:47:27 -0000 1.2 @@ -3,6 +3,7 @@ * * (C) 2001 Pete Popov <pp...@mv...> * + * $Id$ */ #include <linux/config.h> @@ -15,50 +16,73 @@ #include <linux/mtd/partitions.h> #include <asm/io.h> +#include <asm/au1000.h> + +#ifdef DEBUG_RW +#define DBG(x...) printk(x) +#else +#define DBG(x...) +#endif +#ifdef CONFIG_MIPS_PB1000 #define WINDOW_ADDR 0x1F800000 #define WINDOW_SIZE 0x800000 +#endif __u8 physmap_read8(struct map_info *map, unsigned long ofs) { - return __raw_readb(map->map_priv_1 + ofs); + __u8 ret; + ret = __raw_readb(map->map_priv_1 + ofs); + DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); + return ret; } __u16 physmap_read16(struct map_info *map, unsigned long ofs) { - return __raw_readw(map->map_priv_1 + ofs); + __u16 ret; + ret = __raw_readw(map->map_priv_1 + ofs); + DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); + return ret; } __u32 physmap_read32(struct map_info *map, unsigned long ofs) { - return __raw_readl(map->map_priv_1 + ofs); + __u32 ret; + ret = __raw_readl(map->map_priv_1 + ofs); + DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); + return ret; } void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { + DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); memcpy_fromio(to, map->map_priv_1 + from, len); } void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) { + DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); __raw_writeb(d, map->map_priv_1 + adr); mb(); } void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) { + DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); __raw_writew(d, map->map_priv_1 + adr); mb(); } void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) { + DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); __raw_writel(d, map->map_priv_1 + adr); mb(); } void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) { + DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); memcpy_toio(map->map_priv_1 + to, from, len); } @@ -66,8 +90,6 @@ static struct map_info pb1xxx_map = { name: "Pb1xxx flash", - size: 0x800000, - buswidth: 4, read8: physmap_read8, read16: physmap_read16, read32: physmap_read32, @@ -81,15 +103,16 @@ #ifdef CONFIG_MIPS_PB1000 -static unsigned long pb1000_max_flash_size = 0x00800000; -static struct mtd_partition pb1000_partitions[] = { +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: "jffs/2", + name: "User FS", size: 0x003e0000, offset: 0x20000, },{ @@ -103,6 +126,72 @@ offset: 0x500000 } }; + +#elif defined(CONFIG_MIPS_PB1500) + +static unsigned char flash_buswidth = 4; +#if defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER) +/* 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: "yamon", + size: 0x0100000, + offset: 0x3c00000, + mask_flags: MTD_WRITEABLE + },{ + 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: "yamon", + size: 0x0100000, + offset: 0x1c00000, + mask_flags: MTD_WRITEABLE + },{ + 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: "raw kernel", + size: 0x0200000, + offset: 0x1e00000, + } +}; +#else +#error MTD_PB1500 define combo error /* should never happen */ +#endif #else #error Unsupported board #endif @@ -117,21 +206,18 @@ { struct mtd_partition *parts; int nb_parts = 0; - int parsed_nr_parts = 0; char *part_type; /* Default flash buswidth */ - pb1xxx_map.buswidth = 4; + pb1xxx_map.buswidth = flash_buswidth; /* * Static partition definition selection */ part_type = "static"; -#ifdef CONFIG_MIPS_PB1000 - parts = pb1000_partitions; - nb_parts = NB_OF(pb1000_partitions); -#endif - pb1xxx_map.size = 4; + parts = pb1xxx_partitions; + nb_parts = NB_OF(pb1xxx_partitions); + pb1xxx_map.size = flash_size; /* * Now let's probe for the actual flash. Do it here since @@ -142,8 +228,7 @@ pb1xxx_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); mymtd = do_map_probe("cfi_probe", &pb1xxx_map); - if (!mymtd) - return -ENXIO; + if (!mymtd) return -ENXIO; mymtd->module = THIS_MODULE; add_mtd_partitions(mymtd, parts, nb_parts); |