我是靠谱客的博主 高高犀牛,最近开发中收集的这篇文章主要介绍i.MX8MP平台开发分享(IOMUX篇)- 查看pinctrl系统的debug信息,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

专栏目录:专栏目录传送门

平台内核
i.MX8MP5.15.71

文章目录

    • 1.pinctrl-handles
    • 2.pinctrl-devices
    • 3.pinctrl-maps
    • 4.30330000.pinctrl

在打开debugfs之后,我们会在 /sys/kernel/debug/pinctrl节点下看到以下内容。

root@imx8mpevk:/sys/kernel/debug/pinctrl# ls
30330000.pinctrl  pinctrl-devices  pinctrl-handles  pinctrl-maps

下面我们依次看看每个节点下面的内容。

1.pinctrl-handles

pinctrl-handles以设备为单位,例如下面的串口设备30860000,所属uart1grp组,使用pinctrl-0,它的四个GPIO的配置参数都是0x140,和dts中一致。

pinctrl_uart1: uart1grp {
		fsl,pins = <
			MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX	0x140
			MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX	0x140
			MX8MP_IOMUXC_UART3_RXD__UART1_DCE_CTS	0x140
			MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS	0x140
		>;
};

log:

Requested pin control handlers their pinmux maps:
device: 30330000.pinctrl current state: default
  state: default
    type: MUX_GROUP controller 30330000.pinctrl group: hoggrp (0) function: pinctrl (0)
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SCL (144)config 000001c                             3
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SDA (145)config 000001c                             3
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_HPD (147)config 00000019
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_CEC (146)config 00000019
device: 30860000.serial current state: default
  state: default
    type: MUX_GROUP controller 30330000.pinctrl group: uart1grp (24) function: pinctrl (0)
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_UART1_RXD (136)config 00000140
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_UART1_TXD (137)config 00000140
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_UART3_RXD (140)config 00000140
    type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_UART3_TXD (141)config 00000140

2.pinctrl-devices

pinctrl-devices表示芯片支持的pinctrl信息。

root@imx8mpevk:/sys/kernel/debug/pinctrl# cat pinctrl-devices
name             [pinmux]       [pinconf]
30330000.pinctrl   yes             yes

3.pinctrl-maps

pinctrl-maps展示了pinctrl设备下所有的配置信息,如state、type、control device、pin和config。

root@imx8mpevk:/sys/kernel/debug/pinctrl# cat pinctrl-maps
Pinctrl maps:
device 30330000.pinctrl
state default
type MUX_GROUP (2)
controlling device 30330000.pinctrl
group hoggrp
function pinctrl

device 30330000.pinctrl
state default
type CONFIGS_PIN (3)
controlling device 30330000.pinctrl
pin MX8MP_IOMUXC_HDMI_DDC_SCL
config 000001c3

device 30330000.pinctrl
state default
type CONFIGS_PIN (3)
controlling device 30330000.pinctrl
pin MX8MP_IOMUXC_HDMI_DDC_SDA
config 000001c3

4.30330000.pinctrl

30330000.pinctrl下有这些子节点。

ls  /sys/kernel/debug/pinctrl/30330000.pinctrl
gpio-ranges     pinconf-pins  pinmux-functions  pinmux-select
pinconf-groups  pingroups     pinmux-pins       pins

gpio-ranges子节点描述了gpio控制的基地址以及它们能控制的GPIO范围,以及pad范围。GPIOS【0-29】代表软件中GPIO的index范围,PINS【5-34】代表硬件上的index范围,呈线性映射关系。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat gpio-ranges
GPIO ranges handled:
0: 30200000.gpio GPIOS [0 - 29] PINS [5 - 34]
0: 30210000.gpio GPIOS [32 - 52] PINS [35 - 55]
0: 30220000.gpio GPIOS [64 - 89] PINS [56 - 81]
26: 30220000.gpio GPIOS [90 - 93] PINS [144 - 147]
0: 30230000.gpio GPIOS [96 - 127] PINS [82 - 113]
0: 30240000.gpio GPIOS [128 - 157] PINS [114 - 143]

