H8606.c 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /*
  2. * File: arch/blackfin/mach-bf533/H8606.c
  3. * Based on: arch/blackfin/mach-bf533/stamp.c
  4. * Author: Javier Herrero <jherrero@hvsistemas.es>
  5. *
  6. * Created: 2007
  7. * Description: Board Info File for the HV Sistemas H8606 board
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2006 Analog Devices Inc
  12. * Copyright 2007 HV Sistemas S.L.
  13. *
  14. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, see the file COPYING, or write
  28. * to the Free Software Foundation, Inc.,
  29. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  30. */
  31. #include <linux/device.h>
  32. #include <linux/platform_device.h>
  33. #include <linux/mtd/mtd.h>
  34. #include <linux/mtd/partitions.h>
  35. #include <linux/spi/spi.h>
  36. #include <linux/spi/flash.h>
  37. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  38. #include <linux/usb_isp1362.h>
  39. #endif
  40. #include <linux/pata_platform.h>
  41. #include <linux/irq.h>
  42. #include <asm/dma.h>
  43. #include <asm/bfin5xx_spi.h>
  44. #include <asm/reboot.h>
  45. /*
  46. * Name the Board for the /proc/cpuinfo
  47. */
  48. const char bfin_board_name[] = "HV Sistemas H8606";
  49. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_BFIN_MODULE)
  50. static struct platform_device rtc_device = {
  51. .name = "rtc-bfin",
  52. .id = -1,
  53. };
  54. #endif
  55. /*
  56. * Driver needs to know address, irq and flag pin.
  57. */
  58. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  59. static struct resource dm9000_resources[] = {
  60. [0] = {
  61. .start = 0x20300000,
  62. .end = 0x20300000 + 8,
  63. .flags = IORESOURCE_MEM,
  64. },
  65. [1] = {
  66. .start = IRQ_PF10,
  67. .end = IRQ_PF10,
  68. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  69. },
  70. };
  71. static struct platform_device dm9000_device = {
  72. .id = 0,
  73. .name = "dm9000",
  74. .resource = dm9000_resources,
  75. .num_resources = ARRAY_SIZE(dm9000_resources),
  76. };
  77. #endif
  78. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  79. static struct resource smc91x_resources[] = {
  80. {
  81. .name = "smc91x-regs",
  82. .start = 0x20300300,
  83. .end = 0x20300300 + 16,
  84. .flags = IORESOURCE_MEM,
  85. }, {
  86. .start = IRQ_PROG_INTB,
  87. .end = IRQ_PROG_INTB,
  88. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  89. }, {
  90. /*
  91. * denotes the flag pin and is used directly if
  92. * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
  93. */
  94. .start = IRQ_PF7,
  95. .end = IRQ_PF7,
  96. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  97. },
  98. };
  99. static struct platform_device smc91x_device = {
  100. .name = "smc91x",
  101. .id = 0,
  102. .num_resources = ARRAY_SIZE(smc91x_resources),
  103. .resource = smc91x_resources,
  104. };
  105. #endif
  106. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  107. static struct resource net2272_bfin_resources[] = {
  108. {
  109. .start = 0x20300000,
  110. .end = 0x20300000 + 0x100,
  111. .flags = IORESOURCE_MEM,
  112. }, {
  113. .start = IRQ_PF10,
  114. .end = IRQ_PF10,
  115. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  116. },
  117. };
  118. static struct platform_device net2272_bfin_device = {
  119. .name = "net2272",
  120. .id = -1,
  121. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  122. .resource = net2272_bfin_resources,
  123. };
  124. #endif
  125. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  126. /* all SPI peripherals info goes here */
  127. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  128. static struct mtd_partition bfin_spi_flash_partitions[] = {
  129. {
  130. .name = "bootloader",
  131. .size = 0x00060000,
  132. .offset = 0,
  133. .mask_flags = MTD_CAP_ROM
  134. }, {
  135. .name = "kernel",
  136. .size = 0x100000,
  137. .offset = 0x60000
  138. }, {
  139. .name = "file system",
  140. .size = 0x6a0000,
  141. .offset = 0x00160000,
  142. }
  143. };
  144. static struct flash_platform_data bfin_spi_flash_data = {
  145. .name = "m25p80",
  146. .parts = bfin_spi_flash_partitions,
  147. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  148. .type = "m25p64",
  149. };
  150. /* SPI flash chip (m25p64) */
  151. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  152. .enable_dma = 0, /* use dma transfer with this chip*/
  153. .bits_per_word = 8,
  154. };
  155. #endif
  156. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  157. /* SPI ADC chip */
  158. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  159. .ctl_reg = 0x1000,
  160. .enable_dma = 1, /* use dma transfer with this chip*/
  161. .bits_per_word = 16,
  162. };
  163. #endif
  164. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  165. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  166. .ctl_reg = 0x1000,
  167. .enable_dma = 0,
  168. .bits_per_word = 16,
  169. };
  170. #endif
  171. #if defined(CONFIG_PBX)
  172. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  173. .ctl_reg = 0x1c04,
  174. .enable_dma = 0,
  175. .bits_per_word = 8,
  176. .cs_change_per_word = 1,
  177. };
  178. #endif
  179. /* Notice: for blackfin, the speed_hz is the value of register
  180. * SPI_BAUD, not the real baudrate */
  181. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  182. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  183. {
  184. /* the modalias must be the same as spi device driver name */
  185. .modalias = "m25p80", /* Name of spi_driver for this device */
  186. /* this value is the baudrate divisor */
  187. .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
  188. .bus_num = 0, /* Framework bus number */
  189. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  190. .platform_data = &bfin_spi_flash_data,
  191. .controller_data = &spi_flash_chip_info,
  192. .mode = SPI_MODE_3,
  193. },
  194. #endif
  195. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  196. {
  197. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  198. .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
  199. .bus_num = 1, /* Framework bus number */
  200. .chip_select = 1, /* Framework chip select. */
  201. .platform_data = NULL, /* No spi_driver specific config */
  202. .controller_data = &spi_adc_chip_info,
  203. },
  204. #endif
  205. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  206. {
  207. .modalias = "ad1836-spi",
  208. .max_speed_hz = 16,
  209. .bus_num = 1,
  210. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  211. .controller_data = &ad1836_spi_chip_info,
  212. },
  213. #endif
  214. #if defined(CONFIG_PBX)
  215. {
  216. .modalias = "fxs-spi",
  217. .max_speed_hz = 4,
  218. .bus_num = 1,
  219. .chip_select = 3,
  220. .controller_data = &spi_si3xxx_chip_info,
  221. },
  222. {
  223. .modalias = "fxo-spi",
  224. .max_speed_hz = 4,
  225. .bus_num = 1,
  226. .chip_select = 2,
  227. .controller_data = &spi_si3xxx_chip_info,
  228. },
  229. #endif
  230. };
  231. /* SPI (0) */
  232. static struct resource bfin_spi0_resource[] = {
  233. [0] = {
  234. .start = SPI0_REGBASE,
  235. .end = SPI0_REGBASE + 0xFF,
  236. .flags = IORESOURCE_MEM,
  237. },
  238. [1] = {
  239. .start = CH_SPI,
  240. .end = CH_SPI,
  241. .flags = IORESOURCE_IRQ,
  242. }
  243. };
  244. /* SPI controller data */
  245. static struct bfin5xx_spi_master bfin_spi0_info = {
  246. .num_chipselect = 8,
  247. .enable_dma = 1, /* master has the ability to do dma transfer */
  248. };
  249. static struct platform_device bfin_spi0_device = {
  250. .name = "bfin-spi",
  251. .id = 0, /* Bus number */
  252. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  253. .resource = bfin_spi0_resource,
  254. .dev = {
  255. .platform_data = &bfin_spi0_info, /* Passed to driver */
  256. },
  257. };
  258. #endif /* spi master and devices */
  259. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  260. static struct platform_device bfin_fb_device = {
  261. .name = "bf537-fb",
  262. };
  263. #endif
  264. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  265. static struct resource bfin_uart_resources[] = {
  266. {
  267. .start = 0xFFC00400,
  268. .end = 0xFFC004FF,
  269. .flags = IORESOURCE_MEM,
  270. },
  271. };
  272. static struct platform_device bfin_uart_device = {
  273. .name = "bfin-uart",
  274. .id = 1,
  275. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  276. .resource = bfin_uart_resources,
  277. };
  278. #endif
  279. static struct platform_device *stamp_devices[] __initdata = {
  280. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  281. &rtc_device,
  282. #endif
  283. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  284. &dm9000_device,
  285. #endif
  286. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  287. &smc91x_device,
  288. #endif
  289. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  290. &net2272_bfin_device,
  291. #endif
  292. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  293. &bfin_spi0_device,
  294. #endif
  295. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  296. &bfin_uart_device,
  297. #endif
  298. };
  299. static int __init H8606_init(void)
  300. {
  301. printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
  302. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  303. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  304. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  305. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  306. #endif
  307. return 0;
  308. }
  309. arch_initcall(H8606_init);