edb93xx.c 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. * arch/arm/mach-ep93xx/edb93xx.c
  3. * Cirrus Logic EDB93xx Development Board support.
  4. *
  5. * EDB93XX, EDB9301, EDB9307A
  6. * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com>
  7. *
  8. * EDB9302
  9. * Copyright (C) 2006 George Kashperko <george@chas.com.ua>
  10. *
  11. * EDB9302A, EDB9315, EDB9315A
  12. * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
  13. *
  14. * EDB9307
  15. * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
  16. *
  17. * EDB9312
  18. * Copyright (C) 2006 Infosys Technologies Limited
  19. * Toufeeq Hussain <toufeeq_hussain@infosys.com>
  20. *
  21. * This program is free software; you can redistribute it and/or modify
  22. * it under the terms of the GNU General Public License as published by
  23. * the Free Software Foundation; either version 2 of the License, or (at
  24. * your option) any later version.
  25. */
  26. #include <linux/kernel.h>
  27. #include <linux/init.h>
  28. #include <linux/platform_device.h>
  29. #include <linux/gpio.h>
  30. #include <linux/i2c.h>
  31. #include <linux/i2c-gpio.h>
  32. #include <mach/hardware.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. static void __init edb93xx_register_flash(void)
  36. {
  37. if (machine_is_edb9307() || machine_is_edb9312() ||
  38. machine_is_edb9315()) {
  39. ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
  40. } else {
  41. ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
  42. }
  43. }
  44. static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
  45. .phy_id = 1,
  46. };
  47. /*************************************************************************
  48. * EDB93xx i2c peripheral handling
  49. *************************************************************************/
  50. static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
  51. .sda_pin = EP93XX_GPIO_LINE_EEDAT,
  52. .sda_is_open_drain = 0,
  53. .scl_pin = EP93XX_GPIO_LINE_EECLK,
  54. .scl_is_open_drain = 0,
  55. .udelay = 0, /* default to 100 kHz */
  56. .timeout = 0, /* default to 100 ms */
  57. };
  58. static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
  59. {
  60. I2C_BOARD_INFO("isl1208", 0x6f),
  61. },
  62. };
  63. static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
  64. {
  65. I2C_BOARD_INFO("ds1337", 0x68),
  66. },
  67. };
  68. static void __init edb93xx_register_i2c(void)
  69. {
  70. if (machine_is_edb9302a() || machine_is_edb9307a() ||
  71. machine_is_edb9315a()) {
  72. ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
  73. edb93xxa_i2c_board_info,
  74. ARRAY_SIZE(edb93xxa_i2c_board_info));
  75. } else if (machine_is_edb9307() || machine_is_edb9312() ||
  76. machine_is_edb9315()) {
  77. ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
  78. edb93xx_i2c_board_info,
  79. ARRAY_SIZE(edb93xx_i2c_board_info));
  80. }
  81. }
  82. /*************************************************************************
  83. * EDB93xx pwm
  84. *************************************************************************/
  85. static void __init edb93xx_register_pwm(void)
  86. {
  87. if (machine_is_edb9301() ||
  88. machine_is_edb9302() || machine_is_edb9302a()) {
  89. /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
  90. ep93xx_register_pwm(0, 1);
  91. } else if (machine_is_edb9307() || machine_is_edb9307a()) {
  92. /* EP9307 only has pwm.0 (PWMOUT) */
  93. ep93xx_register_pwm(1, 0);
  94. } else {
  95. /* EP9312 and EP9315 have both */
  96. ep93xx_register_pwm(1, 1);
  97. }
  98. }
  99. static void __init edb93xx_init_machine(void)
  100. {
  101. ep93xx_init_devices();
  102. edb93xx_register_flash();
  103. ep93xx_register_eth(&edb93xx_eth_data, 1);
  104. edb93xx_register_i2c();
  105. edb93xx_register_pwm();
  106. }
  107. #ifdef CONFIG_MACH_EDB9301
  108. MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
  109. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  110. .phys_io = EP93XX_APB_PHYS_BASE,
  111. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  112. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  113. .map_io = ep93xx_map_io,
  114. .init_irq = ep93xx_init_irq,
  115. .timer = &ep93xx_timer,
  116. .init_machine = edb93xx_init_machine,
  117. MACHINE_END
  118. #endif
  119. #ifdef CONFIG_MACH_EDB9302
  120. MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
  121. /* Maintainer: George Kashperko <george@chas.com.ua> */
  122. .phys_io = EP93XX_APB_PHYS_BASE,
  123. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  124. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  125. .map_io = ep93xx_map_io,
  126. .init_irq = ep93xx_init_irq,
  127. .timer = &ep93xx_timer,
  128. .init_machine = edb93xx_init_machine,
  129. MACHINE_END
  130. #endif
  131. #ifdef CONFIG_MACH_EDB9302A
  132. MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
  133. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  134. .phys_io = EP93XX_APB_PHYS_BASE,
  135. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  136. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  137. .map_io = ep93xx_map_io,
  138. .init_irq = ep93xx_init_irq,
  139. .timer = &ep93xx_timer,
  140. .init_machine = edb93xx_init_machine,
  141. MACHINE_END
  142. #endif
  143. #ifdef CONFIG_MACH_EDB9307
  144. MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
  145. /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
  146. .phys_io = EP93XX_APB_PHYS_BASE,
  147. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  148. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  149. .map_io = ep93xx_map_io,
  150. .init_irq = ep93xx_init_irq,
  151. .timer = &ep93xx_timer,
  152. .init_machine = edb93xx_init_machine,
  153. MACHINE_END
  154. #endif
  155. #ifdef CONFIG_MACH_EDB9307A
  156. MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
  157. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  158. .phys_io = EP93XX_APB_PHYS_BASE,
  159. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  160. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  161. .map_io = ep93xx_map_io,
  162. .init_irq = ep93xx_init_irq,
  163. .timer = &ep93xx_timer,
  164. .init_machine = edb93xx_init_machine,
  165. MACHINE_END
  166. #endif
  167. #ifdef CONFIG_MACH_EDB9312
  168. MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
  169. /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
  170. .phys_io = EP93XX_APB_PHYS_BASE,
  171. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  172. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  173. .map_io = ep93xx_map_io,
  174. .init_irq = ep93xx_init_irq,
  175. .timer = &ep93xx_timer,
  176. .init_machine = edb93xx_init_machine,
  177. MACHINE_END
  178. #endif
  179. #ifdef CONFIG_MACH_EDB9315
  180. MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
  181. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  182. .phys_io = EP93XX_APB_PHYS_BASE,
  183. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  184. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  185. .map_io = ep93xx_map_io,
  186. .init_irq = ep93xx_init_irq,
  187. .timer = &ep93xx_timer,
  188. .init_machine = edb93xx_init_machine,
  189. MACHINE_END
  190. #endif
  191. #ifdef CONFIG_MACH_EDB9315A
  192. MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
  193. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  194. .phys_io = EP93XX_APB_PHYS_BASE,
  195. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  196. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  197. .map_io = ep93xx_map_io,
  198. .init_irq = ep93xx_init_irq,
  199. .timer = &ep93xx_timer,
  200. .init_machine = edb93xx_init_machine,
  201. MACHINE_END
  202. #endif