mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
ee0e87b174
The older add_mtd_device()/add_mtd_partitions() and their removal counterparts will soon be gone. Replace uses with mtd_device_register() and mtd_device_unregister(). Signed-off-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
65 lines
1.3 KiB
C
65 lines
1.3 KiB
C
/*
|
|
* Handle mapping of the flash on the RPX Lite and CLLF boards
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <asm/io.h>
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/map.h>
|
|
|
|
|
|
#define WINDOW_ADDR 0xfe000000
|
|
#define WINDOW_SIZE 0x800000
|
|
|
|
static struct mtd_info *mymtd;
|
|
|
|
static struct map_info rpxlite_map = {
|
|
.name = "RPX",
|
|
.size = WINDOW_SIZE,
|
|
.bankwidth = 4,
|
|
.phys = WINDOW_ADDR,
|
|
};
|
|
|
|
static int __init init_rpxlite(void)
|
|
{
|
|
printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
|
|
rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
|
|
|
|
if (!rpxlite_map.virt) {
|
|
printk("Failed to ioremap\n");
|
|
return -EIO;
|
|
}
|
|
simple_map_init(&rpxlite_map);
|
|
mymtd = do_map_probe("cfi_probe", &rpxlite_map);
|
|
if (mymtd) {
|
|
mymtd->owner = THIS_MODULE;
|
|
mtd_device_register(mymtd, NULL, 0);
|
|
return 0;
|
|
}
|
|
|
|
iounmap((void *)rpxlite_map.virt);
|
|
return -ENXIO;
|
|
}
|
|
|
|
static void __exit cleanup_rpxlite(void)
|
|
{
|
|
if (mymtd) {
|
|
mtd_device_unregister(mymtd);
|
|
map_destroy(mymtd);
|
|
}
|
|
if (rpxlite_map.virt) {
|
|
iounmap((void *)rpxlite_map.virt);
|
|
rpxlite_map.virt = 0;
|
|
}
|
|
}
|
|
|
|
module_init(init_rpxlite);
|
|
module_exit(cleanup_rpxlite);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Arnold Christensen <AKC@pel.dk>");
|
|
MODULE_DESCRIPTION("MTD map driver for RPX Lite and CLLF boards");
|