basicAlgorithmEncapsulation.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2008-2009 Cambridge Signal Processing
  4. * 2005 National ICT Australia (NICTA)
  5. * Aidan Williams <aidan@nicta.com.au>
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #include <linux/device.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/mtd/mtd.h>
  12. #include <linux/mtd/partitions.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  16. #include <linux/usb/isp1362.h>
  17. #endif
  18. #include <linux/ata_platform.h>
  19. #include <linux/irq.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/usb/sl811.h>
  22. #include <asm/dma.h>
  23. #include <asm/bfin5xx_spi.h>
  24. #include <asm/reboot.h>
  25. #include <asm/portmux.h>
  26. #include <linux/spi/ad7877.h>
  27. /*
  28. * Name the Board for the /proc/cpuinfo
  29. */
  30. const char bfin_board_name[] = "CamSig Minotaur BF537";
  31. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  32. static struct resource bfin_pcmcia_cf_resources[] = {
  33. {
  34. .start = 0x20310000, /* IO PORT */
  35. .end = 0x20312000,
  36. .flags = IORESOURCE_MEM,
  37. }, {
  38. .start = 0x20311000, /* Attribute Memory */
  39. .end = 0x20311FFF,
  40. .flags = IORESOURCE_MEM,
  41. }, {
  42. .start = IRQ_PF4,
  43. .end = IRQ_PF4,
  44. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  45. }, {
  46. .start = IRQ_PF6, /* Card Detect PF6 */
  47. .end = IRQ_PF6,
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. };
  51. static struct platform_device bfin_pcmcia_cf_device = {
  52. .name = "bfin_cf_pcmcia",
  53. .id = -1,
  54. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  55. .resource = bfin_pcmcia_cf_resources,
  56. };
  57. #endif
  58. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  59. static struct platform_device rtc_device = {
  60. .name = "rtc-bfin",
  61. .id = -1,
  62. };
  63. #endif
  64. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  65. #include <linux/bfin_mac.h>
  66. static const unsigned short bfin_mac_peripherals[] = P_MII0;
  67. static struct bfin_phydev_platform_data bfin_phydev_data[] = {
  68. {
  69. .addr = 1,
  70. .irq = IRQ_MAC_PHYINT,
  71. },
  72. };
  73. static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
  74. .phydev_number = 1,
  75. .phydev_data = bfin_phydev_data,
  76. .phy_mode = PHY_INTERFACE_MODE_MII,
  77. .mac_peripherals = bfin_mac_peripherals,
  78. };
  79. static struct platform_device bfin_mii_bus = {
  80. .name = "bfin_mii_bus",
  81. .dev = {
  82. .platform_data = &bfin_mii_bus_data,
  83. }
  84. };
  85. static struct platform_device bfin_mac_device = {
  86. .name = "bfin_mac",
  87. .dev = {
  88. .platform_data = &bfin_mii_bus,
  89. }
  90. };
  91. #endif
  92. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  93. static struct resource net2272_bfin_resources[] = {
  94. {
  95. .start = 0x20300000,
  96. .end = 0x20300000 + 0x100,
  97. .flags = IORESOURCE_MEM,
  98. }, {
  99. .start = IRQ_PF7,
  100. .end = IRQ_PF7,
  101. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  102. },
  103. };
  104. static struct platform_device net2272_bfin_device = {
  105. .name = "net2272",
  106. .id = -1,
  107. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  108. .resource = net2272_bfin_resources,
  109. };
  110. #endif
  111. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  112. /* all SPI peripherals info goes here */
  113. #if defined(CONFIG_MTD_M25P80) \
  114. || defined(CONFIG_MTD_M25P80_MODULE)
  115. /* Partition sizes */
  116. #define FLASH_SIZE 0x00400000
  117. #define PSIZE_UBOOT 0x00030000
  118. #define PSIZE_INITRAMFS 0x00240000
  119. static struct mtd_partition bfin_spi_flash_partitions[] = {
  120. {
  121. .name = "bootloader(spi)",
  122. .size = PSIZE_UBOOT,
  123. .offset = 0x000000,
  124. .mask_flags = MTD_CAP_ROM
  125. }, {
  126. .name = "initramfs(spi)",
  127. .size = PSIZE_INITRAMFS,
  128. .offset = PSIZE_UBOOT
  129. }, {
  130. .name = "opt(spi)",
  131. .size = FLASH_SIZE - (PSIZE_UBOOT + PSIZE_INITRAMFS),
  132. .offset = PSIZE_UBOOT + PSIZE_INITRAMFS,
  133. }
  134. };
  135. static struct flash_platform_data bfin_spi_flash_data = {
  136. .name = "m25p80",
  137. .parts = bfin_spi_flash_partitions,
  138. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  139. .type = "m25p64",
  140. };
  141. /* SPI flash chip (m25p64) */
  142. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  143. .enable_dma = 0, /* use dma transfer with this chip*/
  144. };
  145. #endif
  146. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  147. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  148. .enable_dma = 0,
  149. };
  150. #endif
  151. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  152. #if defined(CONFIG_MTD_M25P80) \
  153. || defined(CONFIG_MTD_M25P80_MODULE)
  154. {
  155. /* the modalias must be the same as spi device driver name */
  156. .modalias = "m25p80", /* Name of spi_driver for this device */
  157. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  158. .bus_num = 0, /* Framework bus number */
  159. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/