20190116_jeffrey - silenceuncrio/diary GitHub Wiki

0900

M300 - WiFi: warm reboot cause hang 要解在 branch hotfix/v1.76-wifi-eva

昨天已 pull 最新的 branch hotfix/v1.76-wifi-eva

也 build 了 image

mfgtool 燒錄

放到 morris 有特別為了 WiFi 修改的 PCBA 上 - GPIO for IO control power

上電

一直等到 console 亮燈已經是第二次開機的事了(第一次會套用 uboot_env_ver 1.3 並因不知明原因重開機)

在 linux 觀察開機的關鍵 uboot env

bootcmd - 被指定成 run bootcmd_v1.3

root@M301-GW:~# fw_printenv bootcmd
bootcmd=run bootcmd_v1.3

bootcmd_v1.3 - 真正的 bootcmd

root@M301-GW:~# fw_printenv bootcmd_v1.3
bootcmd_v1.3=run turnon_sysled; run reset_ethernet_and_mobile;
run app_choose;
echo run bootargs_${app_primary}; run bootargs_${app_primary};
run nandread_${app_primary};
setenv no_good ${no_good}x;
saveenv;
bootz ${loadaddr} - ${fdt_addr}

check 一下目前開機要注意的點

rc.local

# apply the uboot env variables related to current application
/usr/sbin/icos/uboot_env.sh

# run bootcmd_v1.3 define in uboot_env.sh
fw_setenv bootcmd 'run bootcmd_v1.3'
  • 每一次都會去把 bootcmd 寫成 'run bootcmd_v1.3'

uboot_env.sh

uboot_env_ver=1.3

if fw_printenv uboot_env_ver | grep $uboot_env_ver
then
  echo "uboot_env_ver $uboot_env_ver match, nothing to do"
  exit 0
else
  echo "uboot_env_ver not match, patching for the current applicaiton"
fi


...

fw_setenv bootcmd_v1.3 'run turnon_sysled; run reset_ethernet_and_mobile; \
run app_choose; \
echo run bootargs_${app_primary}; run bootargs_${app_primary}; \
run nandread_${app_primary}; \
setenv no_good ${no_good}x; \
saveenv; \
bootz ${loadaddr} - ${fdt_addr}'

# set the current uboot env version into uboot env MTD
fw_setenv uboot_env_ver $uboot_env_ver
  • 如果當前的 uboot_env_ver 不是 1.3 的話就重新把 1.3 的 uboot env 設定全部寫一遍

因為 dual image 的機制

我們無法避免因為 switch partition 的關係

讓上述的 rc.local 再跑一遍把 bootcmd 又改掉

思考一下假設有 10% 的機率發生這件事

10% 裡面應該有 90 % 都是把 把 bootcmd 寫成 'run bootcmd_v1.3' (有更早的 bootcmd_v1.2 和 bootcmd_v1.1)

看一下 bootcmd_v1.3 做了什麼

fw_setenv bootcmd_v1.3 'run turnon_sysled; run reset_ethernet_and_mobile; \
run app_choose; \
echo run bootargs_${app_primary}; run bootargs_${app_primary}; \
run nandread_${app_primary}; \
setenv no_good ${no_good}x; \
saveenv; \
bootz ${loadaddr} - ${fdt_addr}'

就比我預期的重複做了 run turnon_sysledrun reset_ethernet_and_mobile

會有什麼壞處嗎...

run turnon_sysled

  • 點亮已經被 uboot 點亮的 led
  • 完全沒影響

run reset_ethernet_and_mobile

  • ethernet 1 和 ethernet 2 被重新 reset
  • mobile 被重新 reset
  • 就是在 uboot 很短的時間裡 reset 了兩次

看來應該沒什麼副作用

我應該可以完全不去管這件事才對

看來昨天特別把 uboot_env_ver 改成 v1.4 也沒必要了

後續 rc.local 已經不去干預 uboot env 了

mx6ul_14x14_evk.h 的改法應該是這樣

diff --git a/mx6ul_14x14_evk.h b/mx6ul_14x14_evk.h
index d9dde86..9fcd885 100644
--- a/mx6ul_14x14_evk.h
+++ b/mx6ul_14x14_evk.h
@@ -205,13 +205,12 @@
         "else echo b to a; setenv app_primary a; setenv app_secondary b;" \
         "fi\0" \
     "no_good=.\0" \
