stamp.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. * File: arch/blackfin/mach-bf533/stamp.c
  3. * Based on: arch/blackfin/mach-bf533/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created: 2005
  7. * Description: Board Info File for the BF533-STAMP
  8. *
  9. * Modified:
  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. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  37. #include <linux/usb_isp1362.h>
  38. #endif
  39. #include <asm/irq.h>
  40. #include <asm/bfin5xx_spi.h>
  41. /*
  42. * Name the Board for the /proc/cpuinfo
  43. */
  44. char *bfin_board_name = "ADDS-BF533-STAMP";
  45. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  46. static struct platform_device rtc_device = {
  47. .name = "rtc-bfin",
  48. .id = -1,
  49. };
  50. #endif
  51. /*
  52. * Driver needs to know address, irq and flag pin.
  53. */
  54. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  55. static struct resource smc91x_resources[] = {
  56. {
  57. .name = "smc91x-regs",
  58. .start = 0x20300300,
  59. .end = 0x20300300 + 16,
  60. .flags = IORESOURCE_MEM,
  61. },{
  62. .start = IRQ_PF7,
  63. .end = IRQ_PF7,
  64. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  65. },
  66. };
  67. static struct platform_device smc91x_device = {
  68. .name = "smc91x",
  69. .id = 0,
  70. .num_resources = ARRAY_SIZE(smc91x_resources),
  71. .resource = smc91x_resources,
  72. };
  73. #endif
  74. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  75. static struct resource net2272_bfin_resources[] = {
  76. {
  77. .start = 0x20300000,
  78. .end = 0x20300000 + 0x100,
  79. .flags = IORESOURCE_MEM,
  80. },{
  81. .start = IRQ_PF10,
  82. .end = IRQ_PF10,
  83. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  84. },
  85. };
  86. static struct platform_device net2272_bfin_device = {
  87. .name = "net2272",
  88. .id = -1,
  89. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  90. .resource = net2272_bfin_resources,
  91. };
  92. #endif
  93. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  94. /* all SPI peripherals info goes here */
  95. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  96. static struct mtd_partition bfin_spi_flash_partitions[] = {
  97. {
  98. .name = "bootloader",
  99. .size = 0x00020000,
  100. .offset = 0,
  101. .mask_flags = MTD_CAP_ROM
  102. },{
  103. .name = "kernel",
  104. .size = 0xe0000,
  105. .offset = 0x20000
  106. },{
  107. .name = "file system",
  108. .size = 0x700000,
  109. .offset = 0x00100000,
  110. }
  111. };
  112. static struct flash_platform_data bfin_spi_flash_data = {
  113. .name = "m25p80",
  114. .parts = bfin_spi_flash_partitions,
  115. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  116. .type = "m25p64",
  117. };
  118. /* SPI flash chip (m25p64) */
  119. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  120. .enable_dma = 0, /* use dma transfer with this chip*/
  121. .bits_per_word = 8,
  122. };
  123. #endif
  124. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  125. /* SPI ADC chip */
  126. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  127. .enable_dma = 1, /* use dma transfer with this chip*/
  128. .bits_per_word = 16,
  129. };
  130. #endif
  131. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  132. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  133. .enable_dma = 0,
  134. .bits_per_word = 16,
  135. };
  136. #endif
  137. #if defined(CONFIG_PBX)
  138. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  139. .ctl_reg = 0x4, /* send zero */
  140. .enable_dma = 0,
  141. .bits_per_word = 8,
  142. .cs_change_per_word = 1,
  143. };
  144. #endif
  145. #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
  146. static struct bfin5xx_spi_chip ad5304_chip_info = {
  147. .enable_dma = 0,
  148. .bits_per_word = 16,
  149. };
  150. #endif
  151. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  152. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  153. {
  154. /* the modalias must be the same as spi device driver name */
  155. .modalias = "m25p80", /* Name of spi_driver for this device */
  156. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  157. .bus_num = 1, /* Framework bus number */
  158. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  159. .platform_data = &bfin_spi_flash_data,
  160. .controller_data = &spi_flash_chip_info,
  161. .mode = SPI_MODE_3,
  162. },
  163. #endif
  164. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  165. {
  166. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  167. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  168. .bus_num = 1, /* Framework bus number */
  169. .chip_select = 1, /* Framework chip select. */
  170. .platform_data = NULL, /* No spi_driver specific config */
  171. .controller_data = &spi_adc_chip_info,
  172. },
  173. #endif
  174. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  175. {
  176. .modalias = "ad1836-spi",
  177. .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
  178. .bus_num = 1,
  179. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  180. .controller_data = &ad1836_spi_chip_info,
  181. },
  182. #endif
  183. #if defined(CONFIG_PBX)
  184. {
  185. .modalias = "fxs-spi",
  186. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  187. .bus_num = 1,
  188. .chip_select = 3,
  189. .controller_data= &spi_si3xxx_chip_info,
  190. .mode = SPI_MODE_3,
  191. },
  192. {
  193. .modalias = "fxo-spi",
  194. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  195. .bus_num = 1,
  196. .chip_select = 2,
  197. .controller_data= &spi_si3xxx_chip_info,
  198. .mode = SPI_MODE_3,
  199. },
  200. #endif
  201. #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
  202. {
  203. .modalias = "ad5304_spi",
  204. .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
  205. .bus_num = 1,
  206. .chip_select = 2,
  207. .platform_data = NULL,
  208. .controller_data = &ad5304_chip_info,
  209. .mode = SPI_MODE_2,
  210. },
  211. #endif
  212. };
  213. /* SPI controller data */
  214. static struct bfin5xx_spi_master spi_bfin_master_info = {
  215. .num_chipselect = 8,
  216. .enable_dma = 1, /* master has the ability to do dma transfer */
  217. };
  218. static struct platform_device spi_bfin_master_device = {
  219. .name = "bfin-spi-master",
  220. .id = 1, /* Bus number */
  221. .dev = {
  222. .platform_data = &spi_bfin_master_info, /* Passed to driver */
  223. },
  224. };
  225. #endif /* spi master and devices */
  226. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  227. static struct platform_device bfin_fb_device = {
  228. .name = "bf537-fb",
  229. };
  230. #endif
  231. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  232. static struct resource bfin_uart_resources[] = {
  233. {
  234. .start = 0xFFC00400,
  235. .end = 0xFFC004FF,
  236. .flags = IORESOURCE_MEM,
  237. },
  238. };
  239. static struct platform_device bfin_uart_device = {
  240. .name = "bfin-uart",
  241. .id = 1,
  242. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  243. .resource = bfin_uart_resources,
  244. };
  245. #endif
  246. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  247. static struct platform_device bfin_sport0_uart_device = {
  248. .name = "bfin-sport-uart",
  249. .id = 0,
  250. };
  251. static struct platform_device bfin_sport1_uart_device = {
  252. .name = "bfin-sport-uart",
  253. .id = 1,
  254. };
  255. #endif
  256. static struct platform_device *stamp_devices[] __initdata = {
  257. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  258. &rtc_device,
  259. #endif
  260. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  261. &smc91x_device,
  262. #endif
  263. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  264. &net2272_bfin_device,
  265. #endif
  266. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  267. &spi_bfin_master_device,
  268. #endif
  269. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  270. &bfin_uart_device,
  271. #endif
  272. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  273. &bfin_sport0_uart_device,
  274. &bfin_sport1_uart_device,
  275. #endif
  276. };
  277. static int __init stamp_init(void)
  278. {
  279. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  280. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  281. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  282. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  283. #endif
  284. return 0;
  285. }
  286. arch_initcall(stamp_init);