mtd/drivers/mtd/maps h720x-flash.c,NONE,1.1 Config.in,1.46,1.47 Kconfig,1.5,1.6 Makefile,1.39,1.40

gleixner at infradead.org gleixner at infradead.org
Sun Apr 20 04:38:04 EDT 2003


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv7392

Modified Files:
	Config.in Kconfig Makefile 
Added Files:
	h720x-flash.c 
Log Message:
add support for hynix evaluation boards

--- NEW FILE h720x-flash.c ---
/*
 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based 
 * evaluation boards
 * 
 * (C) 2002 Jungjun Kim <jungjun.kim at hynix.com>
 *     2003 Thomas Gleixner <tglx at linutronix.de>	
*/

#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>

#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>

#include <asm/hardware.h>
#include <asm/io.h>

static struct mtd_info *mymtd;

static __u8 h720x_read8(struct map_info *map, unsigned long ofs)
{
	return readb(map->map_priv_1 + ofs);
}

static __u16 h720x_read16(struct map_info *map, unsigned long ofs)
{
	return readw(map->map_priv_1 + ofs);
}

static __u32 h720x_read32(struct map_info *map, unsigned long ofs)
{
	return readl(map->map_priv_1 + ofs);
}

static void h720x_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
	memcpy_fromio(to, map->map_priv_1 + from, len);
}

static void h720x_write8(struct map_info *map, __u8 d, unsigned long adr)
{
	writeb(d, map->map_priv_1 + adr);
}

static void h720x_write16(struct map_info *map, __u16 d, unsigned long adr)
{
	writew(d, map->map_priv_1 + adr);
}

static void h720x_write32(struct map_info *map, __u32 d, unsigned long adr)
{
	writel(d, map->map_priv_1 + adr);
}

static void h720x_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
	memcpy_toio(map->map_priv_1 + to, from, len);
}

static struct map_info h720x_map = {
	name:		"H720X",
	read8:		h720x_read8,
	read16:		h720x_read16,
	read32:		h720x_read32,
	copy_from:	h720x_copy_from,
	write8:		h720x_write8,
	write16:	h720x_write16,
	write32:	h720x_write32,
	copy_to:	h720x_copy_to,
	buswidth:	4,
	size:		FLASH_SIZE
};

static struct mtd_partition h720x_partitions[] = {
        {
                name: "ArMon",
                size: 0x00080000,
                offset: 0,
                mask_flags: MTD_WRITEABLE
        },{
                name: "Env",
                size: 0x00040000,
                offset: 0x00080000,
                mask_flags: MTD_WRITEABLE
        },{
                name: "Kernel",
                size: 0x00180000,
                offset: 0x000c0000,
                mask_flags: MTD_WRITEABLE
        },{
                name: "Ramdisk",
                size: 0x00400000,
                offset: 0x00240000,
                mask_flags: MTD_WRITEABLE
        },{
                name: "jffs2",
                size: MTDPART_SIZ_FULL,
                offset: MTDPART_OFS_APPEND
        }
};

#define NUM_PARTITIONS  (sizeof(h720x_partitions)/sizeof(h720x_partitions[0]))

static int                   nr_mtd_parts;
static struct mtd_partition *mtd_parts;

/*
 * Initialize FLASH support
 */
