board-sh2007.c 3.2 KB

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