【FAQ】全志R329如何通过uboot修改设备树属性?
-
问题背景
硬件:R328+ Wi-Fi模组(XRADIO)
软件:Tina3.0及以上问题简述
有时候经常需要临时调整部份设备树的属性配置,例如sdc的频率,以太网的delay参数。如果每次都源码修改后编译烧写,比较费时,所以uboot提供了临时修改的方法。
注:uboot修改都是单次启动有效,重启无效。问题分析
1.修改sdc的属性
产看当前sdc的配置
=> fdt print /soc/sdmmc@4021000 sdmmc@4021000 { compatible = "allwinner,sunxi-mmc-v5p3x"; device_type = "sdc1"; reg = <0x00000000 0x04021000 0x00000000 0x00001000>; interrupts = <0x00000000 0x00000029 0x00000004>; clocks = <0x0000000c 0x00000002 0x00000005 0x00000002 0x0000003a 0x00000002 0x0000003d>; clock-names = "osc24m", "pll_periph", "mmc", "ahb"; resets = <0x00000002 0x00000010>; reset-names = "rst"; pinctrl-names = "default", "sleep"; pinctrl-0 = <0x00000022>; pinctrl-1 = <0x00000023>; max-frequency = <0x08f0d180>; bus-width = <0x00000004>; cap-sd-highspeed; no-mmc; keep-power-in-suspend; sunxi-dly-52M-ddr4 = <0x00000001 0x00000000 0x00000000 0x00000000 0x00000002>; sunxi-dly-104M = <0x00000001 0x00000000 0x00000000 0x00000000 0x00000001>; sunxi-dly-208M = <0x00000001 0x00000000 0x00000000 0x00000000 0x00000001>; status = "okay"; no-sd; cap-sdio-irq; ignore-pm-notify; ctl-spec-caps = <0x00000008>; };
修改sdc的最大支持频率
25M fdt set /soc/sdmmc@04021000 max-frequency <0x017d7840> 50M fdt set /soc/sdmmc@04021000 max-frequency <0x02faf080> 100M fdt set /soc/sdmmc@04021000 max-frequency <0x05f5e100> 120M fdt set /soc/sdmmc@04021000 max-frequency <0x07270e00> 150M fdt set /soc/sdmmc@04021000 max-frequency <0x08f0d180>
修改相位
fdt set /soc/sdmmc@04021000 sunxi-dly-208M <0x00000001 0x00000000 0x00000000 0x00000000 0x00000000 0x00000001>
2.修改以太网的属性
打印当前以太网的配置
=> fdt print /soc/eth@4500000 eth@4500000 { compatible = "allwinner,sunxi-gmac"; reg = <0x00000000 0x04500000 0x00000000 0x00010000 0x00000000 0x03000030 0x00000000 0x00000004>; interrupts = <0x00000000 0x0000002e 0x00000004>; interrupt-names = "gmacirq"; clocks = <0x00000002 0x00000050 0x00000002 0x0000004f>; clock-names = "gmac", "ephy"; resets = <0x00000002 0x00000020>; device_type = "gmac0"; gmac-power0; gmac-power1; gmac-power2; status = "okay"; phy-mode = "rgmii"; use_ephy25m = <0x00000001>; pinctrl-0 = <0x00000019>; pinctrl-1 = <0x0000001a>; pinctrl-names = "default", "sleep"; tx-delay = <0x00000003>; rx-delay = <0x00000005>; };
修改delay 参数
fdt set /soc/eth@4500000 rx-delay <0x0000000a>
注:这里只是简单介绍uboot的命令,具体设备属性的解释就不展开说明了。
解决办法
uboot常用命令
fdt=> fdt -h fdt - flattened device tree utility commands Usage: fdt addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr> fdt apply <addr> - Apply overlay to the DT fdt boardsetup - Do board-specific set up fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active fdt resize [<extrasize>] - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed fdt print <path> [<prop>] - Recursive print starting at <path> fdt list <path> [<prop>] - Print one level starting at <path> fdt get value <var> <path> <prop> - Get <property> and store in <var> fdt get name <var> <path> <index> - Get name of node <index> and store in <var> fdt get addr <var> <path> <prop> - Get start address of <property> and store in <var> fdt get size <var> <path> [<prop>] - Get size of [<property>] or num nodes and store in <var> fdt set <path> <prop> [<val>] - Set <property> [to <val>] fdt mknode <path> <node> - Create a new node after <path> fdt rm <path> [<prop>] - Delete the node or <property> fdt header - Display header info fdt bootcpu <id> - Set boot cpuid fdt memory <addr> <size> - Add/Update memory node fdt rsvmem print - Show current mem reserves fdt rsvmem add <addr> <size> - Add a mem reserve fdt rsvmem delete <index> - Delete a mem reserves fdt chosen [<start> <end>] - Add/update the /chosen branch in the tree <start>/<end> - initrd start/end addr
printenv:打印环境变量 setenv:设置环境变量 saveenv:保存设置的环境变量 md:显示内存区的内容 mm:修改内存 cmp:比较两块内存
-
-
-
-
-
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号