board-sh2007.c 2.7 KB

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