1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ts5500_flash.c -- MTD map driver for Technology Systems TS-5500 board
5 * Copyright (C) 2004 Sean Young <sean@mess.org>
8 * - In order for detection to work, jumper 3 must be set.
9 * - Drive A and B use the resident flash disk (RFD) flash translation layer.
10 * - If you have created your own jffs file system and the bios overwrites
11 * it during boot, try disabling Drive A: and B: in the boot order.
14 #include <linux/init.h>
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/mtd/map.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/partitions.h>
20 #include <linux/types.h>
23 #define WINDOW_ADDR 0x09400000
24 #define WINDOW_SIZE 0x00200000
26 static struct map_info ts5500_map
= {
27 .name
= "TS-5500 Flash",
33 static const struct mtd_partition ts5500_partitions
[] = {
51 #define NUM_PARTITIONS ARRAY_SIZE(ts5500_partitions)
53 static struct mtd_info
*mymtd
;
55 static int __init
init_ts5500_map(void)
59 ts5500_map
.virt
= ioremap(ts5500_map
.phys
, ts5500_map
.size
);
61 if (!ts5500_map
.virt
) {
62 printk(KERN_ERR
"Failed to ioremap\n");
67 simple_map_init(&ts5500_map
);
69 mymtd
= do_map_probe("jedec_probe", &ts5500_map
);
71 mymtd
= do_map_probe("map_rom", &ts5500_map
);
78 mymtd
->owner
= THIS_MODULE
;
79 mtd_device_register(mymtd
, ts5500_partitions
, NUM_PARTITIONS
);
84 iounmap(ts5500_map
.virt
);
89 static void __exit
cleanup_ts5500_map(void)
92 mtd_device_unregister(mymtd
);
96 if (ts5500_map
.virt
) {
97 iounmap(ts5500_map
.virt
);
98 ts5500_map
.virt
= NULL
;
102 module_init(init_ts5500_map
);
103 module_exit(cleanup_ts5500_map
);
105 MODULE_LICENSE("GPL");
106 MODULE_AUTHOR("Sean Young <sean@mess.org>");
107 MODULE_DESCRIPTION("MTD map driver for Technology Systems TS-5500 board");