2 * Flash device on lasat 100 and 200 boards
4 * Presumably (C) 2002 Brian Murphy <brian@murphy.dk> or whoever he
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
11 * $Id: lasat.c,v 1.5 2003/05/21 12:45:19 dwmw2 Exp $
15 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
23 #include <linux/config.h>
24 #include <asm/lasat/lasat.h>
25 #include <asm/lasat/lasat_mtd.h>
27 static struct mtd_info *mymtd;
29 static struct map_info sp_map = {
34 static struct mtd_partition partition_info[LASAT_MTD_LAST];
35 static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Filesystem", "Config"};
37 static int __init init_sp(void)
40 /* this does not play well with the old flash code which
41 * protects and uprotects the flash when necessary */
42 /* FIXME: Implement set_vpp() */
43 printk(KERN_NOTICE "Unprotecting flash\n");
44 *lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit;
46 sp_map.virt = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
47 sp_map.phys = virt_to_phys(sp_map.virt);
48 sp_map.size = lasat_board_info.li_flash_size;
50 simple_map_init(&sp_map);
52 printk(KERN_NOTICE "sp flash device: %lx at %lx\n",
53 sp_map.size, sp_map.phys);
55 for (i=0; i < LASAT_MTD_LAST; i++)
56 partition_info[i].name = lasat_mtd_partnames[i];
58 mymtd = do_map_probe("cfi_probe", &sp_map);
62 mymtd->owner = THIS_MODULE;
64 for (i=0; i < LASAT_MTD_LAST; i++) {
65 size = lasat_flash_partition_size(i);
66 partition_info[i].size = size;
67 partition_info[i].offset = offset;
71 add_mtd_partitions( mymtd, partition_info, LASAT_MTD_LAST );
78 static void __exit cleanup_sp(void)
81 del_mtd_partitions(mymtd);
90 module_exit(cleanup_sp);
92 MODULE_LICENSE("GPL");
93 MODULE_AUTHOR("Brian Murphy <brian@murphy.dk>");
94 MODULE_DESCRIPTION("Lasat Safepipe/Masquerade MTD map driver");