board-sg.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * board-sg.c -- support for the SnapGear KS8695 based boards
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/types.h>
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/map.h>
  14. #include <linux/mtd/physmap.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include "devices.h"
  19. #include "generic.h"
  20. /*
  21. * The SG310 machine type is fitted with a conventional 8MB Strataflash
  22. * device. Define its partitioning.
  23. */
  24. #define FL_BASE 0x02000000
  25. #define FL_SIZE SZ_8M
  26. static struct mtd_partition sg_mtd_partitions[] = {
  27. [0] = {
  28. .name = "SnapGear Boot Loader",
  29. .size = SZ_128K,
  30. },
  31. [1] = {
  32. .name = "SnapGear non-volatile configuration",
  33. .size = SZ_512K,
  34. .offset = SZ_256K,
  35. },
  36. [2] = {
  37. .name = "SnapGear image",
  38. .offset = SZ_512K + SZ_256K,
  39. },
  40. [3] = {
  41. .name = "SnapGear StrataFlash",
  42. },
  43. [4] = {
  44. .name = "SnapGear Boot Tags",
  45. .size = SZ_128K,
  46. .offset = SZ_128K,
  47. },
  48. };
  49. static struct physmap_flash_data sg_mtd_pdata = {
  50. .width = 1,
  51. .nr_parts = ARRAY_SIZE(sg_mtd_partitions),
  52. .parts = sg_mtd_partitions,
  53. };
  54. static struct resource sg_mtd_resource[] = {
  55. [0] = {
  56. .start = FL_BASE,
  57. .end = FL_BASE + FL_SIZE - 1,
  58. .flags = IORESOURCE_MEM,
  59. },
  60. };
  61. static struct platform_device sg_mtd_device = {
  62. .name = "physmap-flash",
  63. .id = 0,
  64. .num_resources = ARRAY_SIZE(sg_mtd_resource),
  65. .resource = sg_mtd_resource,
  66. .dev = {
  67. .platform_data = &sg_mtd_pdata,
  68. },
  69. };
  70. static void __init sg_init(void)
  71. {
  72. ks8695_add_device_lan();
  73. ks8695_add_device_wan();
  74. if (machine_is_sg310())
  75. platform_device_register(&sg_mtd_device);
  76. }
  77. #ifdef CONFIG_MACH_LITE300
  78. MACHINE_START(LITE300, "SecureComputing/SG300")
  79. /* SnapGear */
  80. .atag_offset = 0x100,
  81. .map_io = ks8695_map_io,
  82. .init_irq = ks8695_init_irq,
  83. .init_machine = sg_init,
  84. .init_time = ks8695_timer_init,
  85. .restart = ks8695_restart,
  86. MACHINE_END
  87. #endif
  88. #ifdef CONFIG_MACH_SG310
  89. MACHINE_START(SG310, "McAfee/SG310")
  90. /* SnapGear */
  91. .atag_offset = 0x100,
  92. .map_io = ks8695_map_io,
  93. .init_irq = ks8695_init_irq,
  94. .init_machine = sg_init,
  95. .init_time = ks8695_timer_init,
  96. .restart = ks8695_restart,
  97. MACHINE_END
  98. #endif
  99. #ifdef CONFIG_MACH_SE4200
  100. MACHINE_START(SE4200, "SecureComputing/SE4200")
  101. /* SnapGear */
  102. .atag_offset = 0x100,
  103. .map_io = ks8695_map_io,
  104. .init_irq = ks8695_init_irq,
  105. .init_machine = sg_init,
  106. .init_time = ks8695_timer_init,
  107. .restart = ks8695_restart,
  108. MACHINE_END
  109. #endif