ezkit.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. /*
  38. * Name the Board for the /proc/cpuinfo
  39. */
  40. char *bfin_board_name = "ADDS-BF561-EZKIT";
  41. #define ISP1761_BASE 0x2C0F0000
  42. #define ISP1761_IRQ IRQ_PF10
  43. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  44. static struct resource bfin_isp1761_resources[] = {
  45. {
  46. .name = "isp1761-regs",
  47. .start = ISP1761_BASE + 0x00000000,
  48. .end = ISP1761_BASE + 0x000fffff,
  49. .flags = IORESOURCE_MEM,
  50. },
  51. {
  52. .start = ISP1761_IRQ,
  53. .end = ISP1761_IRQ,
  54. .flags = IORESOURCE_IRQ,
  55. },
  56. };
  57. static struct platform_device bfin_isp1761_device = {
  58. .name = "isp1761",
  59. .id = 0,
  60. .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
  61. .resource = bfin_isp1761_resources,
  62. };
  63. static struct platform_device *bfin_isp1761_devices[] = {
  64. &bfin_isp1761_device,
  65. };
  66. int __init bfin_isp1761_init(void)
  67. {
  68. unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
  69. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  70. set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
  71. return platform_add_devices(bfin_isp1761_devices, num_devices);
  72. }
  73. void __exit bfin_isp1761_exit(void)
  74. {
  75. platform_device_unregister(&bfin_isp1761_device);
  76. }
  77. arch_initcall(bfin_isp1761_init);
  78. #endif
  79. /*
  80. * USB-LAN EzExtender board
  81. * Driver needs to know address, irq and flag pin.
  82. */
  83. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  84. static struct resource smc91x_resources[] = {
  85. {
  86. .name = "smc91x-regs",
  87. .start = 0x2C010300,
  88. .end = 0x2C010300 + 16,
  89. .flags = IORESOURCE_MEM,
  90. }, {
  91. .start = IRQ_PF9,
  92. .end = IRQ_PF9,
  93. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  94. },
  95. };
  96. static struct platform_device smc91x_device = {
  97. .name = "smc91x",
  98. .id = 0,
  99. .num_resources = ARRAY_SIZE(smc91x_resources),
  100. .resource = smc91x_resources,
  101. };
  102. #endif
  103. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  104. static struct resource bfin_uart_resources[] = {
  105. {
  106. .start = 0xFFC00400,
  107. .end = 0xFFC004FF,
  108. .flags = IORESOURCE_MEM,
  109. },
  110. };
  111. static struct platform_device bfin_uart_device = {
  112. .name = "bfin-uart",
  113. .id = 1,
  114. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  115. .resource = bfin_uart_resources,
  116. };
  117. #endif
  118. #ifdef CONFIG_SPI_BFIN
  119. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  120. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  121. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  122. .enable_dma = 0,
  123. .bits_per_word = 16,
  124. };
  125. #endif
  126. #endif
  127. /* SPI (0) */
  128. static struct resource bfin_spi0_resource[] = {
  129. [0] = {
  130. .start = SPI0_REGBASE,
  131. .end = SPI0_REGBASE + 0xFF,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. [1] = {
  135. .start = CH_SPI,
  136. .end = CH_SPI,
  137. .flags = IORESOURCE_IRQ,
  138. }
  139. };
  140. /* SPI controller data */
  141. static struct bfin5xx_spi_master bfin_spi0_info = {
  142. .num_chipselect = 8,
  143. .enable_dma = 1, /* master has the ability to do dma transfer */
  144. };
  145. static struct platform_device bfin_spi0_device = {
  146. .name = "bfin-spi",
  147. .id = 0, /* Bus number */
  148. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  149. .resource = bfin_spi0_resource,
  150. .dev = {
  151. .platform_data = &bfin_spi0_info, /* Passed to driver */
  152. },
  153. };
  154. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  155. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  156. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  157. {
  158. .modalias = "ad1836-spi",
  159. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  160. .bus_num = 0,
  161. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  162. .controller_data = &ad1836_spi_chip_info,
  163. },
  164. #endif
  165. };
  166. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  167. #define PATA_INT 55
  168. static struct pata_platform_info bfin_pata_platform_data = {
  169. .ioport_shift = 1,
  170. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  171. };
  172. static struct resource bfin_pata_resources[] = {
  173. {
  174. .start = 0x20314020,
  175. .end = 0x2031403F,
  176. .flags = IORESOURCE_MEM,
  177. },
  178. {
  179. .start = 0x2031401C,
  180. .end = 0x2031401F,
  181. .flags = IORESOURCE_MEM,
  182. },
  183. {
  184. .start = PATA_INT,
  185. .end = PATA_INT,
  186. .flags = IORESOURCE_IRQ,
  187. },
  188. };
  189. static struct platform_device bfin_pata_device = {
  190. .name = "pata_platform",
  191. .id = -1,
  192. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  193. .resource = bfin_pata_resources,
  194. .dev = {
  195. .platform_data = &bfin_pata_platform_data,
  196. }
  197. };
  198. #endif
  199. static struct platform_device *ezkit_devices[] __initdata = {
  200. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  201. &smc91x_device,
  202. #endif
  203. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  204. &bfin_spi0_device,
  205. #endif
  206. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  207. &bfin_uart_device,
  208. #endif
  209. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  210. &bfin_pata_device,
  211. #endif
  212. };
  213. static int __init ezkit_init(void)
  214. {
  215. int ret;
  216. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  217. ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  218. if (ret < 0)
  219. return ret;
  220. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  221. bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
  222. SSYNC();
  223. #endif
  224. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  225. spi_register_board_info(bfin_spi_board_info,
  226. ARRAY_SIZE(bfin_spi_board_info));
  227. #endif
  228. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  229. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  230. #endif
  231. return 0;
  232. }
  233. arch_initcall(ezkit_init);