setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Renesas - AP-325RXA
  3. * (Compatible with Algo System ., LTD. - AP-320A)
  4. *
  5. * Copyright (C) 2008 Renesas Solutions Corp.
  6. * Author : Yusuke Goda <goda.yuske@renesas.com>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/device.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/delay.h>
  17. #include <asm/io.h>
  18. static struct resource smc9118_resources[] = {
  19. [0] = {
  20. .start = 0xb6080000,
  21. .end = 0xb60fffff,
  22. .flags = IORESOURCE_MEM,
  23. },
  24. [1] = {
  25. .start = 35,
  26. .end = 35,
  27. .flags = IORESOURCE_IRQ,
  28. }
  29. };
  30. static struct platform_device smc9118_device = {
  31. .name = "smc911x",
  32. .id = -1,
  33. .num_resources = ARRAY_SIZE(smc9118_resources),
  34. .resource = smc9118_resources,
  35. };
  36. static struct mtd_partition ap325rxa_nor_flash_partitions[] = {
  37. {
  38. .name = "uboot",
  39. .offset = 0,
  40. .size = (1 * 1024 * 1024),
  41. .mask_flags = MTD_WRITEABLE, /* Read-only */
  42. }, {
  43. .name = "kernel",
  44. .offset = MTDPART_OFS_APPEND,
  45. .size = (2 * 1024 * 1024),
  46. }, {
  47. .name = "other",
  48. .offset = MTDPART_OFS_APPEND,
  49. .size = MTDPART_SIZ_FULL,
  50. },
  51. };
  52. static struct physmap_flash_data ap325rxa_nor_flash_data = {
  53. .width = 2,
  54. .parts = ap325rxa_nor_flash_partitions,
  55. .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions),
  56. };
  57. static struct resource ap325rxa_nor_flash_resources[] = {
  58. [0] = {
  59. .name = "NOR Flash",
  60. .start = 0x00000000,
  61. .end = 0x00ffffff,
  62. .flags = IORESOURCE_MEM,
  63. }
  64. };
  65. static struct platform_device ap325rxa_nor_flash_device = {
  66. .name = "physmap-flash",
  67. .resource = ap325rxa_nor_flash_resources,
  68. .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources),
  69. .dev = {
  70. .platform_data = &ap325rxa_nor_flash_data,
  71. },
  72. };
  73. static struct platform_device *ap325rxa_devices[] __initdata = {
  74. &smc9118_device,
  75. &ap325rxa_nor_flash_device
  76. };
  77. static int __init ap325rxa_devices_setup(void)
  78. {
  79. return platform_add_devices(ap325rxa_devices,
  80. ARRAY_SIZE(ap325rxa_devices));
  81. }
  82. device_initcall(ap325rxa_devices_setup);
  83. #define MSTPCR0 (0xA4150030)
  84. #define MSTPCR2 (0xA4150038)
  85. static void __init ap325rxa_setup(char **cmdline_p)
  86. {
  87. /* enable VEU0 + VEU1 */
  88. ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00000044, MSTPCR2); /* bit 2 + 6 */
  89. /* enable MERAM */
  90. ctrl_outl(ctrl_inl(MSTPCR0) & ~0x00000001, MSTPCR0); /* bit 0 */
  91. }
  92. static struct sh_machine_vector mv_ap325rxa __initmv = {
  93. .mv_name = "AP-325RXA",
  94. .mv_setup = ap325rxa_setup,
  95. };