edb93xx.c 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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 <mach/fb.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/arch.h>
  36. static void __init edb93xx_register_flash(void)
  37. {
  38. if (machine_is_edb9307() || machine_is_edb9312() ||
  39. machine_is_edb9315()) {
  40. ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
  41. } else {
  42. ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
  43. }
  44. }
  45. static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
  46. .phy_id = 1,
  47. };
  48. /*************************************************************************
  49. * EDB93xx i2c peripheral handling
  50. *************************************************************************/
  51. static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
  52. .sda_pin = EP93XX_GPIO_LINE_EEDAT,
  53. .sda_is_open_drain = 0,
  54. .scl_pin = EP93XX_GPIO_LINE_EECLK,
  55. .scl_is_open_drain = 0,
  56. .udelay = 0, /* default to 100 kHz */
  57. .timeout = 0, /* default to 100 ms */
  58. };
  59. static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
  60. {
  61. I2C_BOARD_INFO("isl1208", 0x6f),
  62. },
  63. };
  64. static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
  65. {
  66. I2C_BOARD_INFO("ds1337", 0x68),
  67. },
  68. };
  69. static void __init edb93xx_register_i2c(void)
  70. {
  71. if (machine_is_edb9302a() || machine_is_edb9307a() ||
  72. machine_is_edb9315a()) {
  73. ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
  74. edb93xxa_i2c_board_info,
  75. ARRAY_SIZE(edb93xxa_i2c_board_info));
  76. } else if (machine_is_edb9307() || machine_is_edb9312() ||
  77. machine_is_edb9315()) {
  78. ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
  79. edb93xx_i2c_board_info,
  80. ARRAY_SIZE(edb93xx_i2c_board_info));
  81. }
  82. }
  83. /*************************************************************************
  84. * EDB93xx pwm
  85. *************************************************************************/
  86. static void __init edb93xx_register_pwm(void)
  87. {
  88. if (machine_is_edb9301() ||
  89. machine_is_edb9302() || machine_is_edb9302a()) {
  90. /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
  91. ep93xx_register_pwm(0, 1);
  92. } else if (machine_is_edb9307() || machine_is_edb9307a()) {
  93. /* EP9307 only has pwm.0 (PWMOUT) */
  94. ep93xx_register_pwm(1, 0);
  95. } else {
  96. /* EP9312 and EP9315 have both */
  97. ep93xx_register_pwm(1, 1);
  98. }
  99. }
  100. /*************************************************************************
  101. * EDB93xx framebuffer
  102. *************************************************************************/
  103. static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
  104. .num_modes = EP93XXFB_USE_MODEDB,
  105. .bpp = 16,
  106. .flags = 0,
  107. };
  108. static int __init edb93xx_has_fb(void)
  109. {
  110. /* These platforms have an ep93xx with video capability */
  111. return machine_is_edb9307() || machine_is_edb9307a() ||
  112. machine_is_edb9312() || machine_is_edb9315() ||
  113. machine_is_edb9315a();
  114. }
  115. static void __init edb93xx_register_fb(void)
  116. {
  117. if (!edb93xx_has_fb())
  118. return;
  119. if (machine_is_edb9307a() || machine_is_edb9315a())
  120. edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
  121. else
  122. edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
  123. ep93xx_register_fb(&edb93xxfb_info);
  124. }
  125. static void __init edb93xx_init_machine(void)
  126. {
  127. ep93xx_init_devices();
  128. edb93xx_register_flash();
  129. ep93xx_register_eth(&edb93xx_eth_data, 1);
  130. edb93xx_register_i2c();
  131. edb93xx_register_pwm();
  132. edb93xx_register_fb();
  133. }
  134. #ifdef CONFIG_MACH_EDB9301
  135. MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
  136. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  137. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  138. .map_io = ep93xx_map_io,
  139. .init_irq = ep93xx_init_irq,
  140. .timer = &ep93xx_timer,
  141. .init_machine = edb93xx_init_machine,
  142. MACHINE_END
  143. #endif
  144. #ifdef CONFIG_MACH_EDB9302
  145. MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
  146. /* Maintainer: George Kashperko <george@chas.com.ua> */
  147. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  148. .map_io = ep93xx_map_io,
  149. .init_irq = ep93xx_init_irq,
  150. .timer = &ep93xx_timer,
  151. .init_machine = edb93xx_init_machine,
  152. MACHINE_END
  153. #endif
  154. #ifdef CONFIG_MACH_EDB9302A
  155. MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
  156. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  157. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  158. .map_io = ep93xx_map_io,
  159. .init_irq = ep93xx_init_irq,
  160. .timer = &ep93xx_timer,
  161. .init_machine = edb93xx_init_machine,
  162. MACHINE_END
  163. #endif
  164. #ifdef CONFIG_MACH_EDB9307
  165. MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
  166. /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
  167. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  168. .map_io = ep93xx_map_io,
  169. .init_irq = ep93xx_init_irq,
  170. .timer = &ep93xx_timer,
  171. .init_machine = edb93xx_init_machine,
  172. MACHINE_END
  173. #endif
  174. #ifdef CONFIG_MACH_EDB9307A
  175. MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
  176. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  177. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  178. .map_io = ep93xx_map_io,
  179. .init_irq = ep93xx_init_irq,
  180. .timer = &ep93xx_timer,
  181. .init_machine = edb93xx_init_machine,
  182. MACHINE_END
  183. #endif
  184. #ifdef CONFIG_MACH_EDB9312
  185. MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
  186. /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
  187. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  188. .map_io = ep93xx_map_io,
  189. .init_irq = ep93xx_init_irq,
  190. .timer = &ep93xx_timer,
  191. .init_machine = edb93xx_init_machine,
  192. MACHINE_END
  193. #endif
  194. #ifdef CONFIG_MACH_EDB9315
  195. MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
  196. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  197. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  198. .map_io = ep93xx_map_io,
  199. .init_irq = ep93xx_init_irq,
  200. .timer = &ep93xx_timer,
  201. .init_machine = edb93xx_init_machine,
  202. MACHINE_END
  203. #endif
  204. #ifdef CONFIG_MACH_EDB9315A
  205. MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
  206. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  207. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  208. .map_io = ep93xx_map_io,
  209. .init_irq = ep93xx_init_irq,
  210. .timer = &ep93xx_timer,
  211. .init_machine = edb93xx_init_machine,
  212. MACHINE_END
  213. #endif