以gpio1为例,dts如下,当前GPIO1控制器的0号引脚, 对应pinctrl中的5号引脚, 数量为30。

gpio1: gpio@30200000 {
				compatible = "fsl,imx8mp-gpio", "fsl,imx35-gpio";
				reg = <0x30200000 0x10000>;
				gpio-ranges = <&iomuxc 0 5 30>;
};

pinconf-groups记录了每个pinctrl组里的引脚配置。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pinconf-groups
Pin config settings per pin group
Format: group (name): configs
0 (hoggrp):
  MX8MP_IOMUXC_HDMI_DDC_SCL: 0x1c2
  MX8MP_IOMUXC_HDMI_DDC_SDA: 0x1c2
  MX8MP_IOMUXC_HDMI_HPD: 0x10
  MX8MP_IOMUXC_HDMI_CEC: 0x10

1 (pwm2grp):
  MX8MP_IOMUXC_GPIO1_IO11: 0x116

3 (ecspi2grp):
  MX8MP_IOMUXC_ECSPI2_SCLK: 0x82
  MX8MP_IOMUXC_ECSPI2_MOSI: 0x82
  MX8MP_IOMUXC_ECSPI2_MISO: 0x82

pingroups记录了每个pinctrl组使用的pad信息。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pingroups
registered pin groups:
group: hoggrp
pin 144 (MX8MP_IOMUXC_HDMI_DDC_SCL)
pin 145 (MX8MP_IOMUXC_HDMI_DDC_SDA)
pin 147 (MX8MP_IOMUXC_HDMI_HPD)
pin 146 (MX8MP_IOMUXC_HDMI_CEC)

group: pwm2grp
pin 16 (MX8MP_IOMUXC_GPIO1_IO11)

group: ecspi2grp
pin 124 (MX8MP_IOMUXC_ECSPI2_SCLK)
pin 125 (MX8MP_IOMUXC_ECSPI2_MOSI)
pin 126 (MX8MP_IOMUXC_ECSPI2_MISO)

pinconf-pins会包含所有pad的配置信息。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pinconf-pins
Pin config settings per pin
Format: pin (name): configs
pin 0 (MX8MP_IOMUXC_RESERVE0): N/A
pin 1 (MX8MP_IOMUXC_RESERVE1): N/A
pin 2 (MX8MP_IOMUXC_RESERVE2): N/A
pin 3 (MX8MP_IOMUXC_RESERVE3): N/A
pin 4 (MX8MP_IOMUXC_RESERVE4): N/A
pin 5 (MX8MP_IOMUXC_GPIO1_IO00): N/A
pin 6 (MX8MP_IOMUXC_GPIO1_IO01): 0x40
pin 7 (MX8MP_IOMUXC_GPIO1_IO02): 0x166
pin 8 (MX8MP_IOMUXC_GPIO1_IO03): 0x1c0
pin 9 (MX8MP_IOMUXC_GPIO1_IO04): 0xc0
...
pin 136 (MX8MP_IOMUXC_UART1_RXD): 0x140
pin 137 (MX8MP_IOMUXC_UART1_TXD): 0x140
pin 138 (MX8MP_IOMUXC_UART2_RXD): 0x140
pin 139 (MX8MP_IOMUXC_UART2_TXD): 0x140
pin 140 (MX8MP_IOMUXC_UART3_RXD): 0x140
pin 141 (MX8MP_IOMUXC_UART3_TXD): 0x140
pin 142 (MX8MP_IOMUXC_UART4_RXD): N/A
pin 143 (MX8MP_IOMUXC_UART4_TXD): N/A
pin 144 (MX8MP_IOMUXC_HDMI_DDC_SCL): 0x1c2
pin 145 (MX8MP_IOMUXC_HDMI_DDC_SDA): 0x1c2
pin 146 (MX8MP_IOMUXC_HDMI_CEC): 0x10
pin 147 (MX8MP_IOMUXC_HDMI_HPD): 0x10

