PROCESSOR-SDK-J784S4: 使用sdk-linux-j784s4-evm-10_01_00_05,使用设备树k3-j784s4-evm-csi2-ov5640.dtbo启动linux后,使用devmem2读取dphy寄存器出现内核panic,请问是什么原因?该如何解决?

Part Number: PROCESSOR-SDK-J784S4

我使用了k3-j784s4-evm-csi2-ov5640.dtbo,启动后,使用lsmod查看,ov5640已正常加载上了,

但是使用devmem2读取dphy寄存器地址0x4504048出现内核panic。

除了0x04504048地址,我还尝试访问了0x4590B00, 0x04504040, 0x04504060, 0x04504100 等寄存器,均出现相同的panic。

  • # This uEnv.txt file can contain additional environment settings that you
    # want to set in U-Boot at boot time.  This can be simple variables such
    # as the serverip or custom variables.  The format of this file is:
    #    variable=value
    # NOTE: This file will be evaluated after the bootcmd is run and the
    #       bootcmd must be set to load this file if it exists (this is the
    #       default on all newer U-Boot images.  This also means that some
    #       variables such as bootdelay cannot be changed by this file since
    #       it is not evaluated until the bootcmd is run.
    psdk_setup_file=.psdk_setup
    check_psdk_setup=load mmc 1:1 ${loadaddr} ${psdk_setup_file}
    
    # Reset to the default environment
    do_psdk_setup=env default -f -a; saveenv
    
    # Update the Linux hostname based on board_name
    # The SK also requires an additional dtbo to boot. Prepend it to name_overlays depending on board_name
    uenvcmd=printenv
    
    # Setting the right U-Boot environment variables
    dorprocboot=1
    name_overlays=ti/k3-j784s4-evm-ethfw.dtbo ti/k3-j784s4-vision-apps.dtbo ti/k3-j784s4-evm-csi2-ov5640.dtbo
     
    Hi,Ti,
       当我在uEnv将dtbo的加载改成:
    name_overlays=ti/k3-j784s4-evm-ethfw.dtbo ti/k3-j784s4-vision-apps.dtbo ti/k3-j784s4-evm-csi2-ov5640.dtbo
       重启demo板后,使用devmem2访问 0x04504048,0x4590B00, 0x04504040, 0x04504060, 0x04504100 等寄存器,未出现panic,
    从dtso内看,仅仅是将k3-j784s4-vision-apps这个设备树先加载,然后再加载k3-j784s4-evm-csi2-ov5640,访问dphy寄存器就未出现panic.
    // SPDX-License-Identifier: GPL-2.0
    /*
     * vision-apps: device-tree overlay
     *
     * Copyright (C) 2019 - 2022 Texas Instruments Incorporated - http://www.ti.com/
     */
    
    /dts-v1/;
    /plugin/;
    
    #include <dt-bindings/mux/ti-serdes.h>
    
    &main_r5fss0_core0_shared_memory_queue_region {
    	status = "disabled";
    };
    
    &main_r5fss0_core0_shared_memory_bufpool_region {
    	status = "disabled";
    };
    
    #include "k3-j784s4-rtos-memory-map.dtsi"
    
    &main_i2c1 {
        status = "disabled";
    };
    
    &main_i2c4 {
    	status = "disabled";
    };
    
    &main_i2c5 {
    	status = "disabled";
    };
    
    &dss {
        status = "disabled";
    };
    
    &serdes_wiz4 {
        status = "disabled";
    };
    
    &ti_csi2rx0 {
        status = "disabled";
    };
    
    &ti_csi2rx1 {
        status = "disabled";
    };
    
    &ti_csi2rx2 {
        status = "disabled";
    };
    
    请问这其中的根本原因是什么?
    谢谢!
  • 您好

    这通常意味着该模块无法从 Linux 内核访问。 当您启用 dtbo 时、它已经初始化。 您能仔细检查一下吗?

  • Hi Ti, 

    demo 板启动后,lsmod查看如下,已经存在j721e_csi2rx,ov5640模块:

    root@j784s4-evm:~# lsmod
    Module                  Size  Used by
    overlay               139264  0
    cfg80211              397312  0
    bluetooth             503808  2
    ecdh_generic           16384  1 bluetooth
    ecc                    36864  1 ecdh_generic
    rfkill                 28672  3 bluetooth,cfg80211
    rpmsg_ctrl             12288  0
    rpmsg_char             20480  1 rpmsg_ctrl
    panel_edp              32768  0
    cdns_csi2rx            16384  1
    ti_am335x_adc          16384  0
    kfifo_buf              12288  1 ti_am335x_adc
    cdns3                  40960  0
    cdns_pltfrm            12288  0
    cdns_usb_common        20480  1 cdns3
    crct10dif_ce           12288  1
    snd_soc_j721e_evm      28672  0
    display_connector      12288  0
    omap_mailbox           12288  11
    omap_hwspinlock        12288  0
    phy_can_transceiver    12288  3
    at24                   16384  0
    ti_k3_r5_remoteproc    24576  0
    j721e_csi2rx           24576  0
    wave5                  94208  0
    ov5640                 36864  0
    videobuf2_dma_contig    16384  2 j721e_csi2rx,wave5
    videobuf2_memops       12288  1 videobuf2_dma_contig
    v4l2_mem2mem           32768  1 wave5
    snd_soc_davinci_mcasp    32768  2
    k3_j72xx_bandgap       12288  0
    v4l2_fwnode            20480  2 ov5640,cdns_csi2rx
    ...
    ..

    我仍然在uEnv.txt使用如下环境变量启动的,此刻devmem2 0x04590B00 w仍然会出现panic.

    # Setting the right U-Boot environment variables
    dorprocboot=1
    name_overlays=ti/k3-j784s4-evm-ethfw.dtbo ti/k3-j784s4-evm-csi2-ov5640.dtbo
  • Hi ti,

    查看设备树文件,

    主设备树文件中,如上所示:

    k3-j784s4-evm-csi2-ov5640.dtso中对status进行了覆盖,改写为okay,

    查找驱动文件,从compatible = "ti,j721e-csi2rx-shim";属性,在driver中找到对应的驱动文件为\board-support\ti-linux-kernel-6.6.44+git-ti\drivers\media\platform\ti\j721e-csi2rx\j721e-csi2rx.c,

    板子起来后,lsmod查看,确实是加载了j721e_csi2rx.ko,以及ov5640.ko,

    查看j721e-csi2rx.c,初始化过程中会注册v4l2设备"TI-CSI2RX"

    板子起来后,查看v4l2设备

    root@j784s4-evm:/var# v4l2-ctl --list-devices
    wave5-dec (platform:4210000.video-codec):
    /dev/video0
    /dev/video1
    wave5-dec (platform:4220000.video-codec):
    /dev/video2
    /dev/video3
    TI-CSI2RX (platform:4520000.ticsi2rx):
    /dev/media0