ezkit.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  105. static struct resource bfin_uart_resources[] = {
  106. {
  107. .start = 0xFFC00400,
  108. .end = 0xFFC004FF,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. };
  112. static struct platform_device bfin_uart_device = {
  113. .name = "bfin-uart",
  114. .id = 1,
  115. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  116. .resource = bfin_uart_resources,
  117. };
  118. #endif
  119. #ifdef CONFIG_SPI_BFIN
  120. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  121. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  122. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  123. .enable_dma = 0,
  124. .bits_per_word = 16,
  125. };
  126. #endif
  127. #endif
  128. /* SPI (0) */
  129. static struct resource bfin_spi0_resource[] = {
  130. [0] = {
  131. .start = SPI0_REGBASE,
  132. .end = SPI0_REGBASE + 0xFF,
  133. .flags = IORESOURCE_MEM,
  134. },
  135. [1] = {
  136. .start = CH_SPI,
  137. .end = CH_SPI,
  138. .flags = IORESOURCE_IRQ,
  139. }
  140. };
  141. /* SPI controller data */
  142. static struct bfin5xx_spi_master bfin_spi0_info = {
  143. .num_chipselect = 8,
  144. .enable_dma = 1, /* master has the ability to do dma transfer */
  145. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  146. };
  147. static struct platform_device bfin_spi0_device = {
  148. .name = "bfin-spi",
  149. .id = 0, /* Bus number */
  150. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  151. .resource = bfin_spi0_resource,
  152. .dev = {
  153. .platform_data = &bfin_spi0_info, /* Passed to driver */
  154. },
  155. };
  156. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  157. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  158. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  159. {
  160. .modalias = "ad1836-spi",
  161. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  162. .bus_num = 0,
  163. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  164. .controller_data = &ad1836_spi_chip_info,
  165. },
  166. #endif
  167. };
  168. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  169. #define PATA_INT 55
  170. static struct pata_platform_info bfin_pata_platform_data = {
  171. .ioport_shift = 1,
  172. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  173. };
  174. static struct resource bfin_pata_resources[] = {
  175. {
  176. .start = 0x20314020,
  177. .end = 0x2031403F,
  178. .flags = IORESOURCE_MEM,
  179. },
  180. {
  181. .start = 0x2031401C,
  182. .end = 0x2031401F,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. {
  186. .start = PATA_INT,
  187. .end = PATA_INT,
  188. .flags = IORESOURCE_IRQ,
  189. },
  190. };
  191. static struct platform_device bfin_pata_device = {
  192. .name = "pata_platform",
  193. .id = -1,
  194. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  195. .resource = bfin_pata_resources,
  196. .dev = {
  197. .platform_data = &bfin_pata_platform_data,
  198. }
  199. };
  200. #endif
  201. static struct platform_device *ezkit_devices[] __initdata = {
  202. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  203. &smc91x_device,
  204. #endif
  205. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  206. &bfin_spi0_device,
  207. #endif
  208. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  209. &bfin_uart_device,
  210. #endif
  211. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  212. &bfin_pata_device,
  213. #endif
  214. };
  215. static int __init ezkit_init(void)
  216. {
  217. int ret;
  218. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  219. ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  220. if (ret < 0)
  221. return ret;
  222. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  223. bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
  224. SSYNC();
  225. #endif
  226. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  227. spi_register_board_info(bfin_spi_board_info,
  228. ARRAY_SIZE(bfin_spi_board_info));
  229. #endif
  230. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  231. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  232. #endif
  233. return 0;
  234. }
  235. arch_initcall(ezkit_init);