ezkit.c 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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/pata_platform.h>
  38. #include <linux/irq.h>
  39. #include <asm/dma.h>
  40. #include <asm/bfin5xx_spi.h>
  41. /*
  42. * Name the Board for the /proc/cpuinfo
  43. */
  44. char *bfin_board_name = "ADDS-BF533-EZKIT";
  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. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  52. static struct platform_device bfin_fb_adv7393_device = {
  53. .name = "bfin-adv7393",
  54. };
  55. #endif
  56. /*
  57. * USB-LAN EzExtender board
  58. * Driver needs to know address, irq and flag pin.
  59. */
  60. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  61. static struct resource smc91x_resources[] = {
  62. {
  63. .name = "smc91x-regs",
  64. .start = 0x20310300,
  65. .end = 0x20310300 + 16,
  66. .flags = IORESOURCE_MEM,
  67. }, {
  68. .start = IRQ_PF9,
  69. .end = IRQ_PF9,
  70. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  71. },
  72. };
  73. static struct platform_device smc91x_device = {
  74. .name = "smc91x",
  75. .id = 0,
  76. .num_resources = ARRAY_SIZE(smc91x_resources),
  77. .resource = smc91x_resources,
  78. };
  79. #endif
  80. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  81. /* all SPI peripherals info goes here */
  82. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  83. static struct mtd_partition bfin_spi_flash_partitions[] = {
  84. {
  85. .name = "bootloader",
  86. .size = 0x00020000,
  87. .offset = 0,
  88. .mask_flags = MTD_CAP_ROM
  89. }, {
  90. .name = "kernel",
  91. .size = 0xe0000,
  92. .offset = 0x20000
  93. }, {
  94. .name = "file system",
  95. .size = 0x700000,
  96. .offset = 0x00100000,
  97. }
  98. };
  99. static struct flash_platform_data bfin_spi_flash_data = {
  100. .name = "m25p80",
  101. .parts = bfin_spi_flash_partitions,
  102. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  103. .type = "m25p64",
  104. };
  105. /* SPI flash chip (m25p64) */
  106. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  107. .enable_dma = 0, /* use dma transfer with this chip*/
  108. .bits_per_word = 8,
  109. };
  110. #endif
  111. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  112. /* SPI ADC chip */
  113. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  114. .enable_dma = 1, /* use dma transfer with this chip*/
  115. .bits_per_word = 16,
  116. };
  117. #endif
  118. #if defined(CONFIG_SND_BLACKFIN_AD1836) || 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. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  125. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  126. {
  127. /* the modalias must be the same as spi device driver name */
  128. .modalias = "m25p80", /* Name of spi_driver for this device */
  129. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  130. .bus_num = 0, /* Framework bus number */
  131. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  132. .platform_data = &bfin_spi_flash_data,
  133. .controller_data = &spi_flash_chip_info,
  134. .mode = SPI_MODE_3,
  135. },
  136. #endif
  137. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  138. {
  139. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  140. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  141. .bus_num = 0, /* Framework bus number */
  142. .chip_select = 1, /* Framework chip select. */
  143. .platform_data = NULL, /* No spi_driver specific config */
  144. .controller_data = &spi_adc_chip_info,
  145. },
  146. #endif
  147. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  148. {
  149. .modalias = "ad1836-spi",
  150. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  151. .bus_num = 0,
  152. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  153. .controller_data = &ad1836_spi_chip_info,
  154. },
  155. #endif
  156. };
  157. /* SPI (0) */
  158. static struct resource bfin_spi0_resource[] = {
  159. [0] = {
  160. .start = SPI0_REGBASE,
  161. .end = SPI0_REGBASE + 0xFF,
  162. .flags = IORESOURCE_MEM,
  163. },
  164. [1] = {
  165. .start = CH_SPI,
  166. .end = CH_SPI,
  167. .flags = IORESOURCE_IRQ,
  168. }
  169. };
  170. /* SPI controller data */
  171. static struct bfin5xx_spi_master bfin_spi0_info = {
  172. .num_chipselect = 8,
  173. .enable_dma = 1, /* master has the ability to do dma transfer */
  174. };
  175. static struct platform_device bfin_spi0_device = {
  176. .name = "bfin-spi",
  177. .id = 0, /* Bus number */
  178. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  179. .resource = bfin_spi0_resource,
  180. .dev = {
  181. .platform_data = &bfin_spi0_info, /* Passed to driver */
  182. },
  183. };
  184. #endif /* spi master and devices */
  185. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  186. static struct resource bfin_uart_resources[] = {
  187. {
  188. .start = 0xFFC00400,
  189. .end = 0xFFC004FF,
  190. .flags = IORESOURCE_MEM,
  191. },
  192. };
  193. static struct platform_device bfin_uart_device = {
  194. .name = "bfin-uart",
  195. .id = 1,
  196. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  197. .resource = bfin_uart_resources,
  198. };
  199. #endif
  200. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  201. #define PATA_INT 55
  202. static struct pata_platform_info bfin_pata_platform_data = {
  203. .ioport_shift = 1,
  204. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  205. };
  206. static struct resource bfin_pata_resources[] = {
  207. {
  208. .start = 0x20314020,
  209. .end = 0x2031403F,
  210. .flags = IORESOURCE_MEM,
  211. },
  212. {
  213. .start = 0x2031401C,
  214. .end = 0x2031401F,
  215. .flags = IORESOURCE_MEM,
  216. },
  217. {
  218. .start = PATA_INT,
  219. .end = PATA_INT,
  220. .flags = IORESOURCE_IRQ,
  221. },
  222. };
  223. static struct platform_device bfin_pata_device = {
  224. .name = "pata_platform",
  225. .id = -1,
  226. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  227. .resource = bfin_pata_resources,
  228. .dev = {
  229. .platform_data = &bfin_pata_platform_data,
  230. }
  231. };
  232. #endif
  233. static struct platform_device *ezkit_devices[] __initdata = {
  234. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  235. &smc91x_device,
  236. #endif
  237. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  238. &bfin_spi0_device,
  239. #endif
  240. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  241. &bfin_fb_adv7393_device,
  242. #endif
  243. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  244. &rtc_device,
  245. #endif
  246. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  247. &bfin_uart_device,
  248. #endif
  249. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  250. &bfin_pata_device,
  251. #endif
  252. };
  253. static int __init ezkit_init(void)
  254. {
  255. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  256. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  257. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  258. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  259. #endif
  260. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  261. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  262. #endif
  263. return 0;
  264. }
  265. arch_initcall(ezkit_init);