4 * Copyright (C) 2001 Lineo Japan, Inc.
5 * Copyright (C) 2002 SHARP
7 * $Id: sharpsl-flash.c,v 1.2 2004/11/24 20:38:06 rpurdie Exp $
9 * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp
10 * Handle mapping of the flash on the RPX Lite and CLLF boards
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
24 #include <linux/module.h>
25 #include <linux/types.h>
26 #include <linux/kernel.h>
28 #include <linux/mtd/mtd.h>
29 #include <linux/mtd/map.h>
30 #include <linux/mtd/partitions.h>
32 #define WINDOW_ADDR 0x00000000
33 #define WINDOW_SIZE 0x01000000
36 static struct mtd_info
*mymtd
;
38 struct map_info sharpsl_map
= {
39 .name
= "sharpsl-flash",
41 .bankwidth
= BANK_WIDTH
,
45 static struct mtd_partition sharpsl_partitions
[1] = {
53 #define NB_OF(x) (sizeof(x)/sizeof(x[0]))
55 int __init
init_sharpsl(void)
57 struct mtd_partition
*parts
;
59 char *part_type
= "static";
61 printk(KERN_NOTICE
"Sharp SL series flash device: %x at %x\n", WINDOW_SIZE
, WINDOW_ADDR
);
62 sharpsl_map
.virt
= ioremap(WINDOW_ADDR
, WINDOW_SIZE
);
63 if (!sharpsl_map
.virt
) {
64 printk("Failed to ioremap\n");
67 mymtd
= do_map_probe("map_rom", &sharpsl_map
);
69 iounmap(sharpsl_map
.virt
);
73 mymtd
->owner
= THIS_MODULE
;
75 parts
= sharpsl_partitions
;
76 nb_parts
= NB_OF(sharpsl_partitions
);
78 printk(KERN_NOTICE
"Using %s partision definition\n", part_type
);
79 add_mtd_partitions(mymtd
, parts
, nb_parts
);
84 static void __exit
cleanup_sharpsl(void)
87 del_mtd_partitions(mymtd
);
90 if (sharpsl_map
.virt
) {
91 iounmap(sharpsl_map
.virt
);
96 module_init(init_sharpsl
);
97 module_exit(cleanup_sharpsl
);
99 MODULE_LICENSE("GPL");
100 MODULE_AUTHOR("SHARP (Original: Arnold Christensen <AKC@pel.dk>)");
101 MODULE_DESCRIPTION("MTD map driver for SHARP SL series");