H8606.c 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. #include <asm/portmux.h>
  46. /*
  47. * Name the Board for the /proc/cpuinfo
  48. */
  49. const char bfin_board_name[] = "HV Sistemas H8606";
  50. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_BFIN_MODULE)
  51. static struct platform_device rtc_device = {
  52. .name = "rtc-bfin",
  53. .id = -1,
  54. };
  55. #endif
  56. /*
  57. * Driver needs to know address, irq and flag pin.
  58. */
  59. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  60. static struct resource dm9000_resources[] = {
  61. [0] = {
  62. .start = 0x20300000,
  63. .end = 0x20300000 + 8,
  64. .flags = IORESOURCE_MEM,
  65. },
  66. [1] = {
  67. .start = IRQ_PF10,
  68. .end = IRQ_PF10,
  69. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  70. },
  71. };
  72. static struct platform_device dm9000_device = {
  73. .id = 0,
  74. .name = "dm9000",
  75. .resource = dm9000_resources,
  76. .num_resources = ARRAY_SIZE(dm9000_resources),
  77. };
  78. #endif
  79. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  80. static struct resource smc91x_resources[] = {
  81. {
  82. .name = "smc91x-regs",
  83. .start = 0x20300300,
  84. .end = 0x20300300 + 16,
  85. .flags = IORESOURCE_MEM,
  86. }, {
  87. .start = IRQ_PROG_INTB,
  88. .end = IRQ_PROG_INTB,
  89. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  90. }, {
  91. /*
  92. * denotes the flag pin and is used directly if
  93. * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
  94. */
  95. .start = IRQ_PF7,
  96. .end = IRQ_PF7,
  97. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  98. },
  99. };
  100. static struct platform_device smc91x_device = {
  101. .name = "smc91x",
  102. .id = 0,
  103. .num_resources = ARRAY_SIZE(smc91x_resources),
  104. .resource = smc91x_resources,
  105. };
  106. #endif
  107. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  108. static struct resource net2272_bfin_resources[] = {
  109. {
  110. .start = 0x20300000,
  111. .end = 0x20300000 + 0x100,
  112. .flags = IORESOURCE_MEM,
  113. }, {
  114. .start = IRQ_PF10,
  115. .end = IRQ_PF10,
  116. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  117. },
  118. };
  119. static struct platform_device net2272_bfin_device = {
  120. .name = "net2272",
  121. .id = -1,
  122. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  123. .resource = net2272_bfin_resources,
  124. };
  125. #endif
  126. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  127. /* all SPI peripherals info goes here */
  128. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  129. static struct mtd_partition bfin_spi_flash_partitions[] = {
  130. {
  131. .name = "bootloader",
  132. .size = 0x00060000,
  133. .offset = 0,
  134. .mask_flags = MTD_CAP_ROM
  135. }, {
  136. .name = "kernel",
  137. .size = 0x100000,
  138. .offset = 0x60000
  139. }, {
  140. .name = "file system",
  141. .size = 0x6a0000,
  142. .offset = 0x00160000,
  143. }
  144. };
  145. static struct flash_platform_data bfin_spi_flash_data = {
  146. .name = "m25p80",
  147. .parts = bfin_spi_flash_partitions,
  148. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  149. .type = "m25p64",
  150. };
  151. /* SPI flash chip (m25p64) */
  152. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  153. .enable_dma = 0, /* use dma transfer with this chip*/
  154. .bits_per_word = 8,
  155. };
  156. #endif
  157. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  158. /* SPI ADC chip */
  159. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  160. .ctl_reg = 0x1000,
  161. .enable_dma = 1, /* use dma transfer with this chip*/
  162. .bits_per_word = 16,
  163. };
  164. #endif
  165. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  166. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  167. .ctl_reg = 0x1000,
  168. .enable_dma = 0,
  169. .bits_per_word = 16,
  170. };
  171. #endif
  172. #if defined(CONFIG_PBX)
  173. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  174. .ctl_reg = 0x1c04,
  175. .enable_dma = 0,
  176. .bits_per_word = 8,
  177. .cs_change_per_word = 1,
  178. };
  179. #endif
  180. /* Notice: for blackfin, the speed_hz is the value of register
  181. * SPI_BAUD, not the real baudrate */
  182. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  183. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  184. {
  185. /* the modalias must be the same as spi device driver name */
  186. .modalias = "m25p80", /* Name of spi_driver for this device */
  187. /* this value is the baudrate divisor */
  188. .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
  189. .bus_num = 0, /* Framework bus number */
  190. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  191. .platform_data = &bfin_spi_flash_data,
  192. .controller_data = &spi_flash_chip_info,
  193. .mode = SPI_MODE_3,
  194. },
  195. #endif
  196. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  197. {
  198. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  199. .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
  200. .bus_num = 1, /* Framework bus number */
  201. .chip_select = 1, /* Framework chip select. */
  202. .platform_data = NULL, /* No spi_driver specific config */
  203. .controller_data = &spi_adc_chip_info,
  204. },
  205. #endif
  206. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  207. {
  208. .modalias = "ad1836-spi",
  209. .max_speed_hz = 16,
  210. .bus_num = 1,
  211. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  212. .controller_data = &ad1836_spi_chip_info,
  213. },
  214. #endif
  215. #if defined(CONFIG_PBX)
  216. {
  217. .modalias = "fxs-spi",
  218. .max_speed_hz = 4,
  219. .bus_num = 1,
  220. .chip_select = 3,
  221. .controller_data = &spi_si3xxx_chip_info,
  222. },
  223. {
  224. .modalias = "fxo-spi",
  225. .max_speed_hz = 4,
  226. .bus_num = 1,
  227. .chip_select = 2,
  228. .controller_data = &spi_si3xxx_chip_info,
  229. },
  230. #endif
  231. };
  232. /* SPI (0) */
  233. static struct resource bfin_spi0_resource[] = {
  234. [0] = {
  235. .start = SPI0_REGBASE,
  236. .end = SPI0_REGBASE + 0xFF,
  237. .flags = IORESOURCE_MEM,
  238. },
  239. [1] = {
  240. .start = CH_SPI,
  241. .end = CH_SPI,
  242. .flags = IORESOURCE_IRQ,
  243. }
  244. };
  245. /* SPI controller data */
  246. static struct bfin5xx_spi_master bfin_spi0_info = {
  247. .num_chipselect = 8,
  248. .enable_dma = 1, /* master has the ability to do dma transfer */
  249. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  250. };
  251. static struct platform_device bfin_spi0_device = {
  252. .name = "bfin-spi",
  253. .id = 0, /* Bus number */
  254. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  255. .resource = bfin_spi0_resource,
  256. .dev = {
  257. .platform_data = &bfin_spi0_info, /* Passed to driver */
  258. },
  259. };
  260. #endif /* spi master and devices */
  261. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  262. static struct platform_device bfin_fb_device = {
  263. .name = "bf537-fb",
  264. };
  265. #endif
  266. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  267. static struct resource bfin_uart_resources[] = {
  268. {
  269. .start = 0xFFC00400,
  270. .end = 0xFFC004FF,
  271. .flags = IORESOURCE_MEM,
  272. },
  273. };
  274. static struct platform_device bfin_uart_device = {
  275. .name = "bfin-uart",
  276. .id = 1,
  277. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  278. .resource = bfin_uart_resources,
  279. };
  280. #endif
  281. static struct platform_device *stamp_devices[] __initdata = {
  282. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  283. &rtc_device,
  284. #endif
  285. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  286. &dm9000_device,
  287. #endif
  288. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  289. &smc91x_device,
  290. #endif
  291. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  292. &net2272_bfin_device,
  293. #endif
  294. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  295. &bfin_spi0_device,
  296. #endif
  297. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  298. &bfin_uart_device,
  299. #endif
  300. };
  301. static int __init H8606_init(void)
  302. {
  303. printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
  304. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  305. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  306. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  307. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  308. #endif
  309. return 0;
  310. }
  311. arch_initcall(H8606_init);