cm_bf561.c 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. /*
  2. * File: arch/blackfin/mach-bf533/boards/cm_bf561.c
  3. * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
  5. *
  6. * Created: 2006
  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/pata_platform.h>
  37. #include <linux/irq.h>
  38. #include <asm/dma.h>
  39. #include <asm/bfin5xx_spi.h>
  40. #include <asm/portmux.h>
  41. /*
  42. * Name the Board for the /proc/cpuinfo
  43. */
  44. const char bfin_board_name[] = "Bluetechnix CM BF561";
  45. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  46. /* all SPI peripherals info goes here */
  47. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  48. static struct mtd_partition bfin_spi_flash_partitions[] = {
  49. {
  50. .name = "bootloader",
  51. .size = 0x00020000,
  52. .offset = 0,
  53. .mask_flags = MTD_CAP_ROM
  54. }, {
  55. .name = "kernel",
  56. .size = 0xe0000,
  57. .offset = 0x20000
  58. }, {
  59. .name = "file system",
  60. .size = 0x700000,
  61. .offset = 0x00100000,
  62. }
  63. };
  64. static struct flash_platform_data bfin_spi_flash_data = {
  65. .name = "m25p80",
  66. .parts = bfin_spi_flash_partitions,
  67. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  68. .type = "m25p64",
  69. };
  70. /* SPI flash chip (m25p64) */
  71. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  72. .enable_dma = 0, /* use dma transfer with this chip*/
  73. .bits_per_word = 8,
  74. };
  75. #endif
  76. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  77. /* SPI ADC chip */
  78. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  79. .enable_dma = 1, /* use dma transfer with this chip*/
  80. .bits_per_word = 16,
  81. };
  82. #endif
  83. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  84. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  85. .enable_dma = 0,
  86. .bits_per_word = 16,
  87. };
  88. #endif
  89. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  90. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  91. .enable_dma = 0,
  92. .bits_per_word = 16,
  93. };
  94. #endif
  95. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  96. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  97. .enable_dma = 1,
  98. .bits_per_word = 8,
  99. };
  100. #endif
  101. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  102. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  103. {
  104. /* the modalias must be the same as spi device driver name */
  105. .modalias = "m25p80", /* Name of spi_driver for this device */
  106. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  107. .bus_num = 0, /* Framework bus number */
  108. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  109. .platform_data = &bfin_spi_flash_data,
  110. .controller_data = &spi_flash_chip_info,
  111. .mode = SPI_MODE_3,
  112. },
  113. #endif
  114. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  115. {
  116. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  117. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  118. .bus_num = 0, /* Framework bus number */
  119. .chip_select = 1, /* Framework chip select. */
  120. .platform_data = NULL, /* No spi_driver specific config */
  121. .controller_data = &spi_adc_chip_info,
  122. },
  123. #endif
  124. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  125. {
  126. .modalias = "ad1836-spi",
  127. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  128. .bus_num = 0,
  129. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  130. .controller_data = &ad1836_spi_chip_info,
  131. },
  132. #endif
  133. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  134. {
  135. .modalias = "ad9960-spi",
  136. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  137. .bus_num = 0,
  138. .chip_select = 1,
  139. .controller_data = &ad9960_spi_chip_info,
  140. },
  141. #endif
  142. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  143. {
  144. .modalias = "spi_mmc",
  145. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  146. .bus_num = 0,
  147. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  148. .platform_data = NULL,
  149. .controller_data = &spi_mmc_chip_info,
  150. .mode = SPI_MODE_3,
  151. },
  152. #endif
  153. };
  154. /* SPI (0) */
  155. static struct resource bfin_spi0_resource[] = {
  156. [0] = {
  157. .start = SPI0_REGBASE,
  158. .end = SPI0_REGBASE + 0xFF,
  159. .flags = IORESOURCE_MEM,
  160. },
  161. [1] = {
  162. .start = CH_SPI,
  163. .end = CH_SPI,
  164. .flags = IORESOURCE_IRQ,
  165. }
  166. };
  167. /* SPI controller data */
  168. static struct bfin5xx_spi_master bfin_spi0_info = {
  169. .num_chipselect = 8,
  170. .enable_dma = 1, /* master has the ability to do dma transfer */
  171. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  172. };
  173. static struct platform_device bfin_spi0_device = {
  174. .name = "bfin-spi",
  175. .id = 0, /* Bus number */
  176. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  177. .resource = bfin_spi0_resource,
  178. .dev = {
  179. .platform_data = &bfin_spi0_info, /* Passed to driver */
  180. },
  181. };
  182. #endif /* spi master and devices */
  183. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  184. static struct resource smc91x_resources[] = {
  185. {
  186. .name = "smc91x-regs",
  187. .start = 0x28000300,
  188. .end = 0x28000300 + 16,
  189. .flags = IORESOURCE_MEM,
  190. }, {
  191. .start = IRQ_PF0,
  192. .end = IRQ_PF0,
  193. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  194. },
  195. };
  196. static struct platform_device smc91x_device = {
  197. .name = "smc91x",
  198. .id = 0,
  199. .num_resources = ARRAY_SIZE(smc91x_resources),
  200. .resource = smc91x_resources,
  201. };
  202. #endif
  203. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  204. static struct resource isp1362_hcd_resources[] = {
  205. {
  206. .start = 0x24008000,
  207. .end = 0x24008000,
  208. .flags = IORESOURCE_MEM,
  209. }, {
  210. .start = 0x24008004,
  211. .end = 0x24008004,
  212. .flags = IORESOURCE_MEM,
  213. }, {
  214. .start = IRQ_PF47,
  215. .end = IRQ_PF47,
  216. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  217. },
  218. };
  219. static struct isp1362_platform_data isp1362_priv = {
  220. .sel15Kres = 1,
  221. .clknotstop = 0,
  222. .oc_enable = 0,
  223. .int_act_high = 0,
  224. .int_edge_triggered = 0,
  225. .remote_wakeup_connected = 0,
  226. .no_power_switching = 1,
  227. .power_switching_mode = 0,
  228. };
  229. static struct platform_device isp1362_hcd_device = {
  230. .name = "isp1362-hcd",
  231. .id = 0,
  232. .dev = {
  233. .platform_data = &isp1362_priv,
  234. },
  235. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  236. .resource = isp1362_hcd_resources,
  237. };
  238. #endif
  239. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  240. static struct resource bfin_uart_resources[] = {
  241. {
  242. .start = 0xFFC00400,
  243. .end = 0xFFC004FF,
  244. .flags = IORESOURCE_MEM,
  245. },
  246. };
  247. static struct platform_device bfin_uart_device = {
  248. .name = "bfin-uart",
  249. .id = 1,
  250. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  251. .resource = bfin_uart_resources,
  252. };
  253. #endif
  254. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  255. #define PATA_INT 119
  256. static struct pata_platform_info bfin_pata_platform_data = {
  257. .ioport_shift = 2,
  258. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  259. };
  260. static struct resource bfin_pata_resources[] = {
  261. {
  262. .start = 0x2400C000,
  263. .end = 0x2400C001F,
  264. .flags = IORESOURCE_MEM,
  265. },
  266. {
  267. .start = 0x2400D018,
  268. .end = 0x2400D01B,
  269. .flags = IORESOURCE_MEM,
  270. },
  271. {
  272. .start = PATA_INT,
  273. .end = PATA_INT,
  274. .flags = IORESOURCE_IRQ,
  275. },
  276. };
  277. static struct platform_device bfin_pata_device = {
  278. .name = "pata_platform",
  279. .id = -1,
  280. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  281. .resource = bfin_pata_resources,
  282. .dev = {
  283. .platform_data = &bfin_pata_platform_data,
  284. }
  285. };
  286. #endif
  287. static struct platform_device *cm_bf561_devices[] __initdata = {
  288. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  289. &bfin_uart_device,
  290. #endif
  291. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  292. &isp1362_hcd_device,
  293. #endif
  294. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  295. &smc91x_device,
  296. #endif
  297. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  298. &bfin_spi0_device,
  299. #endif
  300. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  301. &bfin_pata_device,
  302. #endif
  303. };
  304. static int __init cm_bf561_init(void)
  305. {
  306. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  307. platform_add_devices(cm_bf561_devices, ARRAY_SIZE(cm_bf561_devices));
  308. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  309. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  310. #endif
  311. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  312. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  313. #endif
  314. return 0;
  315. }
  316. arch_initcall(cm_bf561_init);