-    "uboot_env_ver=1.0\0" \
+    "uboot_env_ver=1.3\0" \
        \
        /* do not allow user stop autoboot - no chance to change the uboot env */ \
        "bootdelay=0\0" \
        \
-    "bootcmd=mw 0x020A0004 00100000 1; mw 0x020E01CC 0x00000005 1;" \
-        "run app_choose;" \
+    "bootcmd=run app_choose;" \
         "echo run bootargs_${app_primary}; run bootargs_${app_primary};" \
         "run nandread_${app_primary};" \
         "setenv no_good ${no_good}x; saveenv;" \

這樣就算有 10% 的 partition switch 也能擋住 90% 的 uboot_evn_ver=1.3 重新再寫一整個 1.3 的 uboot env

先來修一下昨天的 branch v1.75-mfg

commit 15393022740b87115f98da44c3c3d3e16bf6d803
Refs: [v1.75-mfg]
Author: jeffrey <[email protected]>
Date:   Wed Jan 16 11:33:16 2019 +0800

    rename uboot_env_v1.4.patch to do_some_actions_at_board_init.patch
    - uboot_env_ver=1.3

 .../files/do_some_actions_at_board_init.patch      | 131 +++++++++++++++++++++
 .../recipes-bsp/u-boot/files/uboot_env_v1.4.patch  | 131 ---------------------
 .../recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend |   2 +-
 3 files changed, 132 insertions(+), 132 deletions(-)

1140

切回 hotfix/v1.76-wifi-eva

直接套 v1.75-mfg 的改變

