board-polaris.c 3.5 KB

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