cm_bf533.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * File: arch/blackfin/mach-bf533/boards/cm_bf533.c
  3. * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
  5. *
  6. * Created: 2005
  7. * Description: Board description file
  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/mtd/mtd.h>
  32. #include <linux/mtd/partitions.h>
  33. #include <linux/spi/spi.h>
  34. #include <linux/spi/flash.h>
  35. #include <linux/usb_isp1362.h>
  36. #include <linux/irq.h>
  37. #include <asm/bfin5xx_spi.h>
  38. /*
  39. * Name the Board for the /proc/cpuinfo
  40. */
  41. char *bfin_board_name = "Bluetechnix CM BF533";
  42. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  43. /* all SPI peripherals info goes here */
  44. static struct mtd_partition bfin_spi_flash_partitions[] = {
  45. {
  46. .name = "bootloader",
  47. .size = 0x00020000,
  48. .offset = 0,
  49. .mask_flags = MTD_CAP_ROM
  50. }, {
  51. .name = "kernel",
  52. .size = 0xe0000,
  53. .offset = 0x20000
  54. }, {
  55. .name = "file system",
  56. .size = 0x700000,
  57. .offset = 0x00100000,
  58. }
  59. };
  60. static struct flash_platform_data bfin_spi_flash_data = {
  61. .name = "m25p80",
  62. .parts = bfin_spi_flash_partitions,
  63. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  64. .type = "m25p64",
  65. };
  66. /* SPI flash chip (m25p64) */
  67. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  68. .enable_dma = 0, /* use dma transfer with this chip*/
  69. .bits_per_word = 8,
  70. };
  71. /* SPI ADC chip */
  72. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  73. .enable_dma = 1, /* use dma transfer with this chip*/
  74. .bits_per_word = 16,
  75. };
  76. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  77. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  78. .enable_dma = 0,
  79. .bits_per_word = 16,
  80. };
  81. #endif
  82. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  83. {
  84. /* the modalias must be the same as spi device driver name */
  85. .modalias = "m25p80", /* Name of spi_driver for this device */
  86. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  87. .bus_num = 1, /* Framework bus number */
  88. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  89. .platform_data = &bfin_spi_flash_data,
  90. .controller_data = &spi_flash_chip_info,
  91. .mode = SPI_MODE_3,
  92. }, {
  93. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  94. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  95. .bus_num = 1, /* Framework bus number */
  96. .chip_select = 2, /* Framework chip select. */
  97. .platform_data = NULL, /* No spi_driver specific config */
  98. .controller_data = &spi_adc_chip_info,
  99. },
  100. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  101. {
  102. .modalias = "ad1836-spi",
  103. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  104. .bus_num = 1,
  105. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  106. .controller_data = &ad1836_spi_chip_info,
  107. },
  108. #endif
  109. };
  110. /* SPI controller data */
  111. static struct bfin5xx_spi_master spi_bfin_master_info = {
  112. .num_chipselect = 8,
  113. .enable_dma = 1, /* master has the ability to do dma transfer */
  114. };
  115. static struct platform_device spi_bfin_master_device = {
  116. .name = "bfin-spi-master",
  117. .id = 1, /* Bus number */
  118. .dev = {
  119. .platform_data = &spi_bfin_master_info, /* Passed to driver */
  120. },
  121. };
  122. #endif /* spi master and devices */
  123. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  124. static struct platform_device rtc_device = {
  125. .name = "rtc-bfin",
  126. .id = -1,
  127. };
  128. #endif
  129. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  130. static struct resource smc91x_resources[] = {
  131. {
  132. .start = 0x20200300,
  133. .end = 0x20200300 + 16,
  134. .flags = IORESOURCE_MEM,
  135. }, {
  136. .start = IRQ_PF0,
  137. .end = IRQ_PF0,
  138. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  139. },
  140. };
  141. static struct platform_device smc91x_device = {
  142. .name = "smc91x",
  143. .id = 0,
  144. .num_resources = ARRAY_SIZE(smc91x_resources),
  145. .resource = smc91x_resources,
  146. };
  147. #endif
  148. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  149. static struct resource bfin_uart_resources[] = {
  150. {
  151. .start = 0xFFC00400,
  152. .end = 0xFFC004FF,
  153. .flags = IORESOURCE_MEM,
  154. },
  155. };
  156. static struct platform_device bfin_uart_device = {
  157. .name = "bfin-uart",
  158. .id = 1,
  159. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  160. .resource = bfin_uart_resources,
  161. };
  162. #endif
  163. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  164. static struct platform_device bfin_sport0_uart_device = {
  165. .name = "bfin-sport-uart",
  166. .id = 0,
  167. };
  168. static struct platform_device bfin_sport1_uart_device = {
  169. .name = "bfin-sport-uart",
  170. .id = 1,
  171. };
  172. #endif
  173. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  174. static struct resource isp1362_hcd_resources[] = {
  175. {
  176. .start = 0x20308000,
  177. .end = 0x20308000,
  178. .flags = IORESOURCE_MEM,
  179. }, {
  180. .start = 0x20308004,
  181. .end = 0x20308004,
  182. .flags = IORESOURCE_MEM,
  183. }, {
  184. .start = IRQ_PF4,
  185. .end = IRQ_PF4,
  186. .flags = IORESOURCE_IRQ,
  187. },
  188. };
  189. static struct isp1362_platform_data isp1362_priv = {
  190. .sel15Kres = 1,
  191. .clknotstop = 0,
  192. .oc_enable = 0,
  193. .int_act_high = 0,
  194. .int_edge_triggered = 0,
  195. .remote_wakeup_connected = 0,
  196. .no_power_switching = 1,
  197. .power_switching_mode = 0,
  198. };
  199. static struct platform_device isp1362_hcd_device = {
  200. .name = "isp1362-hcd",
  201. .id = 0,
  202. .dev = {
  203. .platform_data = &isp1362_priv,
  204. },
  205. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  206. .resource = isp1362_hcd_resources,
  207. };
  208. #endif
  209. static struct platform_device *cm_bf533_devices[] __initdata = {
  210. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  211. &bfin_uart_device,
  212. #endif
  213. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  214. &bfin_sport0_uart_device,
  215. &bfin_sport1_uart_device,
  216. #endif
  217. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  218. &rtc_device,
  219. #endif
  220. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  221. &isp1362_hcd_device,
  222. #endif
  223. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  224. &smc91x_device,
  225. #endif
  226. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  227. &spi_bfin_master_device,
  228. #endif
  229. };
  230. static int __init cm_bf533_init(void)
  231. {
  232. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  233. platform_add_devices(cm_bf533_devices, ARRAY_SIZE(cm_bf533_devices));
  234. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  235. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  236. #endif
  237. return 0;
  238. }
  239. arch_initcall(cm_bf533_init);