ezkit.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /*
  2. * File: arch/blackfin/mach-bf561/ezkit.c
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #include <linux/device.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/spi/spi.h>
  32. #include <linux/irq.h>
  33. #include <linux/interrupt.h>
  34. #include <linux/pata_platform.h>
  35. #include <asm/dma.h>
  36. #include <asm/bfin5xx_spi.h>
  37. #include <asm/portmux.h>
  38. /*
  39. * Name the Board for the /proc/cpuinfo
  40. */
  41. const char bfin_board_name[] = "ADDS-BF561-EZKIT";
  42. #define ISP1761_BASE 0x2C0F0000
  43. #define ISP1761_IRQ IRQ_PF10
  44. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  45. static struct resource bfin_isp1761_resources[] = {
  46. {
  47. .name = "isp1761-regs",
  48. .start = ISP1761_BASE + 0x00000000,
  49. .end = ISP1761_BASE + 0x000fffff,
  50. .flags = IORESOURCE_MEM,
  51. },
  52. {
  53. .start = ISP1761_IRQ,
  54. .end = ISP1761_IRQ,
  55. .flags = IORESOURCE_IRQ,
  56. },
  57. };
  58. static struct platform_device bfin_isp1761_device = {
  59. .name = "isp1761",
  60. .id = 0,
  61. .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
  62. .resource = bfin_isp1761_resources,
  63. };
  64. static struct platform_device *bfin_isp1761_devices[] = {
  65. &bfin_isp1761_device,
  66. };
  67. int __init bfin_isp1761_init(void)
  68. {
  69. unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
  70. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  71. set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
  72. return platform_add_devices(bfin_isp1761_devices, num_devices);
  73. }
  74. void __exit bfin_isp1761_exit(void)
  75. {
  76. platform_device_unregister(&bfin_isp1761_device);
  77. }
  78. arch_initcall(bfin_isp1761_init);
  79. #endif
  80. /*
  81. * USB-LAN EzExtender board
  82. * Driver needs to know address, irq and flag pin.
  83. */
  84. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  85. static struct resource smc91x_resources[] = {
  86. {
  87. .name = "smc91x-regs",
  88. .start = 0x2C010300,
  89. .end = 0x2C010300 + 16,
  90. .flags = IORESOURCE_MEM,
  91. }, {
  92. .start = IRQ_PF9,
  93. .end = IRQ_PF9,
  94. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  95. },
  96. };
  97. static struct platform_device smc91x_device = {
  98. .name = "smc91x",
  99. .id = 0,
  100. .num_resources = ARRAY_SIZE(smc91x_resources),
  101. .resource = smc91x_resources,
  102. };
  103. #endif
  104. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  105. static struct resource ax88180_resources[] = {
  106. [0] = {
  107. .start = 0x2c000000,
  108. .end = 0x2c000000 + 0x8000,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. [1] = {
  112. .start = IRQ_PF10,
  113. .end = IRQ_PF10,
  114. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
  115. },
  116. };
  117. static struct platform_device ax88180_device = {
  118. .name = "ax88180",
  119. .id = -1,
  120. .num_resources = ARRAY_SIZE(ax88180_resources),
  121. .resource = ax88180_resources,
  122. };
  123. #endif
  124. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  125. static struct resource bfin_uart_resources[] = {
  126. {
  127. .start = 0xFFC00400,
  128. .end = 0xFFC004FF,
  129. .flags = IORESOURCE_MEM,
  130. },
  131. };
  132. static struct platform_device bfin_uart_device = {
  133. .name = "bfin-uart",
  134. .id = 1,
  135. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  136. .resource = bfin_uart_resources,
  137. };
  138. #endif
  139. #ifdef CONFIG_SPI_BFIN
  140. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  141. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  142. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  143. .enable_dma = 0,
  144. .bits_per_word = 16,
  145. };
  146. #endif
  147. #endif
  148. /* SPI (0) */
  149. static struct resource bfin_spi0_resource[] = {
  150. [0] = {
  151. .start = SPI0_REGBASE,
  152. .end = SPI0_REGBASE + 0xFF,
  153. .flags = IORESOURCE_MEM,
  154. },
  155. [1] = {
  156. .start = CH_SPI,
  157. .end = CH_SPI,
  158. .flags = IORESOURCE_IRQ,
  159. }
  160. };
  161. /* SPI controller data */
  162. static struct bfin5xx_spi_master bfin_spi0_info = {
  163. .num_chipselect = 8,
  164. .enable_dma = 1, /* master has the ability to do dma transfer */
  165. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  166. };
  167. static struct platform_device bfin_spi0_device = {
  168. .name = "bfin-spi",
  169. .id = 0, /* Bus number */
  170. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  171. .resource = bfin_spi0_resource,
  172. .dev = {
  173. .platform_data = &bfin_spi0_info, /* Passed to driver */
  174. },
  175. };
  176. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  177. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  178. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  179. {
  180. .modalias = "ad1836-spi",
  181. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  182. .bus_num = 0,
  183. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  184. .controller_data = &ad1836_spi_chip_info,
  185. },
  186. #endif
  187. };
  188. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  189. #define PATA_INT 55
  190. static struct pata_platform_info bfin_pata_platform_data = {
  191. .ioport_shift = 1,
  192. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  193. };
  194. static struct resource bfin_pata_resources[] = {
  195. {
  196. .start = 0x20314020,
  197. .end = 0x2031403F,
  198. .flags = IORESOURCE_MEM,
  199. },
  200. {
  201. .start = 0x2031401C,
  202. .end = 0x2031401F,
  203. .flags = IORESOURCE_MEM,
  204. },
  205. {
  206. .start = PATA_INT,
  207. .end = PATA_INT,
  208. .flags = IORESOURCE_IRQ,
  209. },
  210. };
  211. static struct platform_device bfin_pata_device = {
  212. .name = "pata_platform",
  213. .id = -1,
  214. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  215. .resource = bfin_pata_resources,
  216. .dev = {
  217. .platform_data = &bfin_pata_platform_data,
  218. }
  219. };
  220. #endif
  221. static struct platform_device *ezkit_devices[] __initdata = {
  222. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  223. &smc91x_device,
  224. #endif
  225. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  226. &ax88180_device,
  227. #endif
  228. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  229. &bfin_spi0_device,
  230. #endif
  231. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  232. &bfin_uart_device,
  233. #endif
  234. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  235. &bfin_pata_device,
  236. #endif
  237. };
  238. static int __init ezkit_init(void)
  239. {
  240. int ret;
  241. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  242. ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  243. if (ret < 0)
  244. return ret;
  245. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  246. bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
  247. SSYNC();
  248. #endif
  249. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  250. spi_register_board_info(bfin_spi_board_info,
  251. ARRAY_SIZE(bfin_spi_board_info));
  252. #endif
  253. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  254. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  255. #endif
  256. return 0;
  257. }
  258. arch_initcall(ezkit_init);