edb93xx.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. static void __init edb93xx_init_machine(void)
  105. {
  106. ep93xx_init_devices();
  107. edb93xx_register_flash();
  108. ep93xx_register_eth(&edb93xx_eth_data, 1);
  109. edb93xx_register_i2c();
  110. }
  111. #ifdef CONFIG_MACH_EDB9301
  112. MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
  113. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  114. .phys_io = EP93XX_APB_PHYS_BASE,
  115. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  116. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  117. .map_io = ep93xx_map_io,
  118. .init_irq = ep93xx_init_irq,
  119. .timer = &ep93xx_timer,
  120. .init_machine = edb93xx_init_machine,
  121. MACHINE_END
  122. #endif
  123. #ifdef CONFIG_MACH_EDB9302
  124. MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
  125. /* Maintainer: George Kashperko <george@chas.com.ua> */
  126. .phys_io = EP93XX_APB_PHYS_BASE,
  127. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  128. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  129. .map_io = ep93xx_map_io,
  130. .init_irq = ep93xx_init_irq,
  131. .timer = &ep93xx_timer,
  132. .init_machine = edb93xx_init_machine,
  133. MACHINE_END
  134. #endif
  135. #ifdef CONFIG_MACH_EDB9302A
  136. MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
  137. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  138. .phys_io = EP93XX_APB_PHYS_BASE,
  139. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  140. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  141. .map_io = ep93xx_map_io,
  142. .init_irq = ep93xx_init_irq,
  143. .timer = &ep93xx_timer,
  144. .init_machine = edb93xx_init_machine,
  145. MACHINE_END
  146. #endif
  147. #ifdef CONFIG_MACH_EDB9307
  148. MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
  149. /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
  150. .phys_io = EP93XX_APB_PHYS_BASE,
  151. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  152. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  153. .map_io = ep93xx_map_io,
  154. .init_irq = ep93xx_init_irq,
  155. .timer = &ep93xx_timer,
  156. .init_machine = edb93xx_init_machine,
  157. MACHINE_END
  158. #endif
  159. #ifdef CONFIG_MACH_EDB9307A
  160. MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
  161. /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
  162. .phys_io = EP93XX_APB_PHYS_BASE,
  163. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  164. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  165. .map_io = ep93xx_map_io,
  166. .init_irq = ep93xx_init_irq,
  167. .timer = &ep93xx_timer,
  168. .init_machine = edb93xx_init_machine,
  169. MACHINE_END
  170. #endif
  171. #ifdef CONFIG_MACH_EDB9312
  172. MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
  173. /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
  174. .phys_io = EP93XX_APB_PHYS_BASE,
  175. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  176. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  177. .map_io = ep93xx_map_io,
  178. .init_irq = ep93xx_init_irq,
  179. .timer = &ep93xx_timer,
  180. .init_machine = edb93xx_init_machine,
  181. MACHINE_END
  182. #endif
  183. #ifdef CONFIG_MACH_EDB9315
  184. MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
  185. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  186. .phys_io = EP93XX_APB_PHYS_BASE,
  187. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  188. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  189. .map_io = ep93xx_map_io,
  190. .init_irq = ep93xx_init_irq,
  191. .timer = &ep93xx_timer,
  192. .init_machine = edb93xx_init_machine,
  193. MACHINE_END
  194. #endif
  195. #ifdef CONFIG_MACH_EDB9315A
  196. MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
  197. /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
  198. .phys_io = EP93XX_APB_PHYS_BASE,
  199. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  200. .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
  201. .map_io = ep93xx_map_io,
  202. .init_irq = ep93xx_init_irq,
  203. .timer = &ep93xx_timer,
  204. .init_machine = edb93xx_init_machine,
  205. MACHINE_END
  206. #endif