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