1*c66ec88fSEmmanuel Vadot d) Xilinx IP cores 2*c66ec88fSEmmanuel Vadot 3*c66ec88fSEmmanuel Vadot The Xilinx EDK toolchain ships with a set of IP cores (devices) for use 4*c66ec88fSEmmanuel Vadot in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range 5*c66ec88fSEmmanuel Vadot of standard device types (network, serial, etc.) and miscellaneous 6*c66ec88fSEmmanuel Vadot devices (gpio, LCD, spi, etc). Also, since these devices are 7*c66ec88fSEmmanuel Vadot implemented within the fpga fabric every instance of the device can be 8*c66ec88fSEmmanuel Vadot synthesised with different options that change the behaviour. 9*c66ec88fSEmmanuel Vadot 10*c66ec88fSEmmanuel Vadot Each IP-core has a set of parameters which the FPGA designer can use to 11*c66ec88fSEmmanuel Vadot control how the core is synthesized. Historically, the EDK tool would 12*c66ec88fSEmmanuel Vadot extract the device parameters relevant to device drivers and copy them 13*c66ec88fSEmmanuel Vadot into an 'xparameters.h' in the form of #define symbols. This tells the 14*c66ec88fSEmmanuel Vadot device drivers how the IP cores are configured, but it requires the kernel 15*c66ec88fSEmmanuel Vadot to be recompiled every time the FPGA bitstream is resynthesized. 16*c66ec88fSEmmanuel Vadot 17*c66ec88fSEmmanuel Vadot The new approach is to export the parameters into the device tree and 18*c66ec88fSEmmanuel Vadot generate a new device tree each time the FPGA bitstream changes. The 19*c66ec88fSEmmanuel Vadot parameters which used to be exported as #defines will now become 20*c66ec88fSEmmanuel Vadot properties of the device node. In general, device nodes for IP-cores 21*c66ec88fSEmmanuel Vadot will take the following form: 22*c66ec88fSEmmanuel Vadot 23*c66ec88fSEmmanuel Vadot (name): (generic-name)@(base-address) { 24*c66ec88fSEmmanuel Vadot compatible = "xlnx,(ip-core-name)-(HW_VER)" 25*c66ec88fSEmmanuel Vadot [, (list of compatible devices), ...]; 26*c66ec88fSEmmanuel Vadot reg = <(baseaddr) (size)>; 27*c66ec88fSEmmanuel Vadot interrupt-parent = <&interrupt-controller-phandle>; 28*c66ec88fSEmmanuel Vadot interrupts = < ... >; 29*c66ec88fSEmmanuel Vadot xlnx,(parameter1) = "(string-value)"; 30*c66ec88fSEmmanuel Vadot xlnx,(parameter2) = <(int-value)>; 31*c66ec88fSEmmanuel Vadot }; 32*c66ec88fSEmmanuel Vadot 33*c66ec88fSEmmanuel Vadot (generic-name): an open firmware-style name that describes the 34*c66ec88fSEmmanuel Vadot generic class of device. Preferably, this is one word, such 35*c66ec88fSEmmanuel Vadot as 'serial' or 'ethernet'. 36*c66ec88fSEmmanuel Vadot (ip-core-name): the name of the ip block (given after the BEGIN 37*c66ec88fSEmmanuel Vadot directive in system.mhs). Should be in lowercase 38*c66ec88fSEmmanuel Vadot and all underscores '_' converted to dashes '-'. 39*c66ec88fSEmmanuel Vadot (name): is derived from the "PARAMETER INSTANCE" value. 40*c66ec88fSEmmanuel Vadot (parameter#): C_* parameters from system.mhs. The C_ prefix is 41*c66ec88fSEmmanuel Vadot dropped from the parameter name, the name is converted 42*c66ec88fSEmmanuel Vadot to lowercase and all underscore '_' characters are 43*c66ec88fSEmmanuel Vadot converted to dashes '-'. 44*c66ec88fSEmmanuel Vadot (baseaddr): the baseaddr parameter value (often named C_BASEADDR). 45*c66ec88fSEmmanuel Vadot (HW_VER): from the HW_VER parameter. 46*c66ec88fSEmmanuel Vadot (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1). 47*c66ec88fSEmmanuel Vadot 48*c66ec88fSEmmanuel Vadot Typically, the compatible list will include the exact IP core version 49*c66ec88fSEmmanuel Vadot followed by an older IP core version which implements the same 50*c66ec88fSEmmanuel Vadot interface or any other device with the same interface. 51*c66ec88fSEmmanuel Vadot 52*c66ec88fSEmmanuel Vadot 'reg' and 'interrupts' are all optional properties. 53*c66ec88fSEmmanuel Vadot 54*c66ec88fSEmmanuel Vadot For example, the following block from system.mhs: 55*c66ec88fSEmmanuel Vadot 56*c66ec88fSEmmanuel Vadot BEGIN opb_uartlite 57*c66ec88fSEmmanuel Vadot PARAMETER INSTANCE = opb_uartlite_0 58*c66ec88fSEmmanuel Vadot PARAMETER HW_VER = 1.00.b 59*c66ec88fSEmmanuel Vadot PARAMETER C_BAUDRATE = 115200 60*c66ec88fSEmmanuel Vadot PARAMETER C_DATA_BITS = 8 61*c66ec88fSEmmanuel Vadot PARAMETER C_ODD_PARITY = 0 62*c66ec88fSEmmanuel Vadot PARAMETER C_USE_PARITY = 0 63*c66ec88fSEmmanuel Vadot PARAMETER C_CLK_FREQ = 50000000 64*c66ec88fSEmmanuel Vadot PARAMETER C_BASEADDR = 0xEC100000 65*c66ec88fSEmmanuel Vadot PARAMETER C_HIGHADDR = 0xEC10FFFF 66*c66ec88fSEmmanuel Vadot BUS_INTERFACE SOPB = opb_7 67*c66ec88fSEmmanuel Vadot PORT OPB_Clk = CLK_50MHz 68*c66ec88fSEmmanuel Vadot PORT Interrupt = opb_uartlite_0_Interrupt 69*c66ec88fSEmmanuel Vadot PORT RX = opb_uartlite_0_RX 70*c66ec88fSEmmanuel Vadot PORT TX = opb_uartlite_0_TX 71*c66ec88fSEmmanuel Vadot PORT OPB_Rst = sys_bus_reset_0 72*c66ec88fSEmmanuel Vadot END 73*c66ec88fSEmmanuel Vadot 74*c66ec88fSEmmanuel Vadot becomes the following device tree node: 75*c66ec88fSEmmanuel Vadot 76*c66ec88fSEmmanuel Vadot opb_uartlite_0: serial@ec100000 { 77*c66ec88fSEmmanuel Vadot device_type = "serial"; 78*c66ec88fSEmmanuel Vadot compatible = "xlnx,opb-uartlite-1.00.b"; 79*c66ec88fSEmmanuel Vadot reg = <ec100000 10000>; 80*c66ec88fSEmmanuel Vadot interrupt-parent = <&opb_intc_0>; 81*c66ec88fSEmmanuel Vadot interrupts = <1 0>; // got this from the opb_intc parameters 82*c66ec88fSEmmanuel Vadot current-speed = <d#115200>; // standard serial device prop 83*c66ec88fSEmmanuel Vadot clock-frequency = <d#50000000>; // standard serial device prop 84*c66ec88fSEmmanuel Vadot xlnx,data-bits = <8>; 85*c66ec88fSEmmanuel Vadot xlnx,odd-parity = <0>; 86*c66ec88fSEmmanuel Vadot xlnx,use-parity = <0>; 87*c66ec88fSEmmanuel Vadot }; 88*c66ec88fSEmmanuel Vadot 89*c66ec88fSEmmanuel Vadot That covers the general approach to binding xilinx IP cores into the 90*c66ec88fSEmmanuel Vadot device tree. The following are bindings for specific devices: 91*c66ec88fSEmmanuel Vadot 92*c66ec88fSEmmanuel Vadot i) Xilinx ML300 Framebuffer 93*c66ec88fSEmmanuel Vadot 94*c66ec88fSEmmanuel Vadot Simple framebuffer device from the ML300 reference design (also on the 95*c66ec88fSEmmanuel Vadot ML403 reference design as well as others). 96*c66ec88fSEmmanuel Vadot 97*c66ec88fSEmmanuel Vadot Optional properties: 98*c66ec88fSEmmanuel Vadot - resolution = <xres yres> : pixel resolution of framebuffer. Some 99*c66ec88fSEmmanuel Vadot implementations use a different resolution. 100*c66ec88fSEmmanuel Vadot Default is <d#640 d#480> 101*c66ec88fSEmmanuel Vadot - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory. 102*c66ec88fSEmmanuel Vadot Default is <d#1024 d#480>. 103*c66ec88fSEmmanuel Vadot - rotate-display (empty) : rotate display 180 degrees. 104*c66ec88fSEmmanuel Vadot 105*c66ec88fSEmmanuel Vadot ii) Xilinx SystemACE 106*c66ec88fSEmmanuel Vadot 107*c66ec88fSEmmanuel Vadot The Xilinx SystemACE device is used to program FPGAs from an FPGA 108*c66ec88fSEmmanuel Vadot bitstream stored on a CF card. It can also be used as a generic CF 109*c66ec88fSEmmanuel Vadot interface device. 110*c66ec88fSEmmanuel Vadot 111*c66ec88fSEmmanuel Vadot Optional properties: 112*c66ec88fSEmmanuel Vadot - 8-bit (empty) : Set this property for SystemACE in 8 bit mode 113*c66ec88fSEmmanuel Vadot 114*c66ec88fSEmmanuel Vadot iii) Xilinx EMAC and Xilinx TEMAC 115*c66ec88fSEmmanuel Vadot 116*c66ec88fSEmmanuel Vadot Xilinx Ethernet devices. In addition to general xilinx properties 117*c66ec88fSEmmanuel Vadot listed above, nodes for these devices should include a phy-handle 118*c66ec88fSEmmanuel Vadot property, and may include other common network device properties 119*c66ec88fSEmmanuel Vadot like local-mac-address. 120*c66ec88fSEmmanuel Vadot 121*c66ec88fSEmmanuel Vadot iv) Xilinx Uartlite 122*c66ec88fSEmmanuel Vadot 123*c66ec88fSEmmanuel Vadot Xilinx uartlite devices are simple fixed speed serial ports. 124*c66ec88fSEmmanuel Vadot 125*c66ec88fSEmmanuel Vadot Required properties: 126*c66ec88fSEmmanuel Vadot - current-speed : Baud rate of uartlite 127*c66ec88fSEmmanuel Vadot 128*c66ec88fSEmmanuel Vadot v) Xilinx hwicap 129*c66ec88fSEmmanuel Vadot 130*c66ec88fSEmmanuel Vadot Xilinx hwicap devices provide access to the configuration logic 131*c66ec88fSEmmanuel Vadot of the FPGA through the Internal Configuration Access Port 132*c66ec88fSEmmanuel Vadot (ICAP). The ICAP enables partial reconfiguration of the FPGA, 133*c66ec88fSEmmanuel Vadot readback of the configuration information, and some control over 134*c66ec88fSEmmanuel Vadot 'warm boots' of the FPGA fabric. 135*c66ec88fSEmmanuel Vadot 136*c66ec88fSEmmanuel Vadot Required properties: 137*c66ec88fSEmmanuel Vadot - xlnx,family : The family of the FPGA, necessary since the 138*c66ec88fSEmmanuel Vadot capabilities of the underlying ICAP hardware 139*c66ec88fSEmmanuel Vadot differ between different families. May be 140*c66ec88fSEmmanuel Vadot 'virtex2p', 'virtex4', or 'virtex5'. 141*c66ec88fSEmmanuel Vadot - compatible : should contain "xlnx,xps-hwicap-1.00.a" or 142*c66ec88fSEmmanuel Vadot "xlnx,opb-hwicap-1.00.b". 143*c66ec88fSEmmanuel Vadot 144*c66ec88fSEmmanuel Vadot vi) Xilinx Uart 16550 145*c66ec88fSEmmanuel Vadot 146*c66ec88fSEmmanuel Vadot Xilinx UART 16550 devices are very similar to the NS16550 but with 147*c66ec88fSEmmanuel Vadot different register spacing and an offset from the base address. 148*c66ec88fSEmmanuel Vadot 149*c66ec88fSEmmanuel Vadot Required properties: 150*c66ec88fSEmmanuel Vadot - clock-frequency : Frequency of the clock input 151*c66ec88fSEmmanuel Vadot - reg-offset : A value of 3 is required 152*c66ec88fSEmmanuel Vadot - reg-shift : A value of 2 is required 153*c66ec88fSEmmanuel Vadot 154*c66ec88fSEmmanuel Vadot vii) Xilinx USB Host controller 155*c66ec88fSEmmanuel Vadot 156*c66ec88fSEmmanuel Vadot The Xilinx USB host controller is EHCI compatible but with a different 157*c66ec88fSEmmanuel Vadot base address for the EHCI registers, and it is always a big-endian 158*c66ec88fSEmmanuel Vadot USB Host controller. The hardware can be configured as high speed only, 159*c66ec88fSEmmanuel Vadot or high speed/full speed hybrid. 160*c66ec88fSEmmanuel Vadot 161*c66ec88fSEmmanuel Vadot Required properties: 162*c66ec88fSEmmanuel Vadot - xlnx,support-usb-fs: A value 0 means the core is built as high speed 163*c66ec88fSEmmanuel Vadot only. A value 1 means the core also supports 164*c66ec88fSEmmanuel Vadot full speed devices. 165*c66ec88fSEmmanuel Vadot 166