mtd/drivers/mtd/maps db1x00-flash.c,NONE,1.1 Config.in,1.53,1.54
Makefile.common,1.2,1.3 pb1xxx-flash.c,1.9,1.10
ppopov at infradead.org
ppopov at infradead.org
Thu Aug 28 02:50:27 EDT 2003
- Previous message: mtd/fs/jffs2 background.c,1.39,1.40 fs.c,1.26,1.27
super-v24.c,1.71,1.72 super.c,1.85,1.86 wbuf.c,1.39,1.40
- Next message: mtd/patches patchin.sh,1.15,1.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv31826/drivers/mtd/maps
Modified Files:
Config.in Makefile.common pb1xxx-flash.c
Added Files:
db1x00-flash.c
Log Message:
Updated the pb1x00 and db1x00 mapping files with the new APIs.
--- NEW FILE db1x00-flash.c ---
/*
* Flash memory access on Alchemy Db1xxx boards
*
* (C) 2003 Pete Popov <ppopov at pacbell.net>
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/au1000.h>
#include <asm/db1x00.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
static unsigned long window_addr;
static unsigned long window_size;
static unsigned long flash_size;
static BCSR * const bcsr = (BCSR *)0xAE000000;
static unsigned char flash_buswidth = 4;
/*
* The Db1x boards support different flash densities. We setup
* the mtd_partition structures below for default of 64Mbit
* flash densities, and override the partitions sizes, if
* necessary, after we check the board status register.
*/
#ifdef DB1X00_BOTH_BANKS
/* both banks will be used. Combine the first bank and the first
* part of the second bank together into a single jffs/jffs2
* partition.
*/
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x1c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1X00_BOOT_ONLY)
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x00c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1X00_USER_ONLY)
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x0e00000,
.offset = 0x0000000
},{
.name = "raw kernel",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
}
};
#else
#error MTD_DB1X00 define combo error /* should never happen */
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
#define NAME "Db1x00 Linux Flash"
static struct map_info db1xxx_mtd_map = {
.name = NAME,
};
static struct mtd_partition *parsed_parts;
static struct mtd_info *db1xxx_mtd;
/*
* Probe the flash density and setup window address and size
* based on user CONFIG options. There are times when we don't
* want the MTD driver to be probing the boot or user flash,
* so having the option to enable only one bank is important.
*/
int setup_flash_params(void)
{
switch ((bcsr->status >> 14) & 0x3) {
case 0: /* 64Mbit devices */
flash_size = 0x800000; /* 8MB per part */
#if defined(DB1X00_BOTH_BANKS)
window_addr = 0x1E000000;
window_size = 0x2000000;
#elif defined(DB1X00_BOOT_ONLY)
window_addr = 0x1F000000;
window_size = 0x1000000;
#else /* USER ONLY */
window_addr = 0x1E000000;
window_size = 0x1000000;
#endif
break;
case 1:
/* 128 Mbit devices */
flash_size = 0x1000000; /* 16MB per part */
#if defined(DB1X00_BOTH_BANKS)
window_addr = 0x1C000000;
window_size = 0x4000000;
/* USERFS from 0x1C00 0000 to 0x1FC0 0000 */
db1x00_partitions[0].size = 0x3C00000;
#elif defined(DB1X00_BOOT_ONLY)
window_addr = 0x1E000000;
window_size = 0x2000000;
/* USERFS from 0x1E00 0000 to 0x1FC0 0000 */
db1x00_partitions[0].size = 0x1C00000;
#else /* USER ONLY */
window_addr = 0x1C000000;
window_size = 0x2000000;
/* USERFS from 0x1C00 0000 to 0x1DE00000 */
db1x00_partitions[0].size = 0x1DE0000;
#endif
break;
case 2:
/* 256 Mbit devices */
flash_size = 0x4000000; /* 64MB per part */
#if defined(DB1X00_BOTH_BANKS)
return 1;
#elif defined(DB1X00_BOOT_ONLY)
/* Boot ROM flash bank only; no user bank */
window_addr = 0x1C000000;
window_size = 0x4000000;
/* USERFS from 0x1C00 0000 to 0x1FC00000 */
db1x00_partitions[0].size = 0x3C00000;
#else /* USER ONLY */
return 1;
#endif
break;
default:
return 1;
}
db1xxx_mtd_map.size = window_size;
db1xxx_mtd_map.buswidth = flash_buswidth;
db1xxx_mtd_map.phys = window_addr;
db1xxx_mtd_map.buswidth = flash_buswidth;
return 0;
}
int __init db1x00_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
if (setup_flash_params())
return -ENXIO;
/*
* Static partition definition selection
*/
parts = db1x00_partitions;
nb_parts = NB_OF(db1x00_partitions);
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE "Db1xxx flash: probing %d-bit flash bus\n",
db1xxx_mtd_map.buswidth*8);
db1xxx_mtd_map.virt = (unsigned long)ioremap(window_addr, window_size);
db1xxx_mtd = do_map_probe("cfi_probe", &db1xxx_mtd_map);
if (!db1xxx_mtd) return -ENXIO;
db1xxx_mtd->owner = THIS_MODULE;
add_mtd_partitions(db1xxx_mtd, parts, nb_parts);
return 0;
}
static void __exit db1x00_mtd_cleanup(void)
{
if (db1xxx_mtd) {
del_mtd_partitions(db1xxx_mtd);
map_destroy(db1xxx_mtd);
if (parsed_parts)
kfree(parsed_parts);
}
}
module_init(db1x00_mtd_init);
module_exit(db1x00_mtd_cleanup);
MODULE_AUTHOR("Pete Popov");
MODULE_DESCRIPTION("Db1x00 mtd map driver");
MODULE_LICENSE("GPL");
Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Config.in 19 Aug 2003 09:19:37 -0000 1.53
+++ Config.in 28 Aug 2003 06:50:24 -0000 1.54
@@ -75,6 +75,11 @@
bool ' Pb1x00 user flash device (2nd 32MiB bank)' CONFIG_MTD_PB1500_USER
fi
fi
+ tristate ' Db1x00 MTD support' CONFIG_MTD_DB1X00
+ if [ "$CONFIG_MTD_DB1X00" = "y" -o "$CONFIG_MTD_DB1X00" = "m" ]; then
+ bool ' Db1x00 boot flash device' CONFIG_MTD_DB1X00_BOOT
+ bool ' Db1x00 user flash device (2nd bank)' CONFIG_MTD_DB1X00_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.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile.common,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.common 28 May 2003 10:48:41 -0000 1.2
+++ Makefile.common 28 Aug 2003 06:50:24 -0000 1.3
@@ -48,6 +48,7 @@
obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
obj-$(CONFIG_MTD_PCI) += pci.o
obj-$(CONFIG_MTD_PB1XXX) += pb1xxx-flash.o
+obj-$(CONFIG_MTD_DB1X00) += db1x00-flash.o
obj-$(CONFIG_MTD_LASAT) += lasat.o
obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
obj-$(CONFIG_MTD_EDB7312) += edb7312.o
Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- pb1xxx-flash.c 23 Jun 2003 11:48:18 -0000 1.9
+++ pb1xxx-flash.c 28 Aug 2003 06:50:24 -0000 1.10
@@ -9,8 +9,8 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
-#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
@@ -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 = "yamon",
- .size = 0x0100000,
- .offset = 0x3c00000,
- .mask_flags = MTD_WRITEABLE
- },{
- .name = "raw kernel",
- .size = 0x02c0000,
- .offset = 0x3d00000
+ .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
+ .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,
+ .name = "User FS",
+ .size = 0x1e00000,
+ .offset = 0x0000000
+ },{
+ .name = "raw kernel",
+ .size = 0x0200000,
+ .offset = 0x1e00000,
}
};
#else
@@ -131,8 +116,20 @@
#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,
+ .buswidth = BUSWIDTH,
+ .phys = PADDR,
+};
+
+static struct mtd_info *pb1xxx_mtd;
int __init pb1xxx_mtd_init(void)
{
@@ -140,49 +137,38 @@
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);
-
- simple_map_init(&pb1xxx_map);
-
- mymtd = do_map_probe("cfi_probe", &pb1xxx_map);
- if (!mymtd) {
- iounmap(pb1xxx_map.virt);
- return -ENXIO;
- }
- mymtd->owner = THIS_MODULE;
+ BUSWIDTH*8);
+ pb1xxx_mtd_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+
+ simple_map_init(&pb1xxx_mtd_map);
+
+ 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);
- Previous message: mtd/fs/jffs2 background.c,1.39,1.40 fs.c,1.26,1.27
super-v24.c,1.71,1.72 super.c,1.85,1.86 wbuf.c,1.39,1.40
- Next message: mtd/patches patchin.sh,1.15,1.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list