[MTD] maps: Add support for MTX-1 Flash device

Add support for "4G Systems MTX-1 Flash device", better known as meshcube.

From: Bruno Randolf <bruno.randolf@4g-systems.biz>
Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Joern Engel 2005-09-18 11:46:45 +01:00 committed by Thomas Gleixner
parent 34c0e90671
commit b523b3bac3
3 changed files with 106 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# drivers/mtd/maps/Kconfig # drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.58 2005/09/14 19:14:13 tpoynor Exp $ # $Id: Kconfig,v 1.59 2005/09/18 10:46:41 joern Exp $
menu "Mapping drivers for chip access" menu "Mapping drivers for chip access"
depends on MTD!=n depends on MTD!=n
@ -214,6 +214,13 @@ config MTD_ALCHEMY
help help
Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
config MTD_MTX1
tristate "4G Systems MTX-1 Flash device"
depends on MIPS && MIPS_MTX1
help
Flash memory access on 4G Systems MTX-1 Board. If you have one of
these boards and would like to use the flash chips on it, say 'Y'.
config MTD_DILNETPC config MTD_DILNETPC
tristate "CFI Flash device mapped on DIL/Net PC" tristate "CFI Flash device mapped on DIL/Net PC"
depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT

View File

@ -1,7 +1,7 @@
# #
# linux/drivers/maps/Makefile # linux/drivers/maps/Makefile
# #
# $Id: Makefile.common,v 1.31 2005/09/14 19:14:13 tpoynor Exp $ # $Id: Makefile.common,v 1.32 2005/09/18 10:46:41 joern Exp $
ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y) ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
obj-$(CONFIG_MTD) += map_funcs.o obj-$(CONFIG_MTD) += map_funcs.o
@ -71,3 +71,4 @@ obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o
obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o

View File

@ -0,0 +1,96 @@
/*
* Flash memory access on 4G Systems MTX-1 boards
*
* $Id: mtx-1_flash.c,v 1.1 2005/09/18 10:46:41 joern Exp $
*
* (C) 2005 Bruno Randolf <bruno.randolf@4g-systems.biz>
* (C) 2005 Jörn Engel <joern@wohnheim.fh-wedel.de>
*
*/
#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>
static struct map_info mtx1_map = {
.name = "MTX-1 flash",
.bankwidth = 4,
.size = 0x2000000,
.phys = 0x1E000000,
};
static struct mtd_partition mtx1_partitions[] = {
{
.name = "filesystem",
.size = 0x01C00000,
.offset = 0,
},{
.name = "yamon",
.size = 0x00100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE,
},{
.name = "kernel",
.size = 0x002c0000,
.offset = MTDPART_OFS_APPEND,
},{
.name = "yamon env",
.size = 0x00040000,
.offset = MTDPART_OFS_APPEND,
}
};
static struct mtd_info *mtx1_mtd;
int __init mtx1_mtd_init(void)
{
int ret = -ENXIO;
simple_map_init(&mtx1_map);
mtx1_map.virt = ioremap(mtx1_map.phys, mtx1_map.size);
if (!mtx1_map.virt)
return -EIO;
mtx1_mtd = do_map_probe("cfi_probe", &mtx1_map);
if (!mtx1_mtd)
goto err;
mtx1_mtd->owner = THIS_MODULE;
ret = add_mtd_partitions(mtx1_mtd, mtx1_partitions,
ARRAY_SIZE(mtx1_partitions));
if (ret)
goto err;
return 0;
err:
iounmap(mtx1_map.virt);
return ret;
}
static void __exit mtx1_mtd_cleanup(void)
{
if (mtx1_mtd) {
del_mtd_partitions(mtx1_mtd);
map_destroy(mtx1_mtd);
}
if (mtx1_map.virt)
iounmap(mtx1_map.virt);
}
module_init(mtx1_mtd_init);
module_exit(mtx1_mtd_cleanup);
MODULE_AUTHOR("Bruno Randolf <bruno.randolf@4g-systems.biz>");
MODULE_DESCRIPTION("MTX-1 flash map");
MODULE_LICENSE("GPL");