board-polaris.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * June 2006 steve.glendinning@smsc.com
  3. *
  4. * Polaris-specific resource declaration
  5. *
  6. */
  7. #include <linux/init.h>
  8. #include <linux/interrupt.h>
  9. #include <linux/irq.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/smsc911x.h>
  12. #include <linux/io.h>
  13. #include <asm/irq.h>
  14. #include <asm/machvec.h>
  15. #include <asm/heartbeat.h>
  16. #include <cpu/gpio.h>
  17. #include <mach-se/mach/se.h>
  18. #define BCR2 (0xFFFFFF62)
  19. #define WCR2 (0xFFFFFF66)
  20. #define AREA5_WAIT_CTRL (0x1C00)
  21. #define WAIT_STATES_10 (0x7)
  22. static struct resource smsc911x_resources[] = {
  23. [0] = {
  24. .name = "smsc911x-memory",
  25. .start = PA_EXT5,
  26. .end = PA_EXT5 + 0x1fff,
  27. .flags = IORESOURCE_MEM,
  28. },
  29. [1] = {
  30. .name = "smsc911x-irq",
  31. .start = IRQ0_IRQ,
  32. .end = IRQ0_IRQ,
  33. .flags = IORESOURCE_IRQ,
  34. },
  35. };
  36. static struct smsc911x_platform_config smsc911x_config = {
  37. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  38. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  39. .flags = SMSC911X_USE_32BIT,
  40. .phy_interface = PHY_INTERFACE_MODE_MII,
  41. };
  42. static struct platform_device smsc911x_device = {
  43. .name = "smsc911x",
  44. .id = 0,
  45. .num_resources = ARRAY_SIZE(smsc911x_resources),
  46. .resource = smsc911x_resources,
  47. .dev = {
  48. .platform_data = &smsc911x_config,
  49. },
  50. };
  51. static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 };
  52. static struct heartbeat_data heartbeat_data = {
  53. .bit_pos = heartbeat_bit_pos,
  54. .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
  55. .regsize = 8,
  56. };
  57. static struct resource heartbeat_resources[] = {
  58. [0] = {
  59. .start = PORT_PCDR,
  60. .end = PORT_PCDR,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. };
  64. static struct platform_device heartbeat_device = {
  65. .name = "heartbeat",
  66. .id = -1,
  67. .dev = {
  68. .platform_data = &heartbeat_data,
  69. },
  70. .num_resources = ARRAY_SIZE(heartbeat_resources),
  71. .resource = heartbeat_resources,
  72. };
  73. static struct platform_device *polaris_devices[] __initdata = {
  74. &smsc911x_device,
  75. &heartbeat_device,
  76. };
  77. static int __init polaris_initialise(void)
  78. {
  79. u16 wcr, bcr_mask;
  80. printk(KERN_INFO "Configuring Polaris external bus\n");
  81. /* Configure area 5 with 2 wait states */
  82. wcr = ctrl_inw(WCR2);
  83. wcr &= (~AREA5_WAIT_CTRL);
  84. wcr |= (WAIT_STATES_10 << 10);
  85. ctrl_outw(wcr, WCR2);
  86. /* Configure area 5 for 32-bit access */
  87. bcr_mask = ctrl_inw(BCR2);
  88. bcr_mask |= 1 << 10;
  89. ctrl_outw(bcr_mask, BCR2);
  90. return platform_add_devices(polaris_devices,
  91. ARRAY_SIZE(polaris_devices));
  92. }
  93. arch_initcall(polaris_initialise);
  94. static struct ipr_data ipr_irq_table[] = {
  95. /* External IRQs */
  96. { IRQ0_IRQ, 0, 0, 1, }, /* IRQ0 */
  97. { IRQ1_IRQ, 0, 4, 1, }, /* IRQ1 */
  98. };
  99. static unsigned long ipr_offsets[] = {
  100. INTC_IPRC
  101. };
  102. static struct ipr_desc ipr_irq_desc = {
  103. .ipr_offsets = ipr_offsets,
  104. .nr_offsets = ARRAY_SIZE(ipr_offsets),
  105. .ipr_data = ipr_irq_table,
  106. .nr_irqs = ARRAY_SIZE(ipr_irq_table),
  107. .chip = {
  108. .name = "sh7709-ext",
  109. },
  110. };
  111. static void __init init_polaris_irq(void)
  112. {
  113. /* Disable all interrupts */
  114. ctrl_outw(0, BCR_ILCRA);
  115. ctrl_outw(0, BCR_ILCRB);
  116. ctrl_outw(0, BCR_ILCRC);
  117. ctrl_outw(0, BCR_ILCRD);
  118. ctrl_outw(0, BCR_ILCRE);
  119. ctrl_outw(0, BCR_ILCRF);
  120. ctrl_outw(0, BCR_ILCRG);
  121. register_ipr_controller(&ipr_irq_desc);
  122. }
  123. static struct sh_machine_vector mv_polaris __initmv = {
  124. .mv_name = "Polaris",
  125. .mv_nr_irqs = 61,
  126. .mv_init_irq = init_polaris_irq,
  127. };