Hi,
We are using DART-MX8M-PLUS development kit, along with our custom board based on iMX8MP. In order to use ADC connected on i2c5 bus, we need pins that are originally used for ethernet RGMII (ENET1_RGMII*) as a part of ethernet device named as fec, within the imx8mp-var-dart-dt8mcustomboard.dts device tree file:
&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec>;
phy-mode = "rgmii";
phy-handle = <ðphy1>;
status = "okay";
};
...
pinctrl_fec: fecgrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_RXD4__ENET1_RGMII_RD0 0x90
MX8MP_IOMUXC_SAI1_RXD5__ENET1_RGMII_RD1 0x90
MX8MP_IOMUXC_SAI1_RXD6__ENET1_RGMII_RD2 0x90
MX8MP_IOMUXC_SAI1_RXD7__ENET1_RGMII_RD3 0x90
MX8MP_IOMUXC_SAI1_TXC__ENET1_RGMII_RXC 0x90
MX8MP_IOMUXC_SAI1_TXFS__ENET1_RGMII_RX_CTL 0x90
MX8MP_IOMUXC_SAI1_TXD0__ENET1_RGMII_TD0 0x00
MX8MP_IOMUXC_SAI1_TXD1__ENET1_RGMII_TD1 0x00
MX8MP_IOMUXC_SAI1_TXD2__ENET1_RGMII_TD2 0x00
MX8MP_IOMUXC_SAI1_TXD3__ENET1_RGMII_TD3 0x00
MX8MP_IOMUXC_SAI1_TXD4__ENET1_RGMII_TX_CTL 0x00
MX8MP_IOMUXC_SAI1_TXD5__ENET1_RGMII_TXC 0x00
>;
};
In order for pins SAI1_TXD1 and SAI1_RXD5 to be used for our ADC, I've removed shown fec entry from device tree, as well as those RGMII pins definitions. After that, i2c device was added, as well as desired pins, in the following way:
&i2c5{
clock-frequency = <400000>;
pinctrl-names = "default", "gpio", "adc";
pinctrl-0 = <&pinctrl_i2c5>;
pinctrl-1 = <&pinctrl_i2c5_gpio>;
pinctrl-2 = <&pinctrl_adc>;
scl-gpios = <&gpio3 26 GPIO_ACTIVE_HIGH>;
sda-gpios = <&gpio3 27 GPIO_ACTIVE_HIGH>;
status = "okay";
adc@2f {
compatible = "adi,ad7091r5";
reg = <0x2f>;
};
};
...
pinctrl_adc: adcgpiogrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_TXD1__GPIO4_IO13 0x1c2
MX8MP_IOMUXC_SAI1_RXD5__GPIO4_IO07 0x1c2
>;
};
After the boot, I can see that those changes are present in the system by running the following command:
cat /sys/kernel/debug/pinctrl/pinctrl-handles
...
device: 30ad0000.i2c current state: default
state: default
type: MUX_GROUP controller 30330000.pinctrl group: i2c5grp (21) function: pinctrl (0)
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SCL (144)config 000001c2
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SDA (145)config 000001c2
state: gpio
type: MUX_GROUP controller 30330000.pinctrl group: i2c5gpiogrp (25) function: pinctrl (0)
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SCL (144)config 000001c2
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_HDMI_DDC_SDA (145)config 000001c2
state: adc
type: MUX_GROUP controller 30330000.pinctrl group: adcgpiogrp (26) function: pinctrl (0)
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_SAI1_TXD1 (95)config 000001c2
type: CONFIGS_PIN controller 30330000.pinctrl pin MX8MP_IOMUXC_SAI1_RXD5 (89)config 000001c2
...
The problem is that setting GPIO value using libgpiod doesn't reflect on those pins. I've connected those pins to the oscilloscope and neither in the case of development board nor of our custom board the change can be seen. I've even tried toggling those values from the Uboot but, again, with no success. I'd like to add that using gpioinfo or cat /sys/kernel/debug/gpio commands don't show that those pins are used by any device.
In order to debug the problem, I've tried to use other SAI1 pins and I've noticed that only those which are related to the ethernet RGMII cannot be controlled; if I define other pins in the same way, the value can be changed.
Therefore, I'd like to ask, could you know what might be the cause of the problem? Are ethernet RGMII pins somehow hardwired to the appropriate SAI1 pins or the problem comes from somewhere else?
Regards,
Dragan