u-boot runtime modify Linux device tree(dtb)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

u-boot runtime modify Linux device tree(dtb)

u-boot runtime modify Linux device tree(dtb)

In some cases, i.MX board connect to different module. It has very tiny changes, such as just one gpio different driver strength.

We can build an entire new software to handle this requirement.

Here we introduce another way, using u-boot to modify the device tree(dtb) at runtime.

 

Here is u-boot fdt command for 

How to use gpio-hog demo
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-use-gpio-hog-demo/ta-p/1317709

 

run loadfdt

fdt addr ${fdt_addr_r}


fdt print /soc/bus/pinctrl/uart3grp
fdt rm /soc/bus/pinctrl/uart3grp

fdt print serial2

fdt set serial2 status disabled

fdt print serial2

fdt print gpio4

fdt resize

fdt mknode gpio4 gpio_hog_demo


fdt set gpio4/gpio_hog_demo gpio-hog
fdt set gpio4/gpio_hog_demo gpios <7 0>
fdt set gpio4/gpio_hog_demo output-high
fdt print gpio4


run mmcargs
run loadimage

booti ${loadaddr} - ${fdt_addr_r}


root@imx8mmevk:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
gpio-5 ( |PCIe DIS ) out hi
gpio-13 ( |ir-receiver ) in hi IRQ ACTIVE LOW
gpio-15 ( |cd ) in hi IRQ ACTIVE LOW

gpiochip1: GPIOs 32-63, parent: platform/30210000.gpio, 30210000.gpio:
gpio-38 ( |? ) out hi
gpio-42 ( |reset ) out lo ACTIVE LOW
gpio-51 ( |regulator-usdhc2 ) out lo

gpiochip2: GPIOs 64-95, parent: platform/30220000.gpio, 30220000.gpio:
gpio-80 ( |status ) out hi

gpiochip3: GPIOs 96-127, parent: platform/30230000.gpio, 30230000.gpio:
gpio-117 ( |PCIe reset ) out hi

gpiochip4: GPIOs 128-159, parent: platform/30240000.gpio, 30240000.gpio:
gpio-135 ( |gpio_hog_demo ) out hi
gpio-141 ( |spi1 CS0 ) out hi ACTIVE LOW
gpio-149 ( |wlf,mute ) out hi ACTIVE LOW
root@imx8mmevk:~# [ 33.758914] VSD_3V3: disabling

dtc_utils-v1.6.1-win-x86_64.zip by msys2 

 

附件
评论

Dump dtb content before modifying.

.\fdtdump imx8mm-evk.dtb > .\dtb-dump_0.txt

Change the status of i2c3:

.\fdtput -t s imx8mm-evk.dtb i2c3 status okay

Modify clock frequency of i2c0:

.\fdtput -t i imx8mm-evk.dtb i2c0 clock-frequency 100000

Check if the changes were successful.
.\fdtdump imx8mm-evk.dtb > .\dtb-dump_1.txt

Note: use fdt tools in the package dtc_utils-v1.6.1-win-x86_64.zip.

Use Grep for Windows instead of saving dump data to files.

https://gnuwin32.sourceforge.net/packages/grep.htm

100% 有帮助 (1/1)
版本历史
最后更新:
‎03-29-2022 11:06 PM
更新人: