61 | | Note some bootloader environments such as Ventana and Venice call a {{{fixfdt}}} script that can make integrating fixups like this into the boot process easy. See [http://trac.gateworks.com/wiki/ventana/bootloader#Specifyinganalternatedevice-treeblobDTB here] for details. |
62 | | |
| 68 | Important notes regarding the 'fdt set' command 'value' parameter: |
| 69 | * numbers can be represented as decimal or as hex with a '0x' prefix |
| 70 | * an array of cells is specified as a list of numbers enclosed in < and >, ie <0x00112233 4 05> |
| 71 | * a byte stream can be represented as a list of numbers enclosed in [ and ], ie [00 11 22 .. nn] |
| 72 | * a 32bit integer is a 4-byte MSB stream so a hex value of 0x1 would be represented as [00 00 00 01] |
| 73 | * if the value does not start with a < or a [ it is treated as a string (quotes are stripped if present) |
| 74 | |
| 75 | |
| 76 | [=#fixfdt] |
| 77 | === fixfdt script |
| 78 | If using the Gateworks BSP's the {{{fixfdt}}} env variable if set will be run as a script during the process as a feature of the Gateworks boot scripts. |
| 79 | |
| 80 | Examples: |
| 81 | * Venice: The {{{loadfdt}}} script will load the dt to the address specified in the {{{fdt_addr_r}}} env var |
| 82 | - disable PCI via {{{fixfdt}}} script: |
| 83 | {{{ |
| 84 | setenv fixfdt 'fdt addr $fdt_addr_r; fdt resize; fdt set /soc@0/pcie@33800000 status disabled' |
| 85 | saveenv |
| 86 | }}} |
| 87 | - limit PCI link to Gen 1 (default is Gen2 for Venice) |
| 88 | {{{ |
| 89 | setenv fixfdt 'fdt addr $fdt_addr_r; fdt resize; fdt set /soc@0/pcie@33800000 fsl,max-link-speed [00 00 00 01]' |
| 90 | saveenv |
| 91 | }}} |
| 92 | * Newport: U-Boot uses a live dt which is also passed to the kernel (dtb is not loaded) so you can alter the dt before running your normal bootscript |
| 93 | - Disable PEM2 (PEM0=pci@87e0c0000000, PEM1=pci@87e0c1000000, PEM2=pci@87e0c2000000) |
| 94 | {{{ |
| 95 | setenv bootscript 'fdt /soc@0/pci@87e0c2000000 status disabled; run distro_bootcmd' |
| 96 | saveenv |
| 97 | }}} |
| 98 | * Ventana: The {{{loadfdt}}} script will load the dt to the address specified in the {{{fdt_addr}}} env var |
| 99 | - disable PCI via {{{fixfdt}}} script: |
| 100 | {{{ |
| 101 | setenv fixfdt 'fdt addr ${fdt_addr}; fdt resize; fdt set /soc/pcie@0x01000000 status disabled' |
| 102 | saveenv |
| 103 | }}} |
| 104 | |
| 105 | You can verify your changes took effect by checking the values in Linux via {{{/proc/device-tree}}} or by using {{{dtc}}} to de-compile the dt from {{{/sys/firmware/devicetree/base}}}: |
| 106 | {{{#!bash |
| 107 | # de-compile dt via dtc |
| 108 | dtc -I fs -O dts /sys/firmware/devicetree/base |
| 109 | # hexdump prop from /proc/device-tree |
| 110 | hexdump -C /proc/device-tree/soc\@0/pcie\@33800000/fsl\,max-link-speed |
| 111 | }}} |
| 112 | |
| 113 | === dt overlay |