rpxlite.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * $Id: rpxlite.c,v 1.22 2004/11/04 13:24:15 gleixner Exp $
  3. *
  4. * Handle mapping of the flash on the RPX Lite and CLLF boards
  5. */
  6. #include <linux/module.h>
  7. #include <linux/types.h>
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <asm/io.h>
  11. #include <linux/mtd/mtd.h>
  12. #include <linux/mtd/map.h>
  13. #define WINDOW_ADDR 0xfe000000
  14. #define WINDOW_SIZE 0x800000
  15. static struct mtd_info *mymtd;
  16. static struct map_info rpxlite_map = {
  17. .name = "RPX",
  18. .size = WINDOW_SIZE,
  19. .bankwidth = 4,
  20. .phys = WINDOW_ADDR,
  21. };
  22. int __init init_rpxlite(void)
  23. {
  24. printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
  25. rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
  26. if (!rpxlite_map.virt) {
  27. printk("Failed to ioremap\n");
  28. return -EIO;
  29. }
  30. simple_map_init(&rpxlite_map);
  31. mymtd = do_map_probe("cfi_probe", &rpxlite_map);
  32. if (mymtd) {
  33. mymtd->owner = THIS_MODULE;
  34. add_mtd_device(mymtd);
  35. return 0;
  36. }
  37. iounmap((void *)rpxlite_map.virt);
  38. return -ENXIO;
  39. }
  40. static void __exit cleanup_rpxlite(void)
  41. {
  42. if (mymtd) {
  43. del_mtd_device(mymtd);
  44. map_destroy(mymtd);
  45. }
  46. if (rpxlite_map.virt) {
  47. iounmap((void *)rpxlite_map.virt);
  48. rpxlite_map.virt = 0;
  49. }
  50. }
  51. module_init(init_rpxlite);
  52. module_exit(cleanup_rpxlite);
  53. MODULE_LICENSE("GPL");
  54. MODULE_AUTHOR("Arnold Christensen <AKC@pel.dk>");
  55. MODULE_DESCRIPTION("MTD map driver for RPX Lite and CLLF boards");