This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] PHYTC-3P-PHYCORE-AM335X:U-boot GPIO HOG 和 GPIO 命令错误-38

Guru**** 633805 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1160672/phytc-3p-phycore-am335x-u-boot-gpio-hog-and-gpio-command-error-38

器件型号:PHYTC-3P-PHYCORE-AM335X

您好!

我正在尝试使用 U-boot v2021.04 (commit hash:b46dd116ce03e235f2a7d4843c6278e1da44b5e1 )在基于 PHYCORE-AM335X 的定制板上设置 GPIO 引脚(GPIO0[23])始终处于高电平。 我通过从 AM335x-icev2.dts 文件中获取引用来配置下面的 DTS 文件

&am33xx_pinmux {

    system_busy_light: system_busy_light{
    pinctrl-single,pins = <
            AM33XX_IOPAD(0x824, PIN_OUTPUT_PULLUP | MUX_MODE7) 
        >;
    };
};

&gpio0 {

	pinctrl-names = "default";
	pinctrl-0 = <&system_busy_light>;
	status = "okay";
	ti,no-reset-on-init;

	p23 {
		gpio-hog;
		gpios = <23 GPIO_ACTIVE_HIGH>;
		output-high;
		line-name = "SYSTEM_BUSY_LIGHT";
	};
};

这不会使 GPIO 引脚硬接。

后来尝试通过 mux.c 文件启用引脚多路复用、并使用"GPIO Set"命令  

static struct module_pin_mux shutdown_pin_mux[] = {
	{OFFSET(gpmc_ad9), (MODE(7) | PULLUP_EN)}, /* SYSTEM BUSY LIGHT  */
	{-1},
};

void enable_board_pin_mux(void)
{
    configure_module_pin_mux(shutdown_pin_mux);
}

当我停止 u-boot 并使用"GPIO status -a"或"GPIO set 23"时、我会得到这些错误

GPIO:找不到"23"
命令"GPIO"失败:错误-38

CONFIG_ARM=y
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_OMAP2PLUS=y
CONFIG_TI_COMMON_CMD_OPTIONS=y
CONFIG_AM33XX=y
CONFIG_TARGET_AM335X_base=y
CONFIG_SPL=y
CONFIG_SYS_EXTRA_OPTIONS=""
CONFIG_DEFAULT_DEVICE_TREE="am335x-base"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_SPL_LOAD_FIT=y
# CONFIG_USE_SPL_FIT_GENERATOR is not set
CONFIG_OF_BOARD_SETUP=y
CONFIG_SYS_PROMPT="base# "
CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi;run findfdt; run init_console; run mmcboot"
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
CONFIG_AUTOBOOT_DELAY_STR="d"
CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_LOGLEVEL=3
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_ARCH_MISC_INIT=y
CONFIG_SPL_ALLOC_BD=y
CONFIG_SPL_FIT_IMAGE_TINY=y
CONFIG_SPL_ETH_SUPPORT=y
#CONFIG_SPL_FS_EXT4 is not set
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_SPL_MUSB_NEW_SUPPORT=y
CONFIG_SPL_NAND_DRIVERS=y
CONFIG_SPL_NAND_ECC=y
CONFIG_SPL_NAND_BASE=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_SPL_USB_GADGET=y
CONFIG_SPL_USB_ETHER=y
CONFIG_CMD_SPL=y
CONFIG_CMD_SPL_NAND_OFS=0x00080000
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_SETEXPR is not set
CONFIG_BOOTP_DNS2=y
CONFIG_CMD_MTDPARTS=y
# CONFIG_SPL_EFI_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_ENV_OVERWRITE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
#CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_SPL_ENV_IS_NOWHERE=y
CONFIG_VERSION_VARIABLE=y
CONFIG_BOOTP_SEND_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_DFU=y
CONFIG_DFU_OVER_USB=y
CONFIG_DFU_MMC=y
CONFIG_DFU_MTD=y
CONFIG_DFU_NAND=y
CONFIG_DFU_RAM=y
CONFIG_DFU_SF=y
CONFIG_DFU_SF_PART=y
CONFIG_DFU_TIMEOUT=y
CONFIG_DFU_VIRTUAL=y
CONFIG_CMD_DFU=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
CONFIG_CMD_MMC=y
#CONFIG_CMD_NAND=y
#CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
CONFIG_CMD_I2C=y
#CONFIG_CMD_USB=y
CONFIG_CMD_GPIO=y
CONFIG_OMAP_GPIO=y
CONFIG_MISC=y
CONFIG_DM_MMC=y
CONFIG_DM=y
CONFIG_DM_GPIO=y
# CONFIG_MMC_HW_PARTITIONING is not set
CONFIG_MMC_OMAP_HS=y
CONFIG_MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SF_DEFAULT_SPEED=24000000
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_PHY_ATHEROS=y
CONFIG_PHY_SMSC=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_DM_USB_GADGET=y
CONFIG_SPL_DM_USB_GADGET=y
CONFIG_USB_MUSB_HOST=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_MUSB_TI=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
CONFIG_USB_GADGET_VENDOR_NUM=0x0451
CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
CONFIG_USB_ETHER=y
CONFIG_WDT=y
CONFIG_SPL_BANNER_PRINT=n
# CONFIG_SPL_WDT is not set
CONFIG_DYNAMIC_CRC_TABLE=y
CONFIG_RSA=y
CONFIG_LZO=y
CONFIG_CONS_INDEX=3
CONFIG_SYS_NS16550=y

