pq2fads.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * drivers/mtd/maps/pq2fads.c
  3. *
  4. * Mapping for the flash SIMM on 8272ADS and PQ2FADS board
  5. *
  6. * Author: Vitaly Bordug <vbordug@ru.mvista.com>
  7. *
  8. * 2005 (c) MontaVista Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. #include <linux/module.h>
  14. #include <linux/types.h>
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <asm/io.h>
  18. #include <asm/ppcboot.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/map.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/mtd/physmap.h>
  23. /*
  24. NOTE: bank width and interleave relative to the installed flash
  25. should have been chosen within MTD_CFI_GEOMETRY options.
  26. */
  27. #define PQ2FADS_BANK_WIDTH 4
  28. static struct mtd_partition pq2fads_partitions[] = {
  29. {
  30. #ifdef CONFIG_ADS8272
  31. .name = "HRCW",
  32. .size = 0x40000,
  33. .offset = 0,
  34. .mask_flags = MTD_WRITEABLE, /* force read-only */
  35. }, {
  36. .name = "User FS",
  37. .size = 0x5c0000,
  38. .offset = 0x40000,
  39. #else
  40. .name = "User FS",
  41. .size = 0x600000,
  42. .offset = 0,
  43. #endif
  44. }, {
  45. .name = "uImage",
  46. .size = 0x100000,
  47. .offset = 0x600000,
  48. .mask_flags = MTD_WRITEABLE, /* force read-only */
  49. }, {
  50. .name = "bootloader",
  51. .size = 0x40000,
  52. .offset = 0x700000,
  53. .mask_flags = MTD_WRITEABLE, /* force read-only */
  54. }, {
  55. .name = "bootloader env",
  56. .size = 0x40000,
  57. .offset = 0x740000,
  58. .mask_flags = MTD_WRITEABLE, /* force read-only */
  59. }
  60. };
  61. /* pointer to MPC885ADS board info data */
  62. extern unsigned char __res[];
  63. static int __init init_pq2fads_mtd(void)
  64. {
  65. bd_t *bd = (bd_t *)__res;
  66. physmap_configure(bd->bi_flashstart, bd->bi_flashsize, PQ2FADS_BANK_WIDTH, NULL);
  67. physmap_set_partitions(pq2fads_partitions,
  68. sizeof (pq2fads_partitions) /
  69. sizeof (pq2fads_partitions[0]));
  70. return 0;
  71. }
  72. static void __exit cleanup_pq2fads_mtd(void)
  73. {
  74. }
  75. module_init(init_pq2fads_mtd);
  76. module_exit(cleanup_pq2fads_mtd);
  77. MODULE_LICENSE("GPL");
  78. MODULE_DESCRIPTION("MTD map and partitions for MPC8272ADS boards");