setup-sh7206.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * SH7206 Setup
  3. *
  4. * Copyright (C) 2006 Yoshinori Sato
  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 <asm/sci.h>
  14. static struct plat_sci_port sci_platform_data[] = {
  15. {
  16. .mapbase = 0xfffe8000,
  17. .flags = UPF_BOOT_AUTOCONF,
  18. .type = PORT_SCIF,
  19. .irqs = { 241, 242, 243, 240},
  20. }, {
  21. .mapbase = 0xfffe8800,
  22. .flags = UPF_BOOT_AUTOCONF,
  23. .type = PORT_SCIF,
  24. .irqs = { 247, 244, 245, 246},
  25. }, {
  26. .mapbase = 0xfffe9000,
  27. .flags = UPF_BOOT_AUTOCONF,
  28. .type = PORT_SCIF,
  29. .irqs = { 249, 250, 251, 248},
  30. }, {
  31. .mapbase = 0xfffe9800,
  32. .flags = UPF_BOOT_AUTOCONF,
  33. .type = PORT_SCIF,
  34. .irqs = { 253, 254, 255, 252},
  35. }, {
  36. .flags = 0,
  37. }
  38. };
  39. static struct platform_device sci_device = {
  40. .name = "sh-sci",
  41. .id = -1,
  42. .dev = {
  43. .platform_data = sci_platform_data,
  44. },
  45. };
  46. static struct platform_device *sh7206_devices[] __initdata = {
  47. &sci_device,
  48. };
  49. static int __init sh7206_devices_setup(void)
  50. {
  51. return platform_add_devices(sh7206_devices,
  52. ARRAY_SIZE(sh7206_devices));
  53. }
  54. __initcall(sh7206_devices_setup);
  55. static struct ipr_data sh7206_ipr_map[] = {
  56. { 140, 7, 12, 2 }, /* CMI0 */
  57. { 164, 8, 4, 2 }, /* MTU2_TGI1A */
  58. { 240, 13, 12, 3 }, /* SCIF0_BRI */
  59. { 241, 13, 12, 3 }, /* SCIF0_ERI */
  60. { 242, 13, 12, 3 }, /* SCIF0_RXI */
  61. { 243, 13, 12, 3 }, /* SCIF0_TXI */
  62. { 244, 13, 8, 3 }, /* SCIF1_BRI */
  63. { 245, 13, 8, 3 }, /* SCIF1_ERI */
  64. { 246, 13, 8, 3 }, /* SCIF1_RXI */
  65. { 247, 13, 8, 3 }, /* SCIF1_TXI */
  66. { 248, 13, 4, 3 }, /* SCIF2_BRI */
  67. { 249, 13, 4, 3 }, /* SCIF2_ERI */
  68. { 250, 13, 4, 3 }, /* SCIF2_RXI */
  69. { 251, 13, 4, 3 }, /* SCIF2_TXI */
  70. { 252, 13, 0, 3 }, /* SCIF3_BRI */
  71. { 253, 13, 0, 3 }, /* SCIF3_ERI */
  72. { 254, 13, 0, 3 }, /* SCIF3_RXI */
  73. { 255, 13, 0, 3 }, /* SCIF3_TXI */
  74. };
  75. static unsigned int ipr_offsets[] = {
  76. 0xfffe0818, /* IPR01 */
  77. 0xfffe081a, /* IPR02 */
  78. 0, /* unused */
  79. 0, /* unused */
  80. 0xfffe0820, /* IPR05 */
  81. 0xfffe0c00, /* IPR06 */
  82. 0xfffe0c02, /* IPR07 */
  83. 0xfffe0c04, /* IPR08 */
  84. 0xfffe0c06, /* IPR09 */
  85. 0xfffe0c08, /* IPR10 */
  86. 0xfffe0c0a, /* IPR11 */
  87. 0xfffe0c0c, /* IPR12 */
  88. 0xfffe0c0e, /* IPR13 */
  89. 0xfffe0c10, /* IPR14 */
  90. };
  91. /* given the IPR index return the address of the IPR register */
  92. unsigned int map_ipridx_to_addr(int idx)
  93. {
  94. if (unlikely(idx >= ARRAY_SIZE(ipr_offsets)))
  95. return 0;
  96. return ipr_offsets[idx];
  97. }
  98. void __init init_IRQ_ipr(void)
  99. {
  100. make_ipr_irq(sh7206_ipr_map, ARRAY_SIZE(sh7206_ipr_map));
  101. }