board-sh2007.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * SH-2007 board support.
  3. *
  4. * Copyright (C) 2003, 2004 SUGIOKA Toshinobu
  5. * Copyright (C) 2010 Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
  6. */
  7. #include <linux/init.h>
  8. #include <linux/irq.h>
  9. #include <linux/regulator/fixed.h>
  10. #include <linux/regulator/machine.h>
  11. #include <linux/smsc911x.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/ata_platform.h>
  14. #include <linux/io.h>
  15. #include <asm/machvec.h>
  16. #include <mach/sh2007.h>
  17. /* Dummy supplies, where voltage doesn't matter */
  18. static struct regulator_consumer_supply dummy_supplies[] = {
  19. REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
  20. REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
  21. REGULATOR_SUPPLY("vddvario", "smsc911x.1"),
  22. REGULATOR_SUPPLY("vdd33a", "smsc911x.1"),
  23. };
  24. struct smsc911x_platform_config smc911x_info = {
  25. .flags = SMSC911X_USE_32BIT,
  26. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  27. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  28. };
  29. static struct resource smsc9118_0_resources[] = {
  30. [0] = {
  31. .start = SMC0_BASE,
  32. .end = SMC0_BASE + 0xff,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. [1] = {
  36. .start = evt2irq(0x240),
  37. .end = evt2irq(0x240),
  38. .flags = IORESOURCE_IRQ,
  39. }
  40. };
  41. static struct resource smsc9118_1_resources[] = {
  42. [0] = {
  43. .start = SMC1_BASE,
  44. .end = SMC1_BASE + 0xff,
  45. .flags = IORESOURCE_MEM,
  46. },
  47. [1] = {
  48. .start = evt2irq(0x280),
  49. .end = evt2irq(0x280),
  50. .flags = IORESOURCE_IRQ,
  51. }
  52. };
  53. static struct platform_device smsc9118_0_device = {
  54. .name = "smsc911x",
  55. .id = 0,
  56. .num_resources = ARRAY_SIZE(smsc9118_0_resources),
  57. .resource = smsc9118_0_resources,
  58. .dev = {
  59. .platform_data = &smc911x_info,
  60. },
  61. };
  62. static struct platform_device smsc9118_1_device = {
  63. .name = "smsc911x",
  64. .id = 1,
  65. .num_resources = ARRAY_SIZE(smsc9118_1_resources),
  66. .resource = smsc9118_1_resources,
  67. .dev = {
  68. .platform_data = &smc911x_info,
  69. },
  70. };
  71. static struct resource cf_resources[] = {
  72. [0] = {
  73. .start = CF_BASE + CF_OFFSET,
  74. .end = CF_BASE + CF_OFFSET + 0x0f,
  75. .flags = IORESOURCE_MEM,
  76. },
  77. [1] = {
  78. .start = CF_BASE + CF_OFFSET + 0x206,
  79. .end = CF_BASE + CF_OFFSET + 0x20f,
  80. .flags = IORESOURCE_MEM,
  81. },
  82. [2] = {
  83. .start = evt2irq(0x2c0),
  84. .end = evt2irq(0x2c0),
  85. .flags = IORESOURCE_IRQ,
  86. },
  87. };
  88. static struct platform_device cf_device = {
  89. .name = "pata_platform",
  90. .id = 0,
  91. .num_resources = ARRAY_SIZE(cf_resources),
  92. .resource = cf_resources,
  93. };
  94. static struct platform_device *sh2007_devices[] __initdata = {
  95. &smsc9118_0_device,
  96. &smsc9118_1_device,
  97. &cf_device,
  98. };
  99. static int __init sh2007_io_init(void)
  100. {
  101. regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  102. platform_add_devices(sh2007_devices, ARRAY_SIZE(sh2007_devices));
  103. return 0;
  104. }
  105. subsys_initcall(sh2007_io_init);
  106. static void __init sh2007_init_irq(void)
  107. {
  108. plat_irq_setup_pins(IRQ_MODE_IRQ);
  109. }
  110. /*
  111. * Initialize the board
  112. */
  113. static void __init sh2007_setup(char **cmdline_p)
  114. {
  115. printk(KERN_INFO "SH-2007 Setup...");
  116. /* setup wait control registers for area 5 */
  117. __raw_writel(CS5BCR_D, CS5BCR);
  118. __raw_writel(CS5WCR_D, CS5WCR);
  119. __raw_writel(CS5PCR_D, CS5PCR);
  120. printk(KERN_INFO " done.\n");
  121. }
  122. /*
  123. * The Machine Vector
  124. */
  125. struct sh_machine_vector mv_sh2007 __initmv = {
  126. .mv_setup = sh2007_setup,
  127. .mv_name = "sh2007",
  128. .mv_init_irq = sh2007_init_irq,
  129. };