edb93xx.c 7.4 KB

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