setup-sh5.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * SH5-101/SH5-103 CPU Setup
  3. *
  4. * Copyright (C) 2009 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/serial.h>
  13. #include <linux/serial_sci.h>
  14. #include <linux/io.h>
  15. #include <linux/mm.h>
  16. #include <linux/sh_timer.h>
  17. #include <asm/addrspace.h>
  18. static struct plat_sci_port scif0_platform_data = {
  19. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
  20. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  21. .type = PORT_SCIF,
  22. };
  23. static struct resource scif0_resources[] = {
  24. DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
  25. DEFINE_RES_IRQ(39),
  26. DEFINE_RES_IRQ(40),
  27. DEFINE_RES_IRQ(42),
  28. };
  29. static struct platform_device scif0_device = {
  30. .name = "sh-sci",
  31. .id = 0,
  32. .resource = scif0_resources,
  33. .num_resources = ARRAY_SIZE(scif0_resources),
  34. .dev = {
  35. .platform_data = &scif0_platform_data,
  36. },
  37. };
  38. static struct resource rtc_resources[] = {
  39. [0] = {
  40. .start = PHYS_PERIPHERAL_BLOCK + 0x01040000,
  41. .end = PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
  42. .flags = IORESOURCE_IO,
  43. },
  44. [1] = {
  45. /* Period IRQ */
  46. .start = IRQ_PRI,
  47. .flags = IORESOURCE_IRQ,
  48. },
  49. [2] = {
  50. /* Carry IRQ */
  51. .start = IRQ_CUI,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. [3] = {
  55. /* Alarm IRQ */
  56. .start = IRQ_ATI,
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. static struct platform_device rtc_device = {
  61. .name = "sh-rtc",
  62. .id = -1,
  63. .num_resources = ARRAY_SIZE(rtc_resources),
  64. .resource = rtc_resources,
  65. };
  66. #define TMU_BLOCK_OFF 0x01020000
  67. #define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
  68. static struct sh_timer_config tmu0_platform_data = {
  69. .channels_mask = 7,
  70. };
  71. static struct resource tmu0_resources[] = {
  72. DEFINE_RES_MEM(TMU_BASE, 0x30),
  73. DEFINE_RES_IRQ(IRQ_TUNI0),
  74. DEFINE_RES_IRQ(IRQ_TUNI1),
  75. DEFINE_RES_IRQ(IRQ_TUNI2),
  76. };
  77. static struct platform_device tmu0_device = {
  78. .name = "sh-tmu",
  79. .id = 0,
  80. .dev = {
  81. .platform_data = &tmu0_platform_data,
  82. },
  83. .resource = tmu0_resources,
  84. .num_resources = ARRAY_SIZE(tmu0_resources),
  85. };
  86. static struct platform_device *sh5_early_devices[] __initdata = {
  87. &scif0_device,
  88. &tmu0_device,
  89. };
  90. static struct platform_device *sh5_devices[] __initdata = {
  91. &rtc_device,
  92. };
  93. static int __init sh5_devices_setup(void)
  94. {
  95. int ret;
  96. ret = platform_add_devices(sh5_early_devices,
  97. ARRAY_SIZE(sh5_early_devices));
  98. if (unlikely(ret != 0))
  99. return ret;
  100. return platform_add_devices(sh5_devices,
  101. ARRAY_SIZE(sh5_devices));
  102. }
  103. arch_initcall(sh5_devices_setup);
  104. void __init plat_early_device_setup(void)
  105. {
  106. early_platform_add_devices(sh5_early_devices,
  107. ARRAY_SIZE(sh5_early_devices));
  108. }