pinmux-functions包含系统所有的pinctrl组。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pinmux-functions
function 0: pinctrl, groups = [ hoggrp pwm2grp pwm4grp ecspi2grp ecspi2cs eqosgrp fecgrp flexcan1grp flexcan2grp flexcan1reggrp flexcan2reggrp flexspi0grp gpioledgrp i2c1grp i2c2grp i2c3grp mipi_dsi_en pciegrp pmicgrp regusdhc2vmmcgrp pdmgrp sai2grp sai3grp synaptics_dsx_iogrp uart1grp typec1grp lcd1grp-panel typec1muxgrp uart2grp usb1grp uart3grp usdhc2grp usdhc2-100mhzgrp usdhc2-200mhzgrp usdhc2gpiogrp usdhc3grp usdhc3-100mhzgrp usdhc3-200mhzgrp wdoggrp csi0_pwn_grp csi0_rst_grp csi_mclk_grp ]

pinmux-pins记录哪些设备节点在使用这个pin,以及它们所属的pinctrl组。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pinmux-pins
Pinmux settings per pin
Format: pin (name):              mux_owner     gpio_owner        hog?
pin 0 (MX8MP_IOMUXC_RESERVE0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 1 (MX8MP_IOMUXC_RESERVE1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 2 (MX8MP_IOMUXC_RESERVE2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 3 (MX8MP_IOMUXC_RESERVE3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 4 (MX8MP_IOMUXC_RESERVE4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (MX8MP_IOMUXC_GPIO1_IO00): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 6 (MX8MP_IOMUXC_GPIO1_IO01): lvds0_panel (GPIO UNCLAIMED) function pinctrl group lcd1grp-panel
pin 7 (MX8MP_IOMUXC_GPIO1_IO02): 30280000.watchdog (GPIO UNCLAIMED) function pinctrl group wdoggrp
pin 8 (MX8MP_IOMUXC_GPIO1_IO03): 0-0025 (GPIO UNCLAIMED) function pinctrl group pmicgrp
pin 9 (MX8MP_IOMUXC_GPIO1_IO04): 30b50000.mmc (GPIO UNCLAIMED) function pinctrl group usdhc2-200mhzgrp

pins记录芯片所有的物理引脚。

root@imx8mpevk:/sys/kernel/debug/pinctrl/30330000.pinctrl# cat pins
registered pins: 148
pin 0 (MX8MP_IOMUXC_RESERVE0) 0:? 30330000.pinctrl
pin 1 (MX8MP_IOMUXC_RESERVE1) 0:? 30330000.pinctrl
pin 2 (MX8MP_IOMUXC_RESERVE2) 0:? 30330000.pinctrl
pin 3 (MX8MP_IOMUXC_RESERVE3) 0:? 30330000.pinctrl
pin 4 (MX8MP_IOMUXC_RESERVE4) 0:? 30330000.pinctrl
pin 5 (MX8MP_IOMUXC_GPIO1_IO00) 0:30200000.gpio 30330000.pinctrl
pin 6 (MX8MP_IOMUXC_GPIO1_IO01) 1:30200000.gpio 30330000.pinctrl
....
pin 145 (MX8MP_IOMUXC_HDMI_DDC_SDA) 27:30220000.gpio 30330000.pinctrl
pin 146 (MX8MP_IOMUXC_HDMI_CEC) 28:30220000.gpio 30330000.pinctrl
pin 147 (MX8MP_IOMUXC_HDMI_HPD) 29:30220000.gpio 30330000.pinctrl

最后

以上就是高高犀牛为你收集整理的i.MX8MP平台开发分享(IOMUX篇)- 查看pinctrl系统的debug信息的全部内容,希望文章能够帮你解决i.MX8MP平台开发分享(IOMUX篇)- 查看pinctrl系统的debug信息所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部