board-ap4evb.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * AP4EVB board support
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/delay.h>
  26. #include <linux/mtd/mtd.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/physmap.h>
  29. #include <linux/io.h>
  30. #include <mach/common.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/map.h>
  34. static struct mtd_partition nor_flash_partitions[] = {
  35. {
  36. .name = "loader",
  37. .offset = 0x00000000,
  38. .size = 512 * 1024,
  39. },
  40. {
  41. .name = "bootenv",
  42. .offset = MTDPART_OFS_APPEND,
  43. .size = 512 * 1024,
  44. },
  45. {
  46. .name = "kernel_ro",
  47. .offset = MTDPART_OFS_APPEND,
  48. .size = 8 * 1024 * 1024,
  49. .mask_flags = MTD_WRITEABLE,
  50. },
  51. {
  52. .name = "kernel",
  53. .offset = MTDPART_OFS_APPEND,
  54. .size = 8 * 1024 * 1024,
  55. },
  56. {
  57. .name = "data",
  58. .offset = MTDPART_OFS_APPEND,
  59. .size = MTDPART_SIZ_FULL,
  60. },
  61. };
  62. static struct physmap_flash_data nor_flash_data = {
  63. .width = 2,
  64. .parts = nor_flash_partitions,
  65. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  66. };
  67. static struct resource nor_flash_resources[] = {
  68. [0] = {
  69. .start = 0x00000000,
  70. .end = 0x08000000 - 1,
  71. .flags = IORESOURCE_MEM,
  72. }
  73. };
  74. static struct platform_device nor_flash_device = {
  75. .name = "physmap-flash",
  76. .dev = {
  77. .platform_data = &nor_flash_data,
  78. },
  79. .num_resources = ARRAY_SIZE(nor_flash_resources),
  80. .resource = nor_flash_resources,
  81. };
  82. static struct platform_device *ap4evb_devices[] __initdata = {
  83. &nor_flash_device,
  84. };
  85. static struct map_desc ap4evb_io_desc[] __initdata = {
  86. /* create a 1:1 entity map for 0xe6xxxxxx
  87. * used by CPGA, INTC and PFC.
  88. */
  89. {
  90. .virtual = 0xe6000000,
  91. .pfn = __phys_to_pfn(0xe6000000),
  92. .length = 256 << 20,
  93. .type = MT_DEVICE_NONSHARED
  94. },
  95. };
  96. static void __init ap4evb_map_io(void)
  97. {
  98. iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
  99. /* setup early devices and clocks here as well */
  100. sh7372_add_early_devices();
  101. sh7367_clock_init(); /* use g3 clocks for now */
  102. }
  103. static void __init ap4evb_init(void)
  104. {
  105. sh7372_add_standard_devices();
  106. platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
  107. }
  108. MACHINE_START(AP4EVB, "ap4evb")
  109. .phys_io = 0xe6000000,
  110. .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
  111. .map_io = ap4evb_map_io,
  112. .init_irq = sh7372_init_irq,
  113. .init_machine = ap4evb_init,
  114. .timer = &shmobile_timer,
  115. MACHINE_END