ezkit.c 7.9 KB

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