mtd/drivers/mtd/maps dmv182.c, NONE, 1.1 Kconfig, 1.23,
1.24 Makefile.common, 1.12, 1.13 map_funcs.c, 1.5, 1.6
David Woodhouse
dwmw2 at infradead.org
Thu Jul 8 11:25:53 EDT 2004
- Previous message: mtd/drivers/mtd/chips Kconfig, 1.6, 1.7 cfi_probe.c, 1.74,
1.75 gen_probe.c, 1.15, 1.16 jedec_probe.c, 1.47, 1.48
- Next message: mtd/include/linux/mtd cfi.h,1.41,1.42 map.h,1.37,1.38
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv3941/drivers/mtd/maps
Modified Files:
Kconfig Makefile.common map_funcs.c
Added Files:
dmv182.c
Log Message:
New map geometry mess to replace the old mess. Oops I just broke all the
chip drivers. :)
--- NEW FILE dmv182.c ---
/*
* drivers/mtd/maps/svme182.c
*
* Flash map driver for the Dy4 SVME182 board
*
* Copyright 2003-2004, TimeSys Corporation
*
* Based on the SVME181 flash map, by Tom Nelson, Dot4, Inc. for TimeSys Corp.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/errno.h>
/*
* This driver currently handles only the 16MiB user flash bank 1 on the
* board. It does not provide access to bank 0 (contains the Dy4 FFW), bank 2
* (VxWorks boot), or the optional 48MiB expansion flash.
*
* scott.wood at timesys.com: On the newer boards with 128MiB flash, it
* now supports the first 96MiB (the boot flash bank containing FFW
* is excluded). The VxWorks loader is in partition 1.
*/
#define FLASH_BASE_ADDR 0xf0000000
#define FLASH_BANK_SIZE (128*1024*1024)
MODULE_AUTHOR("Scott Wood, TimeSys Corporation <scott.wood at timesys.com>");
MODULE_DESCRIPTION("User-programmable flash device on the Dy4 SVME182 board");
MODULE_LICENSE("GPL");
static struct map_info svme182_map = {
.name = "Dy4 SVME182",
.bankwidth = 32,
.size = 128 * 1024 * 1024
};
#define BOOTIMAGE_PART_SIZE ((6*1024*1024)-RESERVED_PART_SIZE)
// Allow 6MiB for the kernel
#define NEW_BOOTIMAGE_PART_SIZE (6 * 1024 * 1024)
// Allow 1MiB for the bootloader
#define NEW_BOOTLOADER_PART_SIZE (1024 * 1024)
// Use the remaining 9MiB at the end of flash for the RFS
#define NEW_RFS_PART_SIZE (0x01000000 - NEW_BOOTLOADER_PART_SIZE - \
NEW_BOOTIMAGE_PART_SIZE)
static struct mtd_partition svme182_partitions[] = {
// The Lower PABS is only 128KiB, but the partition code doesn't
// like partitions that don't end on the largest erase block
// size of the device, even if all of the erase blocks in the
// partition are small ones. The hardware should prevent
// writes to the actual PABS areas.
{
name: "Lower PABS and CPU 0 bootloader or kernel",
size: 6*1024*1024,
offset: 0,
},
{
name: "Root Filesystem",
size: 10*1024*1024,
offset: MTDPART_OFS_NXTBLK
},
{
name: "CPU1 Bootloader",
size: 1024*1024,
offset: MTDPART_OFS_NXTBLK,
},
{
name: "Extra",
size: 110*1024*1024,
offset: MTDPART_OFS_NXTBLK
},
{
name: "Foundation Firmware and Upper PABS",
size: 1024*1024,
offset: MTDPART_OFS_NXTBLK,
mask_flags: MTD_WRITEABLE // read-only
}
};
static struct mtd_info *this_mtd;
static int __init init_svme182(void)
{
struct mtd_partition *partitions;
int num_parts = sizeof(svme182_partitions) / sizeof(struct mtd_partition);
partitions = svme182_partitions;
svme182_map.virt =
(unsigned long)ioremap(FLASH_BASE_ADDR, svme182_map.size);
if (svme182_map.virt == 0) {
printk("Failed to ioremap FLASH memory area.\n");
return -EIO;
}
simple_map_init(&map);
this_mtd = do_map_probe("cfi_probe", &svme182_map);
if (!this_mtd)
{
iounmap((void *)svme182_map.virt);
return -ENXIO;
}
printk(KERN_NOTICE "SVME182 flash device: %dMiB at 0x%08x\n",
this_mtd->size >> 20, FLASH_BASE_ADDR);
this_mtd->owner = THIS_MODULE;
add_mtd_partitions(this_mtd, partitions, num_parts);
return 0;
}
static void __exit cleanup_svme182(void)
{
if (this_mtd)
{
del_mtd_partitions(this_mtd);
map_destroy(this_mtd);
}
if (svme182_map.virt)
{
iounmap((void *)svme182_map.virt);
svme182_map.virt = 0;
}
return;
}
module_init(init_svme182);
module_exit(cleanup_svme182);
Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Kconfig 7 Jun 2004 10:21:32 -0000 1.23
+++ Kconfig 8 Jul 2004 15:25:50 -0000 1.24
@@ -558,10 +558,25 @@
config MTD_WRSBC8260
tristate "Map driver for WindRiver PowerQUICC II MPC82xx board"
- depends on MTD_PARTITIONS && SBC82xx
+ depends on SBC82xx
+ select MTD_PARTITIONS
+ select MTD_MAP_BANK_WIDTH_4
+ select MTD_MAP_BANK_WIDTH_1
+ select MTD_CFI_I1
+ select MTD_CFI_I2
help
Map driver for WindRiver PowerQUICC II MPC82xx board. Drives
all three flash regions on CS0, CS1 and CS6 if they are configured
correctly by the boot loader.
+
+config MTD_DMV182
+ tristate "Map driver for Dy-4 SVME/DMV-182 board."
+ depends on DMV182
+ select MTD_PARTITIONS
+ select MTD_MAP_BANK_WIDTH_32
+ select MTD_CFI_I8
+ help
+ Map driver for Dy-4 SVME/DMV-182 board.
+
endmenu
Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile.common,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Makefile.common 7 Jun 2004 10:21:32 -0000 1.12
+++ Makefile.common 8 Jul 2004 15:25:50 -0000 1.13
@@ -69,5 +69,6 @@
obj-$(CONFIG_MTD_MPC1211) += mpc1211.o
obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o
obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o
+obj-$(CONFIG_MTD_DMV182) += dmv182.o
-include $(TOPDIR)/Rules.make
Index: map_funcs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/map_funcs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- map_funcs.c 3 Jun 2004 04:10:22 -0000 1.5
+++ map_funcs.c 8 Jul 2004 15:25:50 -0000 1.6
@@ -7,89 +7,33 @@
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <asm/io.h>
#include <linux/mtd/map.h>
-static u8 simple_map_read8(struct map_info *map, unsigned long ofs)
+static map_word simple_map_read(struct map_info *map, unsigned long ofs)
{
- return __raw_readb(map->virt + ofs);
+ return inline_map_read(map, ofs);
}
-static u16 simple_map_read16(struct map_info *map, unsigned long ofs)
+static void simple_map_write(struct map_info *map, const map_word datum, unsigned long ofs)
{
- return __raw_readw(map->virt + ofs);
-}
-
-static u32 simple_map_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->virt + ofs);
-}
-
-static u64 simple_map_read64(struct map_info *map, unsigned long ofs)
-{
-#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
- BUG();
- return 0;
-#else
- return __raw_readq(map->virt + ofs);
-#endif
-}
-
-static void simple_map_write8(struct map_info *map, u8 datum, unsigned long ofs)
-{
- __raw_writeb(datum, map->virt + ofs);
- mb();
-}
-
-static void simple_map_write16(struct map_info *map, u16 datum, unsigned long ofs)
-{
- __raw_writew(datum, map->virt + ofs);
- mb();
-}
-
-static void simple_map_write32(struct map_info *map, u32 datum, unsigned long ofs)
-{
- __raw_writel(datum, map->virt + ofs);
- mb();
-}
-
-static void simple_map_write64(struct map_info *map, u64 datum, unsigned long ofs)
-{
-#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
- BUG();
-#else
- __raw_writeq(datum, map->virt + ofs);
- mb();
-#endif /* CFI_B8 */
+ inline_map_write(datum, map->virt + ofs);
}
static void simple_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
- if (map->cached)
- memcpy(to, (char *)map->cached + from, len);
- else
- memcpy_fromio(to, map->virt + from, len);
+ inline_map_copy_from(map, to, from, len);
}
static void simple_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
- memcpy_toio(map->virt + to, from, len);
+ inline_map_copy_to(map, to, from, len);
}
void simple_map_init(struct map_info *map)
{
- map->read8 = simple_map_read8;
- map->read16 = simple_map_read16;
- map->read32 = simple_map_read32;
- map->read64 = simple_map_read64;
- map->write8 = simple_map_write8;
- map->write16 = simple_map_write16;
- map->write32 = simple_map_write32;
- map->write64 = simple_map_write64;
+ map->read = simple_map_read;
+ map->write = simple_map_write;
map->copy_from = simple_map_copy_from;
map->copy_to = simple_map_copy_to;
}
- Previous message: mtd/drivers/mtd/chips Kconfig, 1.6, 1.7 cfi_probe.c, 1.74,
1.75 gen_probe.c, 1.15, 1.16 jedec_probe.c, 1.47, 1.48
- Next message: mtd/include/linux/mtd cfi.h,1.41,1.42 map.h,1.37,1.38
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list