xilinx.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. d) Xilinx IP cores
  2. The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
  3. in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range
  4. of standard device types (network, serial, etc.) and miscellaneous
  5. devices (gpio, LCD, spi, etc). Also, since these devices are
  6. implemented within the fpga fabric every instance of the device can be
  7. synthesised with different options that change the behaviour.
  8. Each IP-core has a set of parameters which the FPGA designer can use to
  9. control how the core is synthesized. Historically, the EDK tool would
  10. extract the device parameters relevant to device drivers and copy them
  11. into an 'xparameters.h' in the form of #define symbols. This tells the
  12. device drivers how the IP cores are configured, but it requires the kernel
  13. to be recompiled every time the FPGA bitstream is resynthesized.
  14. The new approach is to export the parameters into the device tree and
  15. generate a new device tree each time the FPGA bitstream changes. The
  16. parameters which used to be exported as #defines will now become
  17. properties of the device node. In general, device nodes for IP-cores
  18. will take the following form:
  19. (name): (generic-name)@(base-address) {
  20. compatible = "xlnx,(ip-core-name)-(HW_VER)"
  21. [, (list of compatible devices), ...];
  22. reg = <(baseaddr) (size)>;
  23. interrupt-parent = <&interrupt-controller-phandle>;
  24. interrupts = < ... >;
  25. xlnx,(parameter1) = "(string-value)";
  26. xlnx,(parameter2) = <(int-value)>;
  27. };
  28. (generic-name): an open firmware-style name that describes the
  29. generic class of device. Preferably, this is one word, such
  30. as 'serial' or 'ethernet'.
  31. (ip-core-name): the name of the ip block (given after the BEGIN
  32. directive in system.mhs). Should be in lowercase
  33. and all underscores '_' converted to dashes '-'.
  34. (name): is derived from the "PARAMETER INSTANCE" value.
  35. (parameter#): C_* parameters from system.mhs. The C_ prefix is
  36. dropped from the parameter name, the name is converted
  37. to lowercase and all underscore '_' characters are
  38. converted to dashes '-'.
  39. (baseaddr): the baseaddr parameter value (often named C_BASEADDR).
  40. (HW_VER): from the HW_VER parameter.
  41. (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1).
  42. Typically, the compatible list will include the exact IP core version
  43. followed by an older IP core version which implements the same
  44. interface or any other device with the same interface.
  45. 'reg', 'interrupt-parent' and 'interrupts' are all optional properties.
  46. For example, the following block from system.mhs:
  47. BEGIN opb_uartlite
  48. PARAMETER INSTANCE = opb_uartlite_0
  49. PARAMETER HW_VER = 1.00.b
  50. PARAMETER C_BAUDRATE = 115200
  51. PARAMETER C_DATA_BITS = 8
  52. PARAMETER C_ODD_PARITY = 0
  53. PARAMETER C_USE_PARITY = 0
  54. PARAMETER C_CLK_FREQ = 50000000
  55. PARAMETER C_BASEADDR = 0xEC100000
  56. PARAMETER C_HIGHADDR = 0xEC10FFFF
  57. BUS_INTERFACE SOPB = opb_7
  58. PORT OPB_Clk = CLK_50MHz
  59. PORT Interrupt = opb_uartlite_0_Interrupt
  60. PORT RX = opb_uartlite_0_RX
  61. PORT TX = opb_uartlite_0_TX
  62. PORT OPB_Rst = sys_bus_reset_0
  63. END
  64. becomes the following device tree node:
  65. opb_uartlite_0: serial@ec100000 {
  66. device_type = "serial";
  67. compatible = "xlnx,opb-uartlite-1.00.b";
  68. reg = <ec100000 10000>;
  69. interrupt-parent = <&opb_intc_0>;
  70. interrupts = <1 0>; // got this from the opb_intc parameters
  71. current-speed = <d#115200>; // standard serial device prop
  72. clock-frequency = <d#50000000>; // standard serial device prop
  73. xlnx,data-bits = <8>;
  74. xlnx,odd-parity = <0>;
  75. xlnx,use-parity = <0>;
  76. };
  77. Some IP cores actually implement 2 or more logical devices. In
  78. this case, the device should still describe the whole IP core with
  79. a single node and add a child node for each logical device. The
  80. ranges property can be used to translate from parent IP-core to the
  81. registers of each device. In addition, the parent node should be
  82. compatible with the bus type 'xlnx,compound', and should contain
  83. #address-cells and #size-cells, as with any other bus. (Note: this
  84. makes the assumption that both logical devices have the same bus
  85. binding. If this is not true, then separate nodes should be used
  86. for each logical device). The 'cell-index' property can be used to
  87. enumerate logical devices within an IP core. For example, the
  88. following is the system.mhs entry for the dual ps2 controller found
  89. on the ml403 reference design.
  90. BEGIN opb_ps2_dual_ref
  91. PARAMETER INSTANCE = opb_ps2_dual_ref_0
  92. PARAMETER HW_VER = 1.00.a
  93. PARAMETER C_BASEADDR = 0xA9000000
  94. PARAMETER C_HIGHADDR = 0xA9001FFF
  95. BUS_INTERFACE SOPB = opb_v20_0
  96. PORT Sys_Intr1 = ps2_1_intr
  97. PORT Sys_Intr2 = ps2_2_intr
  98. PORT Clkin1 = ps2_clk_rx_1
  99. PORT Clkin2 = ps2_clk_rx_2
  100. PORT Clkpd1 = ps2_clk_tx_1
  101. PORT Clkpd2 = ps2_clk_tx_2
  102. PORT Rx1 = ps2_d_rx_1
  103. PORT Rx2 = ps2_d_rx_2
  104. PORT Txpd1 = ps2_d_tx_1
  105. PORT Txpd2 = ps2_d_tx_2
  106. END
  107. It would result in the following device tree nodes:
  108. opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 {
  109. #address-cells = <1>;
  110. #size-cells = <1>;
  111. compatible = "xlnx,compound";
  112. ranges = <0 a9000000 2000>;
  113. // If this device had extra parameters, then they would
  114. // go here.
  115. ps2@0 {
  116. compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
  117. reg = <0 40>;
  118. interrupt-parent = <&opb_intc_0>;
  119. interrupts = <3 0>;
  120. cell-index = <0>;
  121. };
  122. ps2@1000 {
  123. compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
  124. reg = <1000 40>;
  125. interrupt-parent = <&opb_intc_0>;
  126. interrupts = <3 0>;
  127. cell-index = <0>;
  128. };
  129. };
  130. Also, the system.mhs file defines bus attachments from the processor
  131. to the devices. The device tree structure should reflect the bus
  132. attachments. Again an example; this system.mhs fragment:
  133. BEGIN ppc405_virtex4
  134. PARAMETER INSTANCE = ppc405_0
  135. PARAMETER HW_VER = 1.01.a
  136. BUS_INTERFACE DPLB = plb_v34_0
  137. BUS_INTERFACE IPLB = plb_v34_0
  138. END
  139. BEGIN opb_intc
  140. PARAMETER INSTANCE = opb_intc_0
  141. PARAMETER HW_VER = 1.00.c
  142. PARAMETER C_BASEADDR = 0xD1000FC0
  143. PARAMETER C_HIGHADDR = 0xD1000FDF
  144. BUS_INTERFACE SOPB = opb_v20_0
  145. END
  146. BEGIN opb_uart16550
  147. PARAMETER INSTANCE = opb_uart16550_0
  148. PARAMETER HW_VER = 1.00.d
  149. PARAMETER C_BASEADDR = 0xa0000000
  150. PARAMETER C_HIGHADDR = 0xa0001FFF
  151. BUS_INTERFACE SOPB = opb_v20_0
  152. END
  153. BEGIN plb_v34
  154. PARAMETER INSTANCE = plb_v34_0
  155. PARAMETER HW_VER = 1.02.a
  156. END
  157. BEGIN plb_bram_if_cntlr
  158. PARAMETER INSTANCE = plb_bram_if_cntlr_0
  159. PARAMETER HW_VER = 1.00.b
  160. PARAMETER C_BASEADDR = 0xFFFF0000
  161. PARAMETER C_HIGHADDR = 0xFFFFFFFF
  162. BUS_INTERFACE SPLB = plb_v34_0
  163. END
  164. BEGIN plb2opb_bridge
  165. PARAMETER INSTANCE = plb2opb_bridge_0
  166. PARAMETER HW_VER = 1.01.a
  167. PARAMETER C_RNG0_BASEADDR = 0x20000000
  168. PARAMETER C_RNG0_HIGHADDR = 0x3FFFFFFF
  169. PARAMETER C_RNG1_BASEADDR = 0x60000000
  170. PARAMETER C_RNG1_HIGHADDR = 0x7FFFFFFF
  171. PARAMETER C_RNG2_BASEADDR = 0x80000000
  172. PARAMETER C_RNG2_HIGHADDR = 0xBFFFFFFF
  173. PARAMETER C_RNG3_BASEADDR = 0xC0000000
  174. PARAMETER C_RNG3_HIGHADDR = 0xDFFFFFFF
  175. BUS_INTERFACE SPLB = plb_v34_0
  176. BUS_INTERFACE MOPB = opb_v20_0
  177. END
  178. Gives this device tree (some properties removed for clarity):
  179. plb@0 {
  180. #address-cells = <1>;
  181. #size-cells = <1>;
  182. compatible = "xlnx,plb-v34-1.02.a";
  183. device_type = "ibm,plb";
  184. ranges; // 1:1 translation
  185. plb_bram_if_cntrl_0: bram@ffff0000 {
  186. reg = <ffff0000 10000>;
  187. }
  188. opb@20000000 {
  189. #address-cells = <1>;
  190. #size-cells = <1>;
  191. ranges = <20000000 20000000 20000000
  192. 60000000 60000000 20000000
  193. 80000000 80000000 40000000
  194. c0000000 c0000000 20000000>;
  195. opb_uart16550_0: serial@a0000000 {
  196. reg = <a00000000 2000>;
  197. };
  198. opb_intc_0: interrupt-controller@d1000fc0 {
  199. reg = <d1000fc0 20>;
  200. };
  201. };
  202. };
  203. That covers the general approach to binding xilinx IP cores into the
  204. device tree. The following are bindings for specific devices:
  205. i) Xilinx ML300 Framebuffer
  206. Simple framebuffer device from the ML300 reference design (also on the
  207. ML403 reference design as well as others).
  208. Optional properties:
  209. - resolution = <xres yres> : pixel resolution of framebuffer. Some
  210. implementations use a different resolution.
  211. Default is <d#640 d#480>
  212. - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
  213. Default is <d#1024 d#480>.
  214. - rotate-display (empty) : rotate display 180 degrees.
  215. ii) Xilinx SystemACE
  216. The Xilinx SystemACE device is used to program FPGAs from an FPGA
  217. bitstream stored on a CF card. It can also be used as a generic CF
  218. interface device.
  219. Optional properties:
  220. - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
  221. iii) Xilinx EMAC and Xilinx TEMAC
  222. Xilinx Ethernet devices. In addition to general xilinx properties
  223. listed above, nodes for these devices should include a phy-handle
  224. property, and may include other common network device properties
  225. like local-mac-address.
  226. iv) Xilinx Uartlite
  227. Xilinx uartlite devices are simple fixed speed serial ports.
  228. Required properties:
  229. - current-speed : Baud rate of uartlite
  230. v) Xilinx hwicap
  231. Xilinx hwicap devices provide access to the configuration logic
  232. of the FPGA through the Internal Configuration Access Port
  233. (ICAP). The ICAP enables partial reconfiguration of the FPGA,
  234. readback of the configuration information, and some control over
  235. 'warm boots' of the FPGA fabric.
  236. Required properties:
  237. - xlnx,family : The family of the FPGA, necessary since the
  238. capabilities of the underlying ICAP hardware
  239. differ between different families. May be
  240. 'virtex2p', 'virtex4', or 'virtex5'.
  241. vi) Xilinx Uart 16550
  242. Xilinx UART 16550 devices are very similar to the NS16550 but with
  243. different register spacing and an offset from the base address.
  244. Required properties:
  245. - clock-frequency : Frequency of the clock input
  246. - reg-offset : A value of 3 is required
  247. - reg-shift : A value of 2 is required
  248. vii) Xilinx USB Host controller
  249. The Xilinx USB host controller is EHCI compatible but with a different
  250. base address for the EHCI registers, and it is always a big-endian
  251. USB Host controller. The hardware can be configured as high speed only,
  252. or high speed/full speed hybrid.
  253. Required properties:
  254. - xlnx,support-usb-fs: A value 0 means the core is built as high speed
  255. only. A value 1 means the core also supports
  256. full speed devices.