ezkit.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * File: arch/blackfin/mach-bf533/ezkit.c
  3. * Based on: Original Work
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created: 2005
  7. * Description:
  8. *
  9. * Modified: Robin Getz <rgetz@blackfin.uclinux.org> - Named the boards
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2006 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <linux/device.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/partitions.h>
  34. #include <linux/spi/spi.h>
  35. #include <linux/spi/flash.h>
  36. #include <linux/usb_isp1362.h>
  37. #include <linux/irq.h>
  38. #include <asm/bfin5xx_spi.h>
  39. /*
  40. * Name the Board for the /proc/cpuinfo
  41. */
  42. char *bfin_board_name = "ADDS-BF533-EZKIT";
  43. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  44. static struct platform_device rtc_device = {
  45. .name = "rtc-bfin",
  46. .id = -1,
  47. };
  48. #endif
  49. /*
  50. * USB-LAN EzExtender board
  51. * Driver needs to know address, irq and flag pin.
  52. */
  53. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  54. static struct resource smc91x_resources[] = {
  55. {
  56. .name = "smc91x-regs",
  57. .start = 0x20310300,
  58. .end = 0x20310300 + 16,
  59. .flags = IORESOURCE_MEM,
  60. }, {
  61. .start = IRQ_PF9,
  62. .end = IRQ_PF9,
  63. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  64. },
  65. };
  66. static struct platform_device smc91x_device = {
  67. .name = "smc91x",
  68. .id = 0,
  69. .num_resources = ARRAY_SIZE(smc91x_resources),
  70. .resource = smc91x_resources,
  71. };
  72. #endif
  73. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  74. /* all SPI peripherals info goes here */
  75. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  76. static struct mtd_partition bfin_spi_flash_partitions[] = {
  77. {
  78. .name = "bootloader",
  79. .size = 0x00020000,
  80. .offset = 0,
  81. .mask_flags = MTD_CAP_ROM
  82. }, {
  83. .name = "kernel",
  84. .size = 0xe0000,
  85. .offset = 0x20000
  86. }, {
  87. .name = "file system",
  88. .size = 0x700000,
  89. .offset = 0x00100000,
  90. }
  91. };
  92. static struct flash_platform_data bfin_spi_flash_data = {
  93. .name = "m25p80",
  94. .parts = bfin_spi_flash_partitions,
  95. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  96. .type = "m25p64",
  97. };
  98. /* SPI flash chip (m25p64) */
  99. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  100. .enable_dma = 0, /* use dma transfer with this chip*/
  101. .bits_per_word = 8,
  102. };
  103. #endif
  104. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  105. /* SPI ADC chip */
  106. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  107. .enable_dma = 1, /* use dma transfer with this chip*/
  108. .bits_per_word = 16,
  109. };
  110. #endif
  111. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  112. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  113. .enable_dma = 0,
  114. .bits_per_word = 16,
  115. };
  116. #endif
  117. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  118. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  119. {
  120. /* the modalias must be the same as spi device driver name */
  121. .modalias = "m25p80", /* Name of spi_driver for this device */
  122. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  123. .bus_num = 1, /* Framework bus number */
  124. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  125. .platform_data = &bfin_spi_flash_data,
  126. .controller_data = &spi_flash_chip_info,
  127. .mode = SPI_MODE_3,
  128. },
  129. #endif
  130. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  131. {
  132. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  133. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  134. .bus_num = 1, /* Framework bus number */
  135. .chip_select = 1, /* Framework chip select. */
  136. .platform_data = NULL, /* No spi_driver specific config */
  137. .controller_data = &spi_adc_chip_info,
  138. },
  139. #endif
  140. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  141. {
  142. .modalias = "ad1836-spi",
  143. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  144. .bus_num = 1,
  145. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  146. .controller_data = &ad1836_spi_chip_info,
  147. },
  148. #endif
  149. };
  150. /* SPI controller data */
  151. static struct bfin5xx_spi_master spi_bfin_master_info = {
  152. .num_chipselect = 8,
  153. .enable_dma = 1, /* master has the ability to do dma transfer */
  154. };
  155. static struct platform_device spi_bfin_master_device = {
  156. .name = "bfin-spi-master",
  157. .id = 1, /* Bus number */
  158. .dev = {
  159. .platform_data = &spi_bfin_master_info, /* Passed to driver */
  160. },
  161. };
  162. #endif /* spi master and devices */
  163. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  164. static struct resource bfin_uart_resources[] = {
  165. {
  166. .start = 0xFFC00400,
  167. .end = 0xFFC004FF,
  168. .flags = IORESOURCE_MEM,
  169. },
  170. };
  171. static struct platform_device bfin_uart_device = {
  172. .name = "bfin-uart",
  173. .id = 1,
  174. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  175. .resource = bfin_uart_resources,
  176. };
  177. #endif
  178. static struct platform_device *ezkit_devices[] __initdata = {
  179. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  180. &smc91x_device,
  181. #endif
  182. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  183. &spi_bfin_master_device,
  184. #endif
  185. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  186. &rtc_device,
  187. #endif
  188. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  189. &bfin_uart_device,
  190. #endif
  191. };
  192. static int __init ezkit_init(void)
  193. {
  194. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  195. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  196. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  197. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  198. #endif
  199. return 0;
  200. }
  201. arch_initcall(ezkit_init);