Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeMidnight
memory@0 {
     device_type = "memory";
     reg = <0x0 0x0 0x0 0x7ff00000>, <0x8 0x00000000 0x0 0x80000000>;
};

4 Clocks

4.1 Linux Disables Clocks



By default Linux disables clocks which have no reference in the device tree (no nodes using the clock). This can create issues in an AMP design where Linux is running on one CPU and another non-Linux based design is running on the other CPU. When the non-Linux CPU software is trying to use devices that are not in the device tree the clock will be disabled such that the device is not accessible.

The text "clk_ignore_unused" can be added to the kernel command line and it will not disable unused clocks. This was tested for a 3.17 Linux kernel (Xilinx 2014.4 release). This topic is discussed in the following forum thread. This option is also documented in the kernel clock documentation referenced at the end of the page.


Clock Disable Linux Forum Thread

...


Other nodes in the device tree reference the clocks in the clkc node to indicate that the node uses the clock. The following property illustrates an example clock property.

Code Block
themeMidnight
clocks = <&clkc 15>;


The &clkc is a reference to the clkc node which contains the clock-output-names. The 15 is a zero based index into the clock-output-names such that it refers to fclk0.

...


There are times when a device in the device tree, a node, is not wanted in the system. The status property of a node can be used to disable it. This property may not be present on all nodes by default, but can be added.

Code Block
themeMidnight
&i2c1    { 
     status = "disabled";
};

6 Fixing A Broken Node


There may be node that has a property which only has to exist, with no specific value (such as xlnx,tx_termination_fix), and the driver just checks for it's existence in the device tree. There is no easy way to get rid of the property in an existing node but you can create a new node with a new name which does not have that property. Any references to the old node will need to change to the new node.

...


After adding the "compatible = generic-uio" to the device tree node as described above, the boot args of the kernel must be altered to allow the UIO device driver to be compatible with the device tree node.

Add "uio_pdrv_genirq.of_id=generic-uio" to the bootargs of the kernel in the device tree. This string is altering the module parameter of_id for the uio_pdrv_genirq device driver so that when it's built into the kernel (rather than a module) it will be compatible with the device tree node. If the driver is inserted as a module the user could also specify the module parameter at the time of insertion into the kernel.

9

...

How to add or delete nodes and properties in PetaLinux

9.1 Adding a New Node or Update existing nodes

New nodes in the device tree should be added near the top of <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi between the first pair of brackets "{}" as illustrated below.

Code Block
themeMidnight
/include/ "system-conf.dtsi"
{
Add	/* Add new nodes here.
};
 
Alter existing nodes here.

...

, One such example */
	gpio-lkm@0xa0000000 {
        	compatible = "xlnx,gpio-lkm";
	        reg = <0x0 0xa0000000 0x0 0x10000>;
        	xlnx,gpio-width = <2>;
		    interrupt-names = "ip2intc_irpt";
        	interrupt-parent = <&gic>;
	        interrupts = <0 89 4>;
	};
};
 
/* Modify existing nodes here */
&i2c1 {

	/* FIXME PL i2c via PCA9306 - u45 */
	/* FIXME MSP430 - u41 - not detected */
	i2c-mux@74 { /* u34 */
		i2c@0 { /* i2c mw 74 0 1 */
			/*
			 * IIC_EEPROM 1kB memory which uses 256B blocks
			 * where every block has different address.
			 *    0 - 256B address 0x54
			 * 256B - 512B address 0x55
			 * 512B - 768B address 0x56
			 * 768B - 1024B address 0x57
			 */
			eeprom: eeprom@54 { /* u23 */
				compatible = "atmel,24c08";
				reg = <0x54>;
			};
		};
	};
};

9.2 Deleting a Node or Properties of existing nodes

Delete nodes or properties in the device tree should be added near the top of <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi between the first pair of brackets "{}" as illustrated below.


Code Block
themeMidnight
/include/ "system-conf.dtsi"
{
	/* Before deleting the node make sure you have removed the alias and other reference. */
    aliases {
        /delete-property/ i2c0;
    };

};

/* Delete existing nodes which has reference in alias */
&amba_pl {
    /delete-node/ i2c@40800000;
};
 
/* Delete existing properties from a node */
&dwc3{
    /delete-property/ phy-names;
    /delete-property/ phys;
};

9.3 Adding a New Node or Update existing Device-tree Overlay nodes

New nodes in the device tree overlay should be added near the top of <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi between the first pair of brackets "/{}" as illustrated below.

Code Block
themeMidnight
/ {
	/* Add new nodes here, One such example PL VCU Encoder and Decoder */
	fragment@9 {
		target = <&amba>;
		overlay9: __overlay__ {
			vcu: vcu@a0000000 {
				#address-cells = <2>;
				#clock-cells = <1>;
				#size-cells = <2>;
				clock-names = "pll_ref", "aclk", "vcu_core_enc", "vcu_core_dec", "vcu_mcu_enc", "vcu_mcu_dec";
				clocks = <&misc_clk_3>, <&misc_clk_0>, <&vcu 1>, <&vcu 2>, <&vcu 3>, <&vcu 4>;
				compatible = "xlnx,vcu-1.2", "xlnx,vcu";
				interrupt-names = "vcu_host_interrupt";
				interrupt-parent = <&gic>;
				interrupts = <0 89 4>;
				ranges ;
				reg = <0x0 0xa0040000 0x0 0x1000>, <0x0 0xa0041000 0x0 0x1000>;
				reg-names = "vcu_slcr", "logicore";
				reset-gpios = <&gpio 79 0>;
				encoder: al5e@a0000000 {
					compatible = "al,al5e-1.2", "al,al5e";
					interrupt-parent = <&gic>;
					interrupts = <0 89 4>;
					reg = <0x0 0xa0000000 0x0 0x10000>;
				};
				decoder: al5d@a0020000 {
					compatible = "al,al5d-1.2", "al,al5d";
					interrupt-parent = <&gic>;
					interrupts = <0 89 4>;
					reg = <0x0 0xa0020000 0x0 0x10000>;
				};
			};
		};
	};
};
 
/* Modify existing DT overlay nodes here */
&overlay0 {
	fpga-config-from-dmabuf;
};

9.4 Deleting a Node or Properties of existing Device-tree Overlay nodes

Delete nodes or properties in the device tree should be added near the top of <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi between the first pair of brackets "/{}" as illustrated below.


Code Block
themeMidnight
/ {
	/* Delete DT fragment node property */
	fragment@1 {
		/delete-property/ target;
	};
	
	/* Delete DT overlay node */
	fragment@2 {
		/delete-node/ __overlay__;
	};
};

10 References


Fabric Clock Control

Kernel Interrupt Bindings

...