int __init h720x_mtd_init(void)
{

	char	*part_type = NULL;
	
	h720x_map.map_priv_1 = (unsigned long)ioremap(FLASH_PHYS, FLASH_SIZE);

	if (!h720x_map.map_priv_1) {
		printk(KERN_ERR "H720x-MTD: ioremap failed\n");
		return -EIO;
	}

	// Probe for flash buswidth 4
	printk (KERN_INFO "H720x-MTD probing 32bit FLASH\n");
	mymtd = do_map_probe("cfi_probe", &h720x_map);
	if (!mymtd) {
		printk (KERN_INFO "H720x-MTD probing 16bit FLASH\n");
	    // Probe for buswidth 2
	    h720x_map.buswidth = 2;
	    mymtd = do_map_probe("cfi_probe", &h720x_map);
	}
	    
	if (mymtd) {
		mymtd->module = THIS_MODULE;

#ifdef CONFIG_MTD_CMDLINE_PARTS
		nr_mtd_parts = parse_cmdline_partitions(mymtd, &mtd_parts, h720x_map.name);
		if (nr_mtd_parts > 0)
			part_type = "command line";
#endif
		if (nr_mtd_parts <= 0) {
			mtd_parts = h720x_partitions;
			nr_mtd_parts = NUM_PARTITIONS;
			part_type = "builtin";
		}
		printk(KERN_INFO "Using %s partition table\n", part_type);
		add_mtd_partitions(mymtd, mtd_parts, nr_mtd_parts);
		return 0;
	}

	iounmap((void *)h720x_map.map_priv_1);
	return -ENXIO;
}

/*
 * Cleanup
 */
static void __exit h720x_mtd_cleanup(void)
{

	if (mymtd) {
		del_mtd_partitions(mymtd);
		map_destroy(mymtd);
	}
	
	/* Free partition info, if commandline partition was used */
	if (mtd_parts && (mtd_parts != h720x_partitions))
		kfree (mtd_parts);
	
	if (h720x_map.map_priv_1) {
		iounmap((void *)h720x_map.map_priv_1);
		h720x_map.map_priv_1 = 0;
	}
}


module_init(h720x_mtd_init);
module_exit(h720x_mtd_cleanup);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Thomas Gleixner <tglx at linutronix.de>");
MODULE_DESCRIPTION("MTD map driver for Hynix evaluation boards");

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- Config.in	10 Apr 2003 12:20:18 -0000	1.46
+++ Config.in	20 Apr 2003 08:38:01 -0000	1.47
@@ -105,6 +105,7 @@
    dep_tristate '  CFI Flash device mapped on the FortuNet board' CONFIG_MTD_FORTUNET $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS $CONFIG_SA1100_FORTUNET
    dep_tristate '  NV-RAM mapping AUTCPU12 board' CONFIG_MTD_AUTCPU12 $CONFIG_ARCH_AUTCPU12
    dep_tristate '  CFI Flash device mapped on EDB7312' CONFIG_MTD_EDB7312 $CONFIG_MTD_CFI
+   dep_tristate '  CFI Flash device mapped on Hynix evaluation boards' CONFIG_MTD_H720X $CONFIG_MTD_CFI
    dep_tristate '  JEDEC Flash device mapped on impA7' CONFIG_MTD_IMPA7 $CONFIG_MTD_JEDECPROBE
    dep_tristate '  JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame' CONFIG_MTD_CEIVA $CONFIG_MTD_JEDECPROBE  $CONFIG_ARCH_CEIVA
 fi

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Kconfig	10 Apr 2003 12:20:19 -0000	1.5
+++ Kconfig	20 Apr 2003 08:38:01 -0000	1.6
@@ -366,6 +366,13 @@
 	  PhotoMax Digital Picture Frame.
 	  If you have such a device, say 'Y'.
 
+config MTD_H720X
+	tristate "Hynix evaluation board mappings"
+	depends on ARM && MTD_CFI && ( ARCH_H7201 || ARCH_H7202 )
+	help
+	  This enables access to the flash chips on the Hynix evaluation boards.
+	  If you have such a board, say 'Y'.
+
 # This needs CFI or JEDEC, depending on the cards found.
 config MTD_PCI
 	tristate "PCI MTD driver"

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Makefile	10 Apr 2003 12:20:18 -0000	1.39
+++ Makefile	20 Apr 2003 08:38:01 -0000	1.40
@@ -65,5 +65,6 @@
 obj-$(CONFIG_MTD_EBONY)		+= ebony.o
 obj-$(CONFIG_MTD_BEECH)		+= beech-mtd.o
 obj-$(CONFIG_MTD_ARCTIC)	+= arctic-mtd.o
+obj-$(CONFIG_MTD_H720X)		+= h720x-flash.o
 
 include $(TOPDIR)/Rules.make




More information about the linux-mtd-cvs mailing list