18c2ecf20Sopenharmony_ci   d) Xilinx IP cores
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci   The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
48c2ecf20Sopenharmony_ci   in Xilinx Spartan and Virtex FPGAs.  The devices cover the whole range
58c2ecf20Sopenharmony_ci   of standard device types (network, serial, etc.) and miscellaneous
68c2ecf20Sopenharmony_ci   devices (gpio, LCD, spi, etc).  Also, since these devices are
78c2ecf20Sopenharmony_ci   implemented within the fpga fabric every instance of the device can be
88c2ecf20Sopenharmony_ci   synthesised with different options that change the behaviour.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci   Each IP-core has a set of parameters which the FPGA designer can use to
118c2ecf20Sopenharmony_ci   control how the core is synthesized.  Historically, the EDK tool would
128c2ecf20Sopenharmony_ci   extract the device parameters relevant to device drivers and copy them
138c2ecf20Sopenharmony_ci   into an 'xparameters.h' in the form of #define symbols.  This tells the
148c2ecf20Sopenharmony_ci   device drivers how the IP cores are configured, but it requires the kernel
158c2ecf20Sopenharmony_ci   to be recompiled every time the FPGA bitstream is resynthesized.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci   The new approach is to export the parameters into the device tree and
188c2ecf20Sopenharmony_ci   generate a new device tree each time the FPGA bitstream changes.  The
198c2ecf20Sopenharmony_ci   parameters which used to be exported as #defines will now become
208c2ecf20Sopenharmony_ci   properties of the device node.  In general, device nodes for IP-cores
218c2ecf20Sopenharmony_ci   will take the following form:
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	(name): (generic-name)@(base-address) {
248c2ecf20Sopenharmony_ci		compatible = "xlnx,(ip-core-name)-(HW_VER)"
258c2ecf20Sopenharmony_ci			     [, (list of compatible devices), ...];
268c2ecf20Sopenharmony_ci		reg = <(baseaddr) (size)>;
278c2ecf20Sopenharmony_ci		interrupt-parent = <&interrupt-controller-phandle>;
288c2ecf20Sopenharmony_ci		interrupts = < ... >;
298c2ecf20Sopenharmony_ci		xlnx,(parameter1) = "(string-value)";
308c2ecf20Sopenharmony_ci		xlnx,(parameter2) = <(int-value)>;
318c2ecf20Sopenharmony_ci	};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	(generic-name):   an open firmware-style name that describes the
348c2ecf20Sopenharmony_ci			generic class of device.  Preferably, this is one word, such
358c2ecf20Sopenharmony_ci			as 'serial' or 'ethernet'.
368c2ecf20Sopenharmony_ci	(ip-core-name):	the name of the ip block (given after the BEGIN
378c2ecf20Sopenharmony_ci			directive in system.mhs).  Should be in lowercase
388c2ecf20Sopenharmony_ci			and all underscores '_' converted to dashes '-'.
398c2ecf20Sopenharmony_ci	(name):		is derived from the "PARAMETER INSTANCE" value.
408c2ecf20Sopenharmony_ci	(parameter#):	C_* parameters from system.mhs.  The C_ prefix is
418c2ecf20Sopenharmony_ci			dropped from the parameter name, the name is converted
428c2ecf20Sopenharmony_ci			to lowercase and all underscore '_' characters are
438c2ecf20Sopenharmony_ci			converted to dashes '-'.
448c2ecf20Sopenharmony_ci	(baseaddr):	the baseaddr parameter value (often named C_BASEADDR).
458c2ecf20Sopenharmony_ci	(HW_VER):	from the HW_VER parameter.
468c2ecf20Sopenharmony_ci	(size):		the address range size (often C_HIGHADDR - C_BASEADDR + 1).
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci   Typically, the compatible list will include the exact IP core version
498c2ecf20Sopenharmony_ci   followed by an older IP core version which implements the same
508c2ecf20Sopenharmony_ci   interface or any other device with the same interface.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci   'reg' and 'interrupts' are all optional properties.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci   For example, the following block from system.mhs:
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	BEGIN opb_uartlite
578c2ecf20Sopenharmony_ci		PARAMETER INSTANCE = opb_uartlite_0
588c2ecf20Sopenharmony_ci		PARAMETER HW_VER = 1.00.b
598c2ecf20Sopenharmony_ci		PARAMETER C_BAUDRATE = 115200
608c2ecf20Sopenharmony_ci		PARAMETER C_DATA_BITS = 8
618c2ecf20Sopenharmony_ci		PARAMETER C_ODD_PARITY = 0
628c2ecf20Sopenharmony_ci		PARAMETER C_USE_PARITY = 0
638c2ecf20Sopenharmony_ci		PARAMETER C_CLK_FREQ = 50000000
648c2ecf20Sopenharmony_ci		PARAMETER C_BASEADDR = 0xEC100000
658c2ecf20Sopenharmony_ci		PARAMETER C_HIGHADDR = 0xEC10FFFF
668c2ecf20Sopenharmony_ci		BUS_INTERFACE SOPB = opb_7
678c2ecf20Sopenharmony_ci		PORT OPB_Clk = CLK_50MHz
688c2ecf20Sopenharmony_ci		PORT Interrupt = opb_uartlite_0_Interrupt
698c2ecf20Sopenharmony_ci		PORT RX = opb_uartlite_0_RX
708c2ecf20Sopenharmony_ci		PORT TX = opb_uartlite_0_TX
718c2ecf20Sopenharmony_ci		PORT OPB_Rst = sys_bus_reset_0
728c2ecf20Sopenharmony_ci	END
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci   becomes the following device tree node:
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	opb_uartlite_0: serial@ec100000 {
778c2ecf20Sopenharmony_ci		device_type = "serial";
788c2ecf20Sopenharmony_ci		compatible = "xlnx,opb-uartlite-1.00.b";
798c2ecf20Sopenharmony_ci		reg = <ec100000 10000>;
808c2ecf20Sopenharmony_ci		interrupt-parent = <&opb_intc_0>;
818c2ecf20Sopenharmony_ci		interrupts = <1 0>; // got this from the opb_intc parameters
828c2ecf20Sopenharmony_ci		current-speed = <d#115200>;	// standard serial device prop
838c2ecf20Sopenharmony_ci		clock-frequency = <d#50000000>;	// standard serial device prop
848c2ecf20Sopenharmony_ci		xlnx,data-bits = <8>;
858c2ecf20Sopenharmony_ci		xlnx,odd-parity = <0>;
868c2ecf20Sopenharmony_ci		xlnx,use-parity = <0>;
878c2ecf20Sopenharmony_ci	};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci   That covers the general approach to binding xilinx IP cores into the
908c2ecf20Sopenharmony_ci   device tree.  The following are bindings for specific devices:
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci      i) Xilinx ML300 Framebuffer
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci      Simple framebuffer device from the ML300 reference design (also on the
958c2ecf20Sopenharmony_ci      ML403 reference design as well as others).
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci      Optional properties:
988c2ecf20Sopenharmony_ci       - resolution = <xres yres> : pixel resolution of framebuffer.  Some
998c2ecf20Sopenharmony_ci                                    implementations use a different resolution.
1008c2ecf20Sopenharmony_ci                                    Default is <d#640 d#480>
1018c2ecf20Sopenharmony_ci       - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
1028c2ecf20Sopenharmony_ci                                           Default is <d#1024 d#480>.
1038c2ecf20Sopenharmony_ci       - rotate-display (empty) : rotate display 180 degrees.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci      ii) Xilinx SystemACE
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci      The Xilinx SystemACE device is used to program FPGAs from an FPGA
1088c2ecf20Sopenharmony_ci      bitstream stored on a CF card.  It can also be used as a generic CF
1098c2ecf20Sopenharmony_ci      interface device.
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci      Optional properties:
1128c2ecf20Sopenharmony_ci       - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci      iii) Xilinx EMAC and Xilinx TEMAC
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci      Xilinx Ethernet devices.  In addition to general xilinx properties
1178c2ecf20Sopenharmony_ci      listed above, nodes for these devices should include a phy-handle
1188c2ecf20Sopenharmony_ci      property, and may include other common network device properties
1198c2ecf20Sopenharmony_ci      like local-mac-address.
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci      iv) Xilinx Uartlite
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci      Xilinx uartlite devices are simple fixed speed serial ports.
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci      Required properties:
1268c2ecf20Sopenharmony_ci       - current-speed : Baud rate of uartlite
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci      v) Xilinx hwicap
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci		Xilinx hwicap devices provide access to the configuration logic
1318c2ecf20Sopenharmony_ci		of the FPGA through the Internal Configuration Access Port
1328c2ecf20Sopenharmony_ci		(ICAP).  The ICAP enables partial reconfiguration of the FPGA,
1338c2ecf20Sopenharmony_ci		readback of the configuration information, and some control over
1348c2ecf20Sopenharmony_ci		'warm boots' of the FPGA fabric.
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci		Required properties:
1378c2ecf20Sopenharmony_ci		- xlnx,family : The family of the FPGA, necessary since the
1388c2ecf20Sopenharmony_ci                      capabilities of the underlying ICAP hardware
1398c2ecf20Sopenharmony_ci                      differ between different families.  May be
1408c2ecf20Sopenharmony_ci                      'virtex2p', 'virtex4', or 'virtex5'.
1418c2ecf20Sopenharmony_ci		- compatible : should contain "xlnx,xps-hwicap-1.00.a" or
1428c2ecf20Sopenharmony_ci				"xlnx,opb-hwicap-1.00.b".
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci      vi) Xilinx Uart 16550
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci      Xilinx UART 16550 devices are very similar to the NS16550 but with
1478c2ecf20Sopenharmony_ci      different register spacing and an offset from the base address.
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci      Required properties:
1508c2ecf20Sopenharmony_ci       - clock-frequency : Frequency of the clock input
1518c2ecf20Sopenharmony_ci       - reg-offset : A value of 3 is required
1528c2ecf20Sopenharmony_ci       - reg-shift : A value of 2 is required
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci      vii) Xilinx USB Host controller
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci      The Xilinx USB host controller is EHCI compatible but with a different
1578c2ecf20Sopenharmony_ci      base address for the EHCI registers, and it is always a big-endian
1588c2ecf20Sopenharmony_ci      USB Host controller. The hardware can be configured as high speed only,
1598c2ecf20Sopenharmony_ci      or high speed/full speed hybrid.
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci      Required properties:
1628c2ecf20Sopenharmony_ci      - xlnx,support-usb-fs: A value 0 means the core is built as high speed
1638c2ecf20Sopenharmony_ci                             only. A value 1 means the core also supports
1648c2ecf20Sopenharmony_ci                             full speed devices.
1658c2ecf20Sopenharmony_ci
166