ezkit.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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 <asm/bfin5xx_spi.h>
  35. /*
  36. * Name the Board for the /proc/cpuinfo
  37. */
  38. char *bfin_board_name = "ADDS-BF561-EZKIT";
  39. #define ISP1761_BASE 0x2C0F0000
  40. #define ISP1761_IRQ IRQ_PF10
  41. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  42. static struct resource bfin_isp1761_resources[] = {
  43. {
  44. .name = "isp1761-regs",
  45. .start = ISP1761_BASE + 0x00000000,
  46. .end = ISP1761_BASE + 0x000fffff,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. {
  50. .start = ISP1761_IRQ,
  51. .end = ISP1761_IRQ,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. static struct platform_device bfin_isp1761_device = {
  56. .name = "isp1761",
  57. .id = 0,
  58. .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
  59. .resource = bfin_isp1761_resources,
  60. };
  61. static struct platform_device *bfin_isp1761_devices[] = {
  62. &bfin_isp1761_device,
  63. };
  64. int __init bfin_isp1761_init(void)
  65. {
  66. unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
  67. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  68. set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
  69. return platform_add_devices(bfin_isp1761_devices, num_devices);
  70. }
  71. void __exit bfin_isp1761_exit(void)
  72. {
  73. platform_device_unregister(&bfin_isp1761_device);
  74. }
  75. arch_initcall(bfin_isp1761_init);
  76. #endif
  77. /*
  78. * USB-LAN EzExtender board
  79. * Driver needs to know address, irq and flag pin.
  80. */
  81. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  82. static struct resource smc91x_resources[] = {
  83. {
  84. .name = "smc91x-regs",
  85. .start = 0x2C010300,
  86. .end = 0x2C010300 + 16,
  87. .flags = IORESOURCE_MEM,
  88. }, {
  89. .start = IRQ_PF9,
  90. .end = IRQ_PF9,
  91. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  92. },
  93. };
  94. static struct platform_device smc91x_device = {
  95. .name = "smc91x",
  96. .id = 0,
  97. .num_resources = ARRAY_SIZE(smc91x_resources),
  98. .resource = smc91x_resources,
  99. };
  100. #endif
  101. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  102. static struct resource bfin_uart_resources[] = {
  103. {
  104. .start = 0xFFC00400,
  105. .end = 0xFFC004FF,
  106. .flags = IORESOURCE_MEM,
  107. },
  108. };
  109. static struct platform_device bfin_uart_device = {
  110. .name = "bfin-uart",
  111. .id = 1,
  112. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  113. .resource = bfin_uart_resources,
  114. };
  115. #endif
  116. #ifdef CONFIG_SPI_BFIN
  117. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  118. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  119. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  120. .enable_dma = 0,
  121. .bits_per_word = 16,
  122. };
  123. #endif
  124. #endif
  125. /* SPI controller data */
  126. static struct bfin5xx_spi_master spi_bfin_master_info = {
  127. .num_chipselect = 8,
  128. .enable_dma = 1, /* master has the ability to do dma transfer */
  129. };
  130. static struct platform_device spi_bfin_master_device = {
  131. .name = "bfin-spi-master",
  132. .id = 1, /* Bus number */
  133. .dev = {
  134. .platform_data = &spi_bfin_master_info, /* Passed to driver */
  135. },
  136. };
  137. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  138. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  139. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  140. {
  141. .modalias = "ad1836-spi",
  142. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  143. .bus_num = 1,
  144. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  145. .controller_data = &ad1836_spi_chip_info,
  146. },
  147. #endif
  148. };
  149. static struct platform_device *ezkit_devices[] __initdata = {
  150. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  151. &smc91x_device,
  152. #endif
  153. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  154. &spi_bfin_master_device,
  155. #endif
  156. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  157. &bfin_uart_device,
  158. #endif
  159. };
  160. static int __init ezkit_init(void)
  161. {
  162. int ret;
  163. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  164. ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  165. if (ret < 0)
  166. return ret;
  167. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  168. bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
  169. SSYNC();
  170. #endif
  171. return spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  172. }
  173. arch_initcall(ezkit_init);