board-edosk7760.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Renesas Europe EDOSK7760 Board Support
  3. *
  4. * Copyright (C) 2008 SPES Societa' Progettazione Elettronica e Software Ltd.
  5. * Author: Luca Santini <luca.santini@spesonline.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <linux/init.h>
  22. #include <linux/types.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/smc91x.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/i2c.h>
  27. #include <asm/machvec.h>
  28. #include <asm/io.h>
  29. #include <asm/addrspace.h>
  30. #include <asm/delay.h>
  31. #include <asm/i2c-sh7760.h>
  32. /* Bus state controller registers for CS4 area */
  33. #define BSC_CS4BCR 0xA4FD0010
  34. #define BSC_CS4WCR 0xA4FD0030
  35. #define SMC_IOBASE 0xA2000000
  36. #define SMC_IO_OFFSET 0x300
  37. #define SMC_IOADDR (SMC_IOBASE + SMC_IO_OFFSET)
  38. #define ETHERNET_IRQ 5
  39. /* i2c initialization functions */
  40. static struct sh7760_i2c_platdata i2c_pd = {
  41. .speed_khz = 400,
  42. };
  43. static struct resource sh7760_i2c1_res[] = {
  44. {
  45. .start = SH7760_I2C1_MMIO,
  46. .end = SH7760_I2C1_MMIOEND,
  47. .flags = IORESOURCE_MEM,
  48. },{
  49. .start = SH7760_I2C1_IRQ,
  50. .end = SH7760_I2C1_IRQ,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. static struct platform_device sh7760_i2c1_dev = {
  55. .dev = {
  56. .platform_data = &i2c_pd,
  57. },
  58. .name = SH7760_I2C_DEVNAME,
  59. .id = 1,
  60. .resource = sh7760_i2c1_res,
  61. .num_resources = ARRAY_SIZE(sh7760_i2c1_res),
  62. };
  63. static struct resource sh7760_i2c0_res[] = {
  64. {
  65. .start = SH7760_I2C0_MMIO,
  66. .end = SH7760_I2C0_MMIOEND,
  67. .flags = IORESOURCE_MEM,
  68. }, {
  69. .start = SH7760_I2C0_IRQ,
  70. .end = SH7760_I2C0_IRQ,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct platform_device sh7760_i2c0_dev = {
  75. .dev = {
  76. .platform_data = &i2c_pd,
  77. },
  78. .name = SH7760_I2C_DEVNAME,
  79. .id = 0,
  80. .resource = sh7760_i2c0_res,
  81. .num_resources = ARRAY_SIZE(sh7760_i2c0_res),
  82. };
  83. /* eth initialization functions */
  84. static struct smc91x_platdata smc91x_info = {
  85. .flags = SMC91X_USE_16BIT | SMC91X_IO_SHIFT_1 | IORESOURCE_IRQ_LOWLEVEL,
  86. };
  87. static struct resource smc91x_res[] = {
  88. [0] = {
  89. .start = SMC_IOADDR,
  90. .end = SMC_IOADDR + 0x1f,
  91. .flags = IORESOURCE_MEM,
  92. },
  93. [1] = {
  94. .start = ETHERNET_IRQ,
  95. .end = ETHERNET_IRQ,
  96. .flags = IORESOURCE_IRQ ,
  97. }
  98. };
  99. static struct platform_device smc91x_dev = {
  100. .name = "smc91x",
  101. .id = -1,
  102. .num_resources = ARRAY_SIZE(smc91x_res),
  103. .resource = smc91x_res,
  104. .dev = {
  105. .platform_data = &smc91x_info,
  106. },
  107. };
  108. /* platform init code */
  109. static struct platform_device *edosk7760_devices[] __initdata = {
  110. &sh7760_i2c0_dev,
  111. &sh7760_i2c1_dev,
  112. &smc91x_dev,
  113. };
  114. static int __init init_edosk7760_devices(void)
  115. {
  116. plat_irq_setup_pins(IRQ_MODE_IRQ);
  117. return platform_add_devices(edosk7760_devices,
  118. ARRAY_SIZE(edosk7760_devices));
  119. }
  120. __initcall(init_edosk7760_devices);
  121. /*
  122. * The Machine Vector
  123. */
  124. struct sh_machine_vector mv_edosk7760 __initmv = {
  125. .mv_name = "EDOSK7760",
  126. .mv_nr_irqs = 128,
  127. };