aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/sharpsl-flash.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/mtd/maps/sharpsl-flash.c
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/mtd/maps/sharpsl-flash.c')
-rw-r--r--drivers/mtd/maps/sharpsl-flash.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/mtd/maps/sharpsl-flash.c b/drivers/mtd/maps/sharpsl-flash.c
new file mode 100644
index 00000000000..b3b39cb7c60
--- /dev/null
+++ b/drivers/mtd/maps/sharpsl-flash.c
@@ -0,0 +1,101 @@
1/*
2 * sharpsl-flash.c
3 *
4 * Copyright (C) 2001 Lineo Japan, Inc.
5 * Copyright (C) 2002 SHARP
6 *
7 * $Id: sharpsl-flash.c,v 1.2 2004/11/24 20:38:06 rpurdie Exp $
8 *
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
11 *
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.
16 *
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.
21 *
22 */
23
24#include <linux/module.h>
25#include <linux/types.h>
26#include <linux/kernel.h>
27#include <asm/io.h>
28#include <linux/mtd/mtd.h>
29#include <linux/mtd/map.h>
30#include <linux/mtd/partitions.h>
31
32#define WINDOW_ADDR 0x00000000
33#define WINDOW_SIZE 0x01000000
34#define BANK_WIDTH 2
35
36static struct mtd_info *mymtd;
37
38struct map_info sharpsl_map = {
39 .name = "sharpsl-flash",
40 .size = WINDOW_SIZE,
41 .bankwidth = BANK_WIDTH,
42 .phys = WINDOW_ADDR
43};
44
45static struct mtd_partition sharpsl_partitions[1] = {
46 {
47 name: "Filesystem",
48 size: 0x006d0000,
49 offset: 0x00120000
50 }
51};
52
53#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
54
55int __init init_sharpsl(void)
56{
57 struct mtd_partition *parts;
58 int nb_parts = 0;
59 char *part_type = "static";
60
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");
65 return -EIO;
66 }
67 mymtd = do_map_probe("map_rom", &sharpsl_map);
68 if (!mymtd) {
69 iounmap(sharpsl_map.virt);
70 return -ENXIO;
71 }
72
73 mymtd->owner = THIS_MODULE;
74
75 parts = sharpsl_partitions;
76 nb_parts = NB_OF(sharpsl_partitions);
77
78 printk(KERN_NOTICE "Using %s partision definition\n", part_type);
79 add_mtd_partitions(mymtd, parts, nb_parts);
80
81 return 0;
82}
83
84static void __exit cleanup_sharpsl(void)
85{
86 if (mymtd) {
87 del_mtd_partitions(mymtd);
88 map_destroy(mymtd);
89 }
90 if (sharpsl_map.virt) {
91 iounmap(sharpsl_map.virt);
92 sharpsl_map.virt = 0;
93 }
94}
95
96module_init(init_sharpsl);
97module_exit(cleanup_sharpsl);
98
99MODULE_LICENSE("GPL");
100MODULE_AUTHOR("SHARP (Original: Arnold Christensen <AKC@pel.dk>)");
101MODULE_DESCRIPTION("MTD map driver for SHARP SL series");