setup-sh7750.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * SH7750/SH7751 Setup
  3. *
  4. * Copyright (C) 2006 Paul Mundt
  5. * Copyright (C) 2006 Jamie Lenehan
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <linux/init.h>
  13. #include <linux/serial.h>
  14. #include <linux/io.h>
  15. #include <asm/sci.h>
  16. static struct plat_sci_port sci_platform_data[] = {
  17. {
  18. .mapbase = 0xffe00000,
  19. .flags = UPF_BOOT_AUTOCONF,
  20. .type = PORT_SCI,
  21. .irqs = { 23, 24, 25, 0 },
  22. }, {
  23. .mapbase = 0xffe80000,
  24. .flags = UPF_BOOT_AUTOCONF,
  25. .type = PORT_SCIF,
  26. .irqs = { 40, 41, 43, 42 },
  27. }, {
  28. .flags = 0,
  29. }
  30. };
  31. static struct platform_device sci_device = {
  32. .name = "sh-sci",
  33. .id = -1,
  34. .dev = {
  35. .platform_data = sci_platform_data,
  36. },
  37. };
  38. static struct platform_device *sh7750_devices[] __initdata = {
  39. &sci_device,
  40. };
  41. static int __init sh7750_devices_setup(void)
  42. {
  43. return platform_add_devices(sh7750_devices,
  44. ARRAY_SIZE(sh7750_devices));
  45. }
  46. __initcall(sh7750_devices_setup);
  47. static struct ipr_data sh7750_ipr_map[] = {
  48. /* IRQ, IPR-idx, shift, priority */
  49. { 16, 0, 12, 2 }, /* TMU0 TUNI*/
  50. { 17, 0, 12, 2 }, /* TMU1 TUNI */
  51. { 18, 0, 4, 2 }, /* TMU2 TUNI */
  52. { 19, 0, 4, 2 }, /* TMU2 TIPCI */
  53. { 27, 1, 12, 2 }, /* WDT ITI */
  54. { 20, 0, 0, 2 }, /* RTC ATI (alarm) */
  55. { 21, 0, 0, 2 }, /* RTC PRI (period) */
  56. { 22, 0, 0, 2 }, /* RTC CUI (carry) */
  57. { 23, 1, 4, 3 }, /* SCI ERI */
  58. { 24, 1, 4, 3 }, /* SCI RXI */
  59. { 25, 1, 4, 3 }, /* SCI TXI */
  60. { 40, 2, 4, 3 }, /* SCIF ERI */
  61. { 41, 2, 4, 3 }, /* SCIF RXI */
  62. { 42, 2, 4, 3 }, /* SCIF BRI */
  63. { 43, 2, 4, 3 }, /* SCIF TXI */
  64. { 34, 2, 8, 7 }, /* DMAC DMTE0 */
  65. { 35, 2, 8, 7 }, /* DMAC DMTE1 */
  66. { 36, 2, 8, 7 }, /* DMAC DMTE2 */
  67. { 37, 2, 8, 7 }, /* DMAC DMTE3 */
  68. { 28, 2, 8, 7 }, /* DMAC DMAE */
  69. };
  70. static struct ipr_data sh7751_ipr_map[] = {
  71. { 44, 2, 8, 7 }, /* DMAC DMTE4 */
  72. { 45, 2, 8, 7 }, /* DMAC DMTE5 */
  73. { 46, 2, 8, 7 }, /* DMAC DMTE6 */
  74. { 47, 2, 8, 7 }, /* DMAC DMTE7 */
  75. /* The following use INTC_INPRI00 for masking, which is a 32-bit
  76. register, not a 16-bit register like the IPRx registers, so it
  77. would need special support */
  78. /*{ 72, INTPRI00, 8, ? },*/ /* TMU3 TUNI */
  79. /*{ 76, INTPRI00, 12, ? },*/ /* TMU4 TUNI */
  80. };
  81. static unsigned long ipr_offsets[] = {
  82. 0xffd00004UL, /* 0: IPRA */
  83. 0xffd00008UL, /* 1: IPRB */
  84. 0xffd0000cUL, /* 2: IPRC */
  85. 0xffd00010UL, /* 3: IPRD */
  86. };
  87. /* given the IPR index return the address of the IPR register */
  88. unsigned int map_ipridx_to_addr(int idx)
  89. {
  90. if (idx >= ARRAY_SIZE(ipr_offsets))
  91. return 0;
  92. return ipr_offsets[idx];
  93. }
  94. #define INTC_ICR 0xffd00000UL
  95. #define INTC_ICR_IRLM (1<<7)
  96. /* enable individual interrupt mode for external interupts */
  97. void ipr_irq_enable_irlm(void)
  98. {
  99. ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
  100. }
  101. void __init init_IRQ_ipr()
  102. {
  103. make_ipr_irq(sh7750_ipr_map, ARRAY_SIZE(sh7750_ipr_map));
  104. #ifdef CONFIG_CPU_SUBTYPE_SH7751
  105. make_ipr_irq(sh7751_ipr_map, ARRAY_SIZE(sh7751_ipr_map));
  106. #endif
  107. }