synchronousMemoryDatabase.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/etherdevice.h>
  10. #include <linux/export.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <linux/spi/spi.h>
  15. #include <linux/spi/flash.h>
  16. #include <linux/irq.h>
  17. #include <asm/dma.h>
  18. #include <asm/bfin5xx_spi.h>
  19. #include <asm/portmux.h>
  20. #include <linux/spi/ad7877.h>
  21. /*
  22. * Name the Board for the /proc/cpuinfo
  23. */
  24. const char bfin_board_name[] = "ADI PNAV-1.0";
  25. /*
  26. * Driver needs to know address, irq and flag pin.
  27. */
  28. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  29. static struct resource bfin_pcmcia_cf_resources[] = {
  30. {
  31. .start = 0x20310000, /* IO PORT */
  32. .end = 0x20312000,
  33. .flags = IORESOURCE_MEM,
  34. }, {
  35. .start = 0x20311000, /* Attribute Memory */
  36. .end = 0x20311FFF,
  37. .flags = IORESOURCE_MEM,
  38. }, {
  39. .start = IRQ_PF4,
  40. .end = IRQ_PF4,
  41. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  42. }, {
  43. .start = 6, /* Card Detect PF6 */
  44. .end = 6,
  45. .flags = IORESOURCE_IRQ,
  46. },
  47. };
  48. static struct platform_device bfin_pcmcia_cf_device = {
  49. .name = "bfin_cf_pcmcia",
  50. .id = -1,
  51. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  52. .resource = bfin_pcmcia_cf_resources,
  53. };
  54. #endif
  55. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  56. static struct platform_device rtc_device = {
  57. .name = "rtc-bfin",
  58. .id = -1,
  59. };
  60. #endif
  61. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  62. #include <linux/smc91x.h>
  63. static struct smc91x_platdata smc91x_info = {
  64. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  65. .leda = RPC_LED_100_10,
  66. .ledb = RPC_LED_TX_RX,
  67. };
  68. static struct resource smc91x_resources[] = {
  69. {
  70. .name = "smc91x-regs",
  71. .start = 0x20300300,
  72. .end = 0x20300300 + 16,
  73. .flags = IORESOURCE_MEM,
  74. }, {
  75. .start = IRQ_PF7,
  76. .end = IRQ_PF7,
  77. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  78. },
  79. };
  80. static struct platform_device smc91x_device = {
  81. .name = "smc91x",
  82. .id = 0,
  83. .num_resources = ARRAY_SIZE(smc91x_resources),
  84. .resource = smc91x_resources,
  85. .dev = {
  86. .platform_data = &smc91x_info,
  87. },
  88. };
  89. #endif
  90. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  91. #include <linux/bfin_mac.h>
  92. static const unsigned short bfin_mac_peripherals[] = P_RMII0;
  93. static struct bfin_phydev_platform_data bfin_phydev_data[] = {
  94. {
  95. .addr = 1,
  96. .irq = IRQ_MAC_PHYINT,
  97. },
  98. };
  99. static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
  100. .phydev_number = 1,
  101. .phydev_data = bfin_phydev_data,
  102. .phy_mode = PHY_INTERFACE_MODE_RMII,
  103. .mac_peripherals = bfin_mac_peripherals,
  104. };
  105. static struct platform_device bfin_mii_bus = {
  106. .name = "bfin_mii_bus",
  107. .dev = {
  108. .platform_data = &bfin_mii_bus_data,
  109. }
  110. };
  111. static struct platform_device bfin_mac_device = {
  112. .name = "bfin_mac",
  113. .dev = {
  114. .platform_data = &bfin_mii_bus,
  115. }
  116. };
  117. #endif
  118. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  119. static struct resource net2272_bfin_resources[] = {
  120. {
  121. .start = 0x20300000,
  122. .end = 0x20300000 + 0x100,
  123. .flags = IORESOURCE_MEM,
  124. }, {
  125. .start = IRQ_PF7,
  126. .end = IRQ_PF7,
  127. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  128. },
  129. };
  130. static struct platform_device net2272_bfin_device = {
  131. .name = "net2272",
  132. .id = -1,
  133. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  134. .resource = net2272_bfin_resources,
  135. };
  136. #endif
  137. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  138. /* all SPI peripherals info goes here */
  139. #if defined(CONFIG_MTD_M25P80) \
  140. || defined(CONFIG_MTD_M25P80_MODULE)
  141. static struct mtd_partition bfin_spi_flash_partitions[] = {
  142. {
  143. .name = "bootloader(spi)",
  144. .size = 0x00020000,
  145. .offset = 0,
  146. .mask_flags = MTD_CAP_ROM
  147. }, {
  148. .name = "linux kernel(spi)",
  149. .size = 0xe0000,
  150. .offset = 0x20000
  151. }, {
  152. .name = "file system(spi)",
  153. .size = 0x700000,
  154. .offset = 0x00100000,
  155. }
  156. };
  157. static struct flash_platform_data bfin_spi_flash_data = {
  158. .name = "m25p80",
  159. .parts = bfin_spi_flash_partitions,
  160. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  161. .type = "m25p64",
  162. };
  163. /* SPI flash chip (m25p64) */
  164. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  165. .enable_dma = 0, /* use dma transfer with this chip*/
  166. };
  167. #endif
  168. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  169. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  170. .enable_dma = 0,
  171. };
  172. #endif
  173. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  174. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  175. .model = 7877,
  176. .vref_delay_usecs = 50, /* internal, no capacitor */
  177. .x_plate_ohms = 419,
  178. .y_plate_ohms = 486,
  179. .pressure_max = 1000,
  180. .pressure_min = 0,
  181. .stopacq_polarity = 1,
  182. .first_conversion_delay = 3,
  183. .acquisition_time = 1,
  184. .averaging = 1,
  185. .pen_down_acc_interval = 1,
  186. };
  187. #endif
  188. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  189. #if defined(CONFIG_MTD_M25P80) \
  190. || defined(CONFIG_MTD_M25P80_MODULE)
  191. {
  192. /* the modalias must be the same as spi device driver name */
  193. .modalias = "m25p80", /* Name of spi_driver for this device */
  194. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  195. .bus_num = 0, /* Framework bus number */
  196. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  197. .platform_data = &bfin_spi_flash_data,
  198. .controller_data = &spi_flash_chip_info,
  199. .mode = SPI_MODE_3,
  200. },
  201. #endif
  202. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  203. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  204. {
  205. .modalias = "ad183x",
  206. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  207. .bus_num = 0,
  208. .chip_select = 4,
  209. },
  210. #endif
  211. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  212. {
  213. .modalias = "mmc_spi",
  214. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  215. .bus_num = 0,
  216. .chip_select = 5,
  217. .controller_data = &mmc_spi_chip_info,
  218. .mode = SPI_MODE_3,
  219. },
  220. #endif