赞
踩
【迅为iMX6Q】开发板 u-boot 2015.04 SD卡 启动
【迅为iMX6Q】开发板 u-boot 2020.04 SD卡 启动
【迅为iMX6Q】开发板 u-boot 2022.04 SD卡 启动
win10 64位
VMware Workstation Pro 16
ubuntu 22.04
【迅为imx6q】开发板, 2G DDR
u-boot 2020.04 board 适配,源自 board/freescale/mx6sabresd/
,默认以太网 PHY 不是 RTL8211E,而是 ATHEROS
的 AR8031
所以开机后, u-boot 打印提示找不到 PHY, 信息如:Net: Could not get PHY for FEC0: addr 0
U-Boot 2020.04-00020-ga68db489ce (Jan 08 2023 - 21:44:16 +0800) CPU: i.MX6Q rev1.3 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 32C Reset cause: POR Model: i.MX6 Quad Topeet Smart Device Board Board: MX6-topeet DRAM: 2 GiB MMC: FSL_SDHC: 1, FSL_SDHC: 2, FSL_SDHC: 3 Loading Environment from MMC... OK No panel detected: default to Hannstar-XGA Display: Hannstar-XGA (1024x768) In: serial Out: serial Err: serial flash target is MMC:1 Net: Could not get PHY for FEC0: addr 0 Could not get PHY for FEC0: addr 0 No ethernet found. Fastboot: Normal Normal Boot Hit any key to stop autoboot: 0
include/configs/mx6sabre_common.h
中定义了 #define CONFIG_PHY_ATHEROS
include/configs/mx6sabre_common.h
为 include/configs/mx6q_topeet_common.h
include/configs/mx6q_topeet.h
,更改包含的头文件:#include "mx6sabre_common.h"
改为 #include "mx6q_topeet_common.h"
include/configs/mx6q_topeet_common.h
,#define CONFIG_PHY_ATHEROS
改为 #define CONFIG_PHY_REALTEK
#define CONFIG_FEC_MXC_PHYADDR 0
经过测试,发现以上修改 PHY 型号后,以太网驱动依旧提示找不到 PHY,需要修改设备树文件,增加 phy 复位的 delay
修改 arch/arm/dts/imx6qdl-topeet.dtsi
,如下
&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet>;
phy-mode = "rgmii";
phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
phy-reset-duration = <10>;
phy-reset-post-delay = <100>;
fsl,magic-packet;
status = "okay";
};
@fec
设备树节点,增加 phy-reset-duration = <10>;
phy-reset-post-delay = <100>;
重新配置并编译 u-boot,烧写到 sd 卡中验证
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- mx6q_topeet_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- -j4
通过 ubuntu 烧写到 sd 卡中
sudo dd if=u-boot-dtb.imx of=/dev/sdc bs=512 seek=2 && sync
,注意 /dev/sdc
是 sd 卡在 ubuntu 下识别的设备,可能不一样,不要搞错
第一次启动 u-boot 后,需要设置一些 env 网络相关的参数,开发板需要通过网线,连接到【路由器】,或者通过交叉网线,直接连接到【电脑】。电脑与开发板,应该在同一个网段
开机进入 u-boot 命令行,输入如下命令
设置 ethaddr setenv ethaddr '0e:b4:00:52:24:0e'
设置 serverip setenv serverip '192.168.1.100'
设置 ipaddr setenv ipaddr '192.168.1.110'
设置 netmask setenv netmask '255.255.255.0'
设置 gatewayip setenv gatewayip '192.168.1.1'
最后 saveenv
保存 env 设置,并 reset
重启
=> setenv ethaddr '0e:b4:00:52:24:0e'
=> setenv serverip '192.168.1.100'
=> setenv ipaddr '192.168.1.110'
=> setenv netmask '255.255.255.0'
=> setenv gatewayip '192.168.1.1'
=> saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
=> reset
resetting ...
通过 ping 命令验证
ping 路由器网关地址,如
=> ping 192.168.1.1
Using ethernet@02188000 device
host 192.168.1.1 is alive
=> ping 192.168.1.100
Using ethernet@02188000 device
host 192.168.1.100 is alive
U-Boot 2020.04-00021-g5802f0b622 (Jan 08 2023 - 21:48:15 +0800) CPU: i.MX6Q rev1.3 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 41C Reset cause: POR Model: i.MX6 Quad Topeet Smart Device Board Board: MX6-topeet DRAM: 2 GiB MMC: FSL_SDHC: 1, FSL_SDHC: 2, FSL_SDHC: 3 Loading Environment from MMC... OK No panel detected: default to Hannstar-XGA Display: Hannstar-XGA (1024x768) In: serial Out: serial Err: serial flash target is MMC:1 Net: eth0: ethernet@02188000 [PRIME] Fastboot: Normal Normal Boot Hit any key to stop autoboot: 0 => => => printenv baudrate=115200 board_name=TOPEET board_rev=MX6Q boot_fdt=try bootargs=console=ttymxc0,115200 root=/dev/mmcblk1p3 rootwait rw bootcmd=ext4load mmc 1:1 0x18000000 imx6q-topeet.dtb; ext4load mmc 1:1 0x12000000 zImage; bootz 0x12000000 - 0x18000000 bootcmd_mfg=run mfgtool_args;if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else bootz ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo "Run fastboot ..."; fastboot 0; fi; bootdelay=3 bootscript=echo Running bootscript from mmc ...; source console=ttymxc0 dfu_alt_info=spl raw 0x400 dfu_alt_info_img=u-boot raw 0x10000 dfu_alt_info_spl=spl raw 0x400 dfuspi=dfu 0 sf 0:0:10000000:0 emmc_dev=3 emmcdev=2 epdc_waveform=epdc_splash.bin ethact=ethernet@02188000 ethaddr=0e:b4:00:52:24:0e ethprime=eth0 fastboot_dev=mmc1 fdt_addr=0x18000000 fdt_file=imx6q-topeet.dtb fdt_high=0xffffffff fdtcontroladdr=8df5f1a8 fileaddr=18000000 filesize=cedc findfdt=if test $fdt_file = undefined; then if test $board_name = SABREAUTO && test $board_rev = MX6QP; then setenv fdt_file imx6qp-sabreauto.dtb; fi; if test $board_name = SABREAUTO && test $board_rev = MX6Q; then setenv fdt_file imx6q-sabreauto.dtb; fi; if test $board_name = SABREAUTO && test $board_rev = MX6DL; then setenv fdt_file imx6dl-sabreauto.dtb; fi; if test $board_name = SABRESD && test $board_rev = MX6QP; then setenv fdt_file imx6qp-sabresd.dtb; fi; if test $board_name = SABRESD && test $board_rev = MX6Q; then setenv fdt_file imx6q-sabresd.dtb; fi; if test $board_name = SABRESD && test $board_rev = MX6DL; then setenv fdt_file imx6dl-sabresd.dtb; fi; if test $fdt_file = undefined; then echo WARNING: Could not determine dtb to use; fi; fi; findtee=if test $tee_file = undefined; then if test $board_name = SABREAUTO && test $board_rev = MX6QP; then setenv tee_file uTee-6qpauto; fi; if test $board_name = SABREAUTO && test $board_rev = MX6Q; then setenv tee_file uTee-6qauto; fi; if test $board_name = SABREAUTO && test $board_rev = MX6DL; then setenv tee_file uTee-6dlauto; fi; if test $board_name = SABRESD && test $board_rev = MX6QP; then setenv tee_file uTee-6qpsdb; fi; if test $board_name = SABRESD && test $board_rev = MX6Q; then setenv tee_file uTee-6qsdb; fi; if test $board_name = SABRESD && test $board_rev = MX6DL; then setenv tee_file uTee-6dlsdb; fi; if test $tee_file = undefined; then echo WARNING: Could not determine tee to use; fi; fi; finduuid=part uuid mmc ${mmcdev}:2 uuid gatewayip=192.168.1.1 get_cmd=dhcp image=zImage initrd_addr=0x12C00000 initrd_high=0xffffffff ip_dyn=yes ipaddr=192.168.1.110 kboot=bootz loadaddr=0x12000000 loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script}; loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file} loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} loadtee=fatload mmc ${mmcdev}:${mmcpart} ${tee_addr} ${tee_file} mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused mmcargs=setenv bootargs console=${console},${baudrate} ${smp} root=${mmcroot} mmcautodetect=yes mmcboot=echo Booting from mmc ...; run mmcargs; if test ${tee} = yes; then run loadfdt; run loadtee; bootm ${tee_addr} - ${fdt_addr}; else if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;fi; mmcdev=1 mmcpart=1 mmcroot=/dev/mmcblk1p2 rootwait rw netargs=setenv bootargs console=${console},${baudrate} ${smp} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${tee} = yes; then ${get_cmd} ${tee_addr} ${tee_file}; ${get_cmd} ${fdt_addr} ${fdt_file}; bootm ${tee_addr} - ${fdt_addr}; else if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi; fi; netmask=255.255.255.0 script=boot.scr sd_dev=2 serial#=170da1d4ee695b4c serverip=192.168.1.100 soc_type=imx6q spi_bus=0 spi_uboot=0x400 splashimage=0x28000000 tee=no tee_addr=0x20000000 tee_file=undefined update_emmc_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if ${get_cmd} ${update_sd_firmware_filename}; then if mmc dev ${emmcdev} 1; then setexpr fw_sz ${filesize} / 0x200; setexpr fw_sz ${fw_sz} + 1; mmc write ${loadaddr} 0x2 ${fw_sz}; fi; fi update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmware_filename}; then setexpr fw_sz ${filesize} / 0x200; setexpr fw_sz ${fw_sz} + 1; mmc write ${loadaddr} 0x2 ${fw_sz}; fi; fi weim_base=0x08000000 weim_uboot=0x08001000 Environment size: 4962/8188 bytes
适配 u-boot 下的以太网驱动,除了对照原理图,确认以太网驱动PHY 的 引脚配置,还需确认 u-boot 下配置的 PHY 型号是否一致,如【迅为imx6q】开发板,以太网 PHY 是 REALTEK
的 RTL8211E
以太网驱动 PHY,一般都需要 复位操作,增加delay 操作,新版本的u-boot,需要在设备树文件中增加。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。