hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcsable / htcsable_rom.c
blob89513dbed84a56115f59680b9188969867828919
1 /*
2 * Pseudo-device to access IPL memory.
4 * License: GPL
6 * Author: Luke Kenneth Casson Leighton, Copyright(C) 2004
8 * Copyright(C) 2004, Luke Kenneth Casson Leighton.
10 * History:
12 * 2004-02-19 Luke Kenneth Casson Leighton created.
16 #include <linux/module.h>
17 #include <linux/dma-mapping.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/map.h>
20 #include <asm/mach-types.h>
23 #define FLASH_ADDR1 0x00000000
24 #define FLASH_ADDR2 0x00000000
25 #define WINDOW_SIZE 0x800
27 static struct map_info sable_map = {
28 .name = "IPL Flash",
29 .size = WINDOW_SIZE,
30 .phys = FLASH_ADDR1,
31 .bankwidth = 4,
34 static struct mtd_info *mymtd;
36 static int sable_rom_init (void)
38 int retval = 0;
40 #if defined(CONFIG_MACH_BLUEANGEL)
41 if (! machine_is_sable() )
42 return -ENODEV;
43 #endif
45 sable_map.virt = ioremap(sable_map.phys, sable_map.size);
46 if (!sable_map.virt) {
47 printk(KERN_WARNING "Failed to ioremap %s\n", sable_map.name);
48 return -ENOMEM;
50 sable_map.cached = ioremap_cached(sable_map.phys, sable_map.size);
51 if (!sable_map.cached)
52 printk(KERN_WARNING "Failed to ioremap cached %s\n", sable_map.name);
53 simple_map_init(&sable_map);
55 printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n",
56 sable_map.name, sable_map.phys,
57 sable_map.bankwidth * 8);
59 mymtd = do_map_probe("cfi_probe", &sable_map);
60 printk("mymtd=%p\n", mymtd);
61 if (mymtd)
62 add_mtd_device(mymtd);
63 return retval;
66 static void sable_rom_exit (void)
68 del_mtd_device(mymtd);
70 map_destroy(mymtd);
71 iounmap((void *)sable_map.virt);
72 if (sable_map.cached)
73 iounmap(sable_map.cached);
76 module_init (sable_rom_init);
77 module_exit (sable_rom_exit);