供参考:当我在 Linux 内核(V5.10.65)中进行配置时、GPIO-hog 工作正常。 我想将这个特定的 GPIO 设置为从启动开始时一直为高电平。

提前感谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!
    下面是有关 GPIO @u-boot 的早期 E2E 帖子、供您参考。
    e2e.ti.com/.../3977341
    e2e.ti.com/.../3810514
    e2e.ti.com/.../3678289
    最棒的
    -香港

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    下面附加的日志是 u-boot 提示符的输出。

    base# gpio status -a
    Command 'gpio' failed: Error -38
    base# dm tree
     Class     Index  Probed  Driver                Name
    -----------------------------------------------------------
     root          0  [ + ]   root_driver           root_driver
     rsa_mod_ex    0  [   ]   mod_exp_sw            |-- mod_exp_sw
     simple_bus    0  [ + ]   simple_bus            |-- ocp
     simple_bus    1  [ + ]   simple_bus            |   |-- l4_wkup@44c00000
     simple_bus    2  [   ]   simple_bus            |   |   |-- segment@0
     simple_bus    3  [   ]   simple_bus            |   |   |-- segment@100000
     simple_bus    4  [ + ]   simple_bus            |   |   `-- segment@200000
     simple_bus    5  [   ]   ti_sysc               |   |       |-- target-module@0
     simple_bus    6  [   ]   simple_bus            |   |       |   `-- prcm@0
     simple_bus    7  [   ]   simple_bus            |   |       |       `-- clocks
     simple_bus    8  [   ]   ti_sysc               |   |       |-- target-module@7000
     gpio          0  [   ]   gpio_omap             |   |       |   `-- gpio@0
     simple_bus    9  [   ]   ti_sysc               |   |       |-- target-module@9000
     simple_bus   10  [   ]   ti_sysc               |   |       |-- target-module@b000
     simple_bus   11  [   ]   ti_sysc               |   |       |-- target-module@d000
     simple_bus   12  [   ]   ti_sysc               |   |       |-- target-module@10000
     simple_bus   13  [   ]   simple_bus            |   |       |   `-- scm@0
     simple_bus   14  [   ]   simple_bus            |   |       |       `-- scm_conf@0
     simple_bus   15  [   ]   simple_bus            |   |       |           `-- clocks
     simple_bus   16  [   ]   ti_sysc               |   |       |-- target-module@35000
     simple_bus   17  [   ]   ti_sysc               |   |       `-- target-module@3e000
     simple_bus   18  [ + ]   simple_bus            |   |-- interconnect@48000000
     simple_bus   19  [ + ]   simple_bus            |   |   |-- segment@0
     simple_bus   20  [   ]   ti_sysc               |   |   |   |-- target-module@22000
     simple_bus   21  [   ]   ti_sysc               |   |   |   |-- target-module@24000
     serial        0  [   ]   omap_serial           |   |   |   |   `-- serial@0
     simple_bus   22  [   ]   ti_sysc               |   |   |   |-- target-module@2a000
     simple_bus   23  [   ]   ti_sysc               |   |   |   |-- target-module@30000
     simple_bus   24  [   ]   ti_sysc               |   |   |   |-- target-module@38000
     simple_bus   25  [   ]   ti_sysc               |   |   |   |-- target-module@3c000
     simple_bus   26  [   ]   ti_sysc               |   |   |   |-- target-module@4c000
     gpio          1  [   ]   gpio_omap             |   |   |   |   `-- gpio@0
     simple_bus   27  [   ]   ti_sysc               |   |   |   |-- target-module@60000
     simple_bus   28  [   ]   ti_sysc               |   |   |   |-- target-module@80000
     simple_bus   29  [   ]   ti_sysc               |   |   |   |-- target-module@c8000
     simple_bus   30  [   ]   ti_sysc               |   |   |   `-- target-module@ca000
     simple_bus   31  [   ]   simple_bus            |   |   |-- segment@100000
     simple_bus   32  [   ]   ti_sysc               |   |   |   |-- target-module@9c000
     simple_bus   33  [   ]   ti_sysc               |   |   |   |-- target-module@a0000
     simple_bus   34  [   ]   ti_sysc               |   |   |   |-- target-module@a6000
     simple_bus   35  [   ]   ti_sysc               |   |   |   |-- target-module@a8000
     simple_bus   36  [   ]   ti_sysc               |   |   |   |-- target-module@aa000
     simple_bus   37  [   ]   ti_sysc               |   |   |   |-- target-module@ac000
     gpio          2  [   ]   gpio_omap             |   |   |   |   `-- gpio@0
     simple_bus   38  [   ]   ti_sysc               |   |   |   |-- target-module@ae000
     gpio          3  [   ]   gpio_omap             |   |   |   |   `-- gpio@0
     simple_bus   39  [   ]   ti_sysc               |   |   |   |-- target-module@cc000
     simple_bus   40  [   ]   ti_sysc               |   |   |   |-- target-module@d0000
     simple_bus   41  [   ]   ti_sysc               |   |   |   `-- target-module@d8000
     simple_bus   42  [   ]   simple_bus            |   |   |-- segment@200000
     simple_bus   43  [   ]   simple_bus            |   |   `-- segment@300000
     simple_bus   44  [   ]   ti_sysc               |   |       |-- target-module@0
     simple_bus   45  [   ]   ti_sysc               |   |       |-- target-module@2000
     simple_bus   46  [   ]   ti_sysc               |   |       |-- target-module@4000
     simple_bus   47  [   ]   ti_sysc               |   |       |-- target-module@e000
     simple_bus   48  [   ]   ti_sysc               |   |       `-- target-module@10000
     simple_bus   49  [   ]   simple_bus            |   |-- interconnect@47c00000
     simple_bus   50  [   ]   simple_bus            |   |   `-- segment@0
     simple_bus   51  [   ]   simple_bus            |   |-- interconnect@4a000000
     simple_bus   52  [   ]   simple_bus            |   |   `-- segment@0
     simple_bus   53  [   ]   ti_sysc               |   |       `-- target-module@100000
     simple_bus   54  [   ]   simple_bus            |   |-- interconnect@4b140000
     simple_bus   55  [   ]   simple_bus            |   |   `-- segment@0
     simple_bus   56  [   ]   ti_sysc               |   |-- target-module@49000000
     simple_bus   57  [   ]   ti_sysc               |   |-- target-module@49800000
     simple_bus   58  [   ]   ti_sysc               |   |-- target-module@49900000
     simple_bus   59  [   ]   ti_sysc               |   |-- target-module@49a00000
     mmc           0  [ + ]   omap_hsmmc            |   |-- mmc@48060000
     blk           0  [ + ]   mmc_blk               |   |   `-- mmc@48060000.blk
     mmc           1  [ + ]   omap_hsmmc            |   |-- mmc@481d8000
     blk           1  [   ]   mmc_blk               |   |   `-- mmc@481d8000.blk
     watchdog      0  [ + ]   omap3_wdt             |   |-- wdt@44e35000
     misc          0  [ + ]   ti-musb-wrapper       |   |-- usb@47400000
     usb           0  [ + ]   ti-musb-peripheral    |   |   |-- usb@47401000
     eth           1  [ + ]   usb_ether             |   |   |   `-- usb_ether
     usb           0  [   ]   ti-musb-host          |   |   `-- usb@47401800
     eth           0  [ + ]   eth_cpsw              |   |-- ethernet@4a100000
     simple_bus   60  [   ]   ti_sysc               |   |-- target-module@53100000
     simple_bus   61  [   ]   ti_sysc               |   |-- target-module@53500000
     simple_bus   62  [   ]   ti_sysc               |   `-- target-module@56000000
     serial        1  [ + ]   omap_serial           `-- serial@0
    base#gpio set 23
    GPIO: '23' not found
    Command 'gpio' failed: Error -38
    base#

    GPIO 命令在 u-boot 提示符下显示错误-38。

    用于测试的 MUX.c 文件。  

    static struct module_pin_mux shutdown_pin_mux[] = {
    	{OFFSET(gpmc_ad9), (MODE(7) | PULLUDEN)}, /* SYSTEM BUSY LIGHT  */
    	{-1},
    };
    
    
    void enable_board_pin_mux(void)
    {
        configure_module_pin_mux(shutdown_pin_mux);
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!
    我们是否检查了 u-boot 中内置的 cmd "gpio"?
    -什么是"GPIO"@u-boot 提示符的输出?
    -还是在 u-boot 构建中选中了"CONFIG_CMD_GPIO"复选框?
    最棒的
    -香港

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!


    这里是 u-boot 提示符的 cmd "gpio"的输出。

    base# gpio
    gpio - query and control gpio pins
    
    Usage:
    gpio <input|set|clear|toggle> <pin>
    - input/set/clear/toggle the specified pin
    gpio status [-a] [<bank> | <pin>] - show [all/claimed] GPIOs

    2.是的、在 u-boot 构建中选择了"CONFIG_CMD_GPIO"。 我在上面添加了配置文件。

    此致、

    -微突

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Hong、

    我尝试直接从 u-boot 提示符写入 GPIO 寄存器、并成功地将 GPIO 输出设置为高电平、正如我想要的那样。 请 找到以下日志。

    base#  md.l 0x44E10824
    44e10824: 00000007 00000030 00000030 00000030    ....0...0...0...
    44e10834: 00000030 00000030 00000030 00000027    0...0...0...'...
    44e10844: 00000027 00000027 00000027 00000027    '...'...'...'...
    44e10854: 00000027 00000027 00000027 00000027    '...'...'...'...
    44e10864: 00000027 00000027 00000027 00000030    '...'...'...0...
    44e10874: 00000037 00000008 00000008 00000037    7...........7...
    44e10884: 00000037 00000037 00000030 00000008    7...7...0.......
    44e10894: 00000008 00000008 00000008 0000002f    ............/...
    44e108a4: 0000002f 0000002f 0000002f 0000002f    /.../.../.../...
    44e108b4: 0000002f 0000002f 0000002f 0000002f    /.../.../.../...
    44e108c4: 0000002f 0000002f 0000002f 0000002f    /.../.../.../...
    44e108d4: 0000002f 0000002f 0000002f 00000027    /.../.../...'...
    44e108e4: 00000027 00000027 00000027 00000030    '...'...'...0...
    44e108f4: 00000030 00000030 00000030 00000030    0...0...0...0...
    44e10904: 00000030 00000027 00000027 00000027    0...'...'...'...
    44e10914: 00000027 00000027 00000027 00000027    '...'...'...'...
    base#  md.l 0x44E07134 1
    44e07134: ffffffff                               ....
    base#  md.l 0x44E0713C 1
    44e0713c: 00000000                               ....
    base# mw.l 0x44E07134 1
    base#  md.l 0x44E07134 1
    44e07134: 00000001                               ....
    base# mw.l 0x44E07134 0xff7fffff
    base#  md.l 0x44E07134 1
    44e07134: ff7fffff                               ....
    base# mw.l 0x44E0713C 0x00800000
    base#  md.l 0x44E0713C 1
    44e0713c: 00800000                               ....

    如何通过源代码使其正常工作?

    此致、

    -微突