diff --git a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
index 43cd031..12d003a 100644
--- a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
+++ b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
@@ -6,6 +6,7 @@ SRC_URI_append = " \
     file://set_do_default_low.patch \
     file://modify_bootup_temperature_limit.patch \
     file://fix_thermal.patch \
+    file://do_some_actions_at_board_init.patch \
 "

 SRC_URI_append_m300 = " \
diff --git a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
index d5211ca..d3b8d25 100644
--- a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
@@ -39,12 +39,6 @@ function core_uboot_env_loose_indicate {
 # recover the corrupt /etc/passwd file
 /usr/sbin/icos/passwd_recover.sh

-# apply the uboot env variables related to current application
-/usr/sbin/icos/uboot_env.sh
-
-# run bootcmd_v1.3 define in uboot_env.sh
-fw_setenv bootcmd 'run bootcmd_v1.3'
-


 app_a_mtdn=5
diff --git a/proscend/tools/firmware_patch.sh b/proscend/tools/firmware_patch.sh
old mode 100755
new mode 100644
index 3996ce4..0f507b7
--- a/proscend/tools/firmware_patch.sh
+++ b/proscend/tools/firmware_patch.sh
@@ -6,7 +6,12 @@
 function patch_nandflash {
   echo "patch for NAND Flash storage memory ..."

-  echo "Nothing to do"
+  echo "Burn the uboot to NAND..."
+  echo "Erasing Boot partition"
+  flash_erase /dev/mtd0 0 0
+  echo "Flashing Bootloader"
+  kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /tmp/firmware/u-boot-m300.imx-nand
+#  echo "Nothing to do"

   echo "patch for NAND Flash storage memory succeeded"
 }

build image

1300

套用 patch 的過程出了錯

user@be6d814a16da:~/build_small$ bitbake u-boot-imx -c patch -v                                                                                                                                           [28/1893]
Loading cache: 100% |##############################################################################################################################################################################| ETA:  00:00:00
Loaded 2778 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: selecting pseudo-native to satisfy virtual/fakeroot-native due to PREFERRED_PROVIDERS
NOTE: selecting gcc-cross-arm to satisfy virtual/arm-poky-linux-gnueabi-gcc due to PREFERRED_PROVIDERS
NOTE: selecting gcc-runtime to satisfy virtual/arm-poky-linux-gnueabi-compilerlibs due to PREFERRED_PROVIDERS
NOTE: selecting glibc to satisfy virtual/libc due to PREFERRED_PROVIDERS
NOTE: selecting u-boot-imx to satisfy runtime u-boot-imx due to PREFERRED_PROVIDER_virtual/bootloader = u-boot-imx
NOTE: selecting u-boot-imx to satisfy runtime u-boot-imx-dev due to PREFERRED_PROVIDER_virtual/bootloader = u-boot-imx
NOTE: selecting glibc to satisfy runtime libsegfault due to PREFERRED_PROVIDER_virtual/libc = glibc
NOTE: selecting glibc to satisfy runtime glibc-dev due to PREFERRED_PROVIDER_virtual/libc = glibc
NOTE: selecting glibc to satisfy runtime glibc due to PREFERRED_PROVIDER_virtual/libc = glibc
NOTE: selecting binutils-cross-arm to satisfy virtual/arm-poky-linux-gnueabi-binutils due to PREFERRED_PROVIDERS
NOTE: selecting glibc to satisfy virtual/arm-poky-linux-gnueabi-libc-for-gcc due to PREFERRED_PROVIDERS
NOTE: selecting linux-libc-headers to satisfy linux-libc-headers due to PREFERRED_PROVIDERS
NOTE: selecting gcc-cross-arm to satisfy virtual/arm-poky-linux-gnueabi-g++ due to PREFERRED_PROVIDERS
NOTE: selecting libgcc to satisfy libgcc due to PREFERRED_PROVIDERS
NOTE: selecting gcc-cross-initial-arm to satisfy virtual/arm-poky-linux-gnueabi-gcc-initial due to PREFERRED_PROVIDERS
NOTE: selecting glibc-initial to satisfy virtual/arm-poky-linux-gnueabi-libc-initial due to PREFERRED_PROVIDERS
NOTE: selecting linux-libc-headers to satisfy runtime linux-libc-headers-dev due to PREFERRED_PROVIDER_linux-libc-headers = linux-libc-headers
NOTE: selecting libgcc to satisfy runtime libgcc due to PREFERRED_PROVIDER_libgcc = libgcc

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "m300"
DISTRO            = "proscend-m300"
DISTRO_VERSION    = "4.1.15-1.2.0"
TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa7"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto        = "HEAD:dd0ba9ea4a11ab15348d4fe3574e4b28784db82f"
meta-oe
meta-multimedia   = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-fsl-arm      = "HEAD:35b8b9bd9863de208ab60e33b55f10ee43e2619b"
meta-fsl-arm-extra = "HEAD:e200df91b70da254461c59082ddd5db0a3c415a2"
meta-fsl-demos    = "HEAD:2231e946e7a94d096394f2b2477e8184c9bbde7b"
meta-bsp
meta-sdk          = "HEAD:dfbc90ee74624ce3be636c8bd2a47114fa2b71aa"
meta-browser      = "HEAD:b6d46d69a261fe6bd7c1e9811dc2a9bbd0b79aeb"
meta-qt5          = "HEAD:d5536e34ec985c82b621448ab4325e5cbba38560"
meta-networking
meta-python
meta-ruby
meta-filesystems
meta-gnome        = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-proscend     = "hotfix/v1.76-wifi-eva:61ee993922548efa0f69bdc1b96531af27ff9005"


NOTE: Preparing RunQueue
NOTE: Marking Active Tasks
NOTE: Pruned 1286 inactive tasks, 10 left
NOTE: Assign Weightings
NOTE: Compute totals (have 1 endpoint(s))
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Applying patch '000_enable_ENET_CLK_when_booting.patch' (../meta-proscend/recipes-bsp/u-boot/files/000_enable_ENET_CLK_when_booting.patch)
NOTE: Applying patch 'add_mx6ul_14x14_evk_nand_config.patch' (../meta-proscend/recipes-bsp/u-boot/files/add_mx6ul_14x14_evk_nand_config.patch)
NOTE: Applying patch 'set_do_default_low.patch' (../meta-proscend/recipes-bsp/u-boot/files/set_do_default_low.patch)
NOTE: Applying patch 'modify_bootup_temperature_limit.patch' (../meta-proscend/recipes-bsp/u-boot/files/modify_bootup_temperature_limit.patch)
NOTE: Applying patch 'fix_thermal.patch' (../meta-proscend/recipes-bsp/u-boot/files/fix_thermal.patch)
NOTE: Applying patch 'do_some_actions_at_board_init.patch' (../meta-proscend/recipes-bsp/u-boot/files/do_some_actions_at_board_init.patch)
ERROR: Command Error: exit status: 1  Output:
Applying patch do_some_actions_at_board_init.patch
patching file board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
patching file include/configs/mx6ul_14x14_evk.h
Hunk #1 FAILED at 205.
1 out of 1 hunk FAILED -- rejects in file include/configs/mx6ul_14x14_evk.h
Patch do_some_actions_at_board_init.patch does not apply (enforce with -f)
ERROR: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/user/build_small/tmp/work/m300-poky-linux-gnueabi/u-boot-imx/2015.04-r0/temp/log.do_patch.36922
ERROR: Task 1 (/home/user/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb, do_patch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 10 tasks of which 9 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/user/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb, do_patch
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

乖乖地用 quilt 吧

先切到 u-boot-imx 所在的 source code 目錄之下

➜  M300 git:(hotfix/v1.76-wifi-eva) ✗ cd build_small/tmp/work/m300-poky-linux-gnueabi/u-boot-imx/2015.04-r0/git

quilt new do_some_actions_at_board_init.patch

➜  git git:(imx_v2015.04_4.1.15_1.0.0_ga) quilt new do_some_actions_at_board_init.patch
Patch patches/do_some_actions_at_board_init.patch is now on top

加入待會要改的 files

➜  git git:(imx_v2015.04_4.1.15_1.0.0_ga) quilt add board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
File board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c added to patch patches/do_some_actions_at_board_init.patch
➜  git git:(imx_v2015.04_4.1.15_1.0.0_ga) quilt add include/configs/mx6ul_14x14_evk.h
File include/configs/mx6ul_14x14_evk.h added to patch patches/do_some_actions_at_board_init.patch

修改

使用 quilt regresh 產生 do_some_actions_at_board_init.patch

➜  git git:(imx_v2015.04_4.1.15_1.0.0_ga) quilt refresh
Refreshed patch patches/do_some_actions_at_board_init.patch

將產生 do_some_actions_at_board_init.patch 複製到 M300\meta-proscend\recipes-bsp\u-boot\files

修改 meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend

diff --git a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
index 43cd031..c7e24eb 100644
--- a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
+++ b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
@@ -14,6 +14,7 @@ SRC_URI_append_m300 = " \
     file://remove_fsl_usdhc_and_vedio.patch \
     file://use_usdhc_pad_ctrl_in_gpmi_pad_ctrl.patch \
     file://zero_bootdelay.patch \
+    file://do_some_actions_at_board_init.patch \
 "

 SRC_URI_append_m300e = " \

build image... ok

1335

使用剛剛 build 出來的 image 透過 web ui 做 firmware upgrade

驗證是否有做 uboot upgrade 的動作

上電約一秒鐘 sysled 便會亮起

同時 console 也會 output 訊息

蜍瀅檽In:    serial
Out:   serial
Err:   serial
Net:   Phy 1 not found
PHY reset timed out
FEC1
Error: FEC1 address not set.

Normal Boot
Hit any key to stop autoboot:  0
run primary app
run bootargs_b
bootargs for room b

NAND read: device 0 offset 0x8400000, size 0x800000
 8388608 bytes read: OK

NAND read: device 0 offset 0x8e00000, size 0x100000
 1048576 bytes read: OK
Saving Environment to NAND...
Erasing NAND...
Erasing at 0x3e0000 -- 100% complete.
Writing to NAND... OK
Kernel image @ 0x80800000 [ 0x000000 - 0x4ea270 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300a23c

Starting kernel ...

看來是有更新到 uboot

所以對於 firmware_patch.sh 的改動是正確的

試著用這個版本的 mfgtool 作燒錄來測試一下

PASS

看來可以拿給 morris 做測試了

1445

morris 利用 軟體的 restart 測個幾次就發現有一次 IO control power 那跟 GPIO 沒有拉成 low

而且從示波器觀察的結果是從 low 到 high 時

low 的波型至少維持了一秒

uboot 裡控制 IO control power 的 code 如下

int board_init(void)
{
	/* Address of boot parameters */
	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

	imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));



    /*
    ** IO control power - GPIO4-IO21
    ** +----------+--------+------------+------+
    ** | Instance | Signal | Pad        | Mode |
    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
    ** +----------+--------+------------+------+
    **
    ** 0 - off
    ** 1 - on
    **
    ** off the IO control power then on
    */
    printf("off the IO control power then on\n");
    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
    mdelay(100);
    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);

    ...

}

我看我再修改一下

順便讓 rc.local 在做完的時候順便 reboot

看看會不會卡住

rc.local

diff --git a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
index d5211ca..e1c5db4 100644
--- a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
@@ -39,12 +39,6 @@ function core_uboot_env_loose_indicate {
 # recover the corrupt /etc/passwd file
 /usr/sbin/icos/passwd_recover.sh

-# apply the uboot env variables related to current application
-/usr/sbin/icos/uboot_env.sh
-
-# run bootcmd_v1.3 define in uboot_env.sh
-fw_setenv bootcmd 'run bootcmd_v1.3'
-


 app_a_mtdn=5
@@ -349,4 +343,14 @@ telnetd &
 #sleep 3
 sleep 1

+
+
+################################
+# jeffrey test
+sleep 7
+/usr/sbin/icosconfig coldreboot
+################################
+
+
+
 /usr/sbin/read_modem &

do_some_actions_at_board_init.patch

Index: git/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
===================================================================
--- git.orig/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ git/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -912,6 +912,111 @@ int board_init(void)
 
 	imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));
 
+
+
+    /*
+    ** IO control power - GPIO4-IO21
+    ** +----------+--------+------------+------+
+    ** | Instance | Signal | Pad        | Mode |
+    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
+    ** +----------+--------+------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** off the IO control power then on
+    */
+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(100);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(100);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(300);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);
+    mdelay(700); // power on then delay a while
+
+    /*
+    ** sys led - GPIO2-IO20
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO20   | SD1_DATA2 | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    */
+    printf("turn on sys led\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 20) , 0);
+
+    /*
+    ** LTE SIM Select - GPIO2-IO17
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO17   | SD1_CLK   | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - SIM1
+    ** 1 - SIM2
+    **
+    ** select SIM1
+    */
+    printf("select SIM1\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 17) , 0);
+
+    /*
+    ** Ethernet 1 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO30   | UART5_TX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 1
+    */
+    printf("reset Ethernet 1\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 1);
+
+    /*
+    ** Ethernet 2 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO31   | UART5_RX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 2
+    */
+    printf("reset Ethernet 2\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 1);
+
+    /*
+    ** Mobile Reset PIN - GPIO5-IO7
+    ** +----------+--------+--------------+-----------------+
+    ** | Instance | Signal | Pad          | Mode            |
+    ** | GPIO5    | IO7    | SNVS_TAMPER7 | No Muxing(ALT5) |
+    ** +----------+--------+--------------+-----------------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Mobile
+    */
+    printf("reset Mobile\n");
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 1);
+
+
+
 	iox74lv_init();
 
 #ifdef CONFIG_SYS_I2C_MXC
Index: git/include/configs/mx6ul_14x14_evk.h
===================================================================
--- git.orig/include/configs/mx6ul_14x14_evk.h
+++ git/include/configs/mx6ul_14x14_evk.h
@@ -205,13 +205,12 @@
         "else echo b to a; setenv app_primary a; setenv app_secondary b;" \
         "fi\0" \
     "no_good=.\0" \
-    "uboot_env_ver=1.0\0" \
+    "uboot_env_ver=1.3\0" \
 	\
 	/* do not allow user stop autoboot - no chance to change the uboot env */ \
 	"bootdelay=0\0" \
 	\
-    "bootcmd=mw 0x020A0004 00100000 1; mw 0x020E01CC 0x00000005 1;" \
-        "run app_choose;" \
+    "bootcmd=run app_choose;" \
         "echo run bootargs_${app_primary}; run bootargs_${app_primary};" \
         "run nandread_${app_primary};" \
         "setenv no_good ${no_good}x; saveenv;" \

build image

1520

mfgtool 作燒錄

1525

上電開始測試

1620

真的發生了

1715

再度修改如下

diff --git a/mx6ul_14x14_evk.c b/mx6ul_14x14_evk.c
index e38653e..f556638 100644
--- a/mx6ul_14x14_evk.c
+++ b/mx6ul_14x14_evk.c
@@ -907,11 +907,121 @@ void ldo_mode_set(int ldo_bypass)

 int board_init(void)
 {
+    int ret;
+
        /* Address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

        imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));

+
+
+    /*
+    ** IO control power - GPIO4-IO21
+    ** +----------+--------+------------+------+
+    ** | Instance | Signal | Pad        | Mode |
+    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
+    ** +----------+--------+------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** off the IO control power then on
+    */
+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    udelay(500);
+    ret = gpio_get_value(IMX_GPIO_NR(4, 21));
+    while (ret != 0) {
+        setenv("io_control_power_low", "fail");
+        printf("off the IO control power fail, try again!\n");
+        gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+        udelay(500);
+        ret = gpio_get_value(IMX_GPIO_NR(4, 21));
+    }
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);
+
+    /*
+    ** sys led - GPIO2-IO20
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO20   | SD1_DATA2 | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    */
+    printf("turn on sys led\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 20) , 0);
+
+    /*
+    ** LTE SIM Select - GPIO2-IO17
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO17   | SD1_CLK   | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - SIM1
+    ** 1 - SIM2
+    **
+    ** select SIM1
+    */
+    printf("select SIM1\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 17) , 0);
+
+    /*
+    ** Ethernet 1 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO30   | UART5_TX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 1
+    */
+    printf("reset Ethernet 1\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 1);
+
+    /*
+    ** Ethernet 2 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO31   | UART5_RX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 2
+    */
+    printf("reset Ethernet 2\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 1);
+
+    /*
+    ** Mobile Reset PIN - GPIO5-IO7
+    ** +----------+--------+--------------+-----------------+
+    ** | Instance | Signal | Pad          | Mode            |
+    ** | GPIO5    | IO7    | SNVS_TAMPER7 | No Muxing(ALT5) |
+    ** +----------+--------+--------------+-----------------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Mobile
+    */
+    printf("reset Mobile\n");
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 1);
+
+
+
        iox74lv_init();

 #ifdef CONFIG_SYS_I2C_MXC
diff --git a/mx6ul_14x14_evk.h b/mx6ul_14x14_evk.h
index d9dde86..9fcd885 100644
--- a/mx6ul_14x14_evk.h
+++ b/mx6ul_14x14_evk.h
@@ -205,13 +205,12 @@
         "else echo b to a; setenv app_primary a; setenv app_secondary b;" \
         "fi\0" \
     "no_good=.\0" \
-    "uboot_env_ver=1.0\0" \
+    "uboot_env_ver=1.3\0" \
        \
        /* do not allow user stop autoboot - no chance to change the uboot env */ \
        "bootdelay=0\0" \
        \
-    "bootcmd=mw 0x020A0004 00100000 1; mw 0x020E01CC 0x00000005 1;" \
-        "run app_choose;" \
+    "bootcmd=run app_choose;" \
         "echo run bootargs_${app_primary}; run bootargs_${app_primary};" \
         "run nandread_${app_primary};" \
         "setenv no_good ${no_good}x; saveenv;" \

放著測試吧

1740

一下子就試出來了

reboot: Restarting system


U-Boot 2015.04imx_v2015.04_4.1.15_1.2.0_ga+gede7538 (Jan 16 2019 - 09:29:22)

CPU:   Freescale i.MX6UL rev1.1 at 396 MHz
CPU:   Temperature 46 C
Reset cause: WDOG
Board: MX6UL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
off the IO control power then on
turn on sys led
select SIM1
reset Ethernet 1
reset Ethernet 2
reset Mobile
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   Phy 1 not found
PHY reset timed out
FEC1
Error: FEC1 address not set.

Normal Boot
Hit any key to stop autoboot:  0
run primary app
run bootargs_a
bootargs for room a

NAND read: device 0 offset 0x400000, size 0x800000
 8388608 bytes read: OK

NAND read: device 0 offset 0xe00000, size 0x100000
 1048576 bytes read: OK
Saving Environment to NAND...
Erasing NAND...
Erasing at 0x3e0000 -- 100% complete.
Writing to NAND... OK
Kernel image @ 0x80800000 [ 0x000000 - 0x4ea270 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300a23c

Starting kernel ...

...

### module <l2tp> init
### module <schedule-reboot> init
### module <wifi_apsta> init

更好笑的是 gpio_get_value(IMX_GPIO_NR(4, 21)); 也完全沒有異常

+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    udelay(500);
+    ret = gpio_get_value(IMX_GPIO_NR(4, 21));
+    while (ret != 0) {
+        setenv("io_control_power_low", "fail");
+        printf("off the IO control power fail, try again!\n");
+        gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+        udelay(500);
+        ret = gpio_get_value(IMX_GPIO_NR(4, 21));
+    }
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);

感覺就是要依賴 pull low 完 delay 的時間

1750

+    /*
+    ** IO control power - GPIO4-IO21
+    ** +----------+--------+------------+------+
+    ** | Instance | Signal | Pad        | Mode |
+    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
+    ** +----------+--------+------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** off the IO control power then on
+    */
+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(2000);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);

一次停個 2 秒吧

放著測吧

⚠️ **GitHub.com Fallback** ⚠️