We have a product using Verdin iMX8M-Plus 1.0D.
We want to have internal pull ups at ports GPIO_SODIMM_30 which is GPIO3_IO25 and GPIO_SODIMM_32 which is GPIO3_IO22.
Therefore I modified dts file as below:
/*
GPIO control bits: PE HYS PUE ODE FSEL X DSE1 DSE0 X
-----------------
Pull Select Field : PE_0_PULL_DISABLE / PE_1_PULL_ENABLE
Input Select Field : HYS_0_CMOS / HYS_1_SCHMITT
Pull Up / Down Config. : PUE_0_WEAK_PULL_DOWN / PUE_1_WEAK_PULL_UP
Open Drain Field : ODE_0_OPEN_DRAIN_DISABLE / ODE_1_OPEN_DRAIN_ENABLE
Slew Rate Field : FSEL_0_SLOW_SLEW_RATE / FSEL_1_FAST_SLEW_RATE
Drive Strength Field : DSE_X1 / DSE_X2 / DSE_X4 /DSE_X6
-----------------
Example: 0b010010110 -> 0x096 (PE_0_PULL_DISABLE | HYS_1_SCHMITT | PUE_0_WEAK_PULL_DOWN | ODE_0_OPEN_DRAIN_DISABLE | FSEL_1_FAST_SLEW_RATE | DSE_X6)
Example: 0b111110110 -> 0x1F6 (PE_1_PULL_ENABLE | HYS_1_SCHMITT | PUE_1_WEAK_PULL_UP | ODE_1_OPEN_DRAIN_ENABLE | FSEL_1_FAST_SLEW_RATE | DSE_X6)
*/
&iomuxc {
pinctrl-0 = <&pinctrl_additionalgpio>;
pinctrl_additionalgpio: additionalgpios {
fsl,pins = <
MX8MP_IOMUXC_SAI5_RXD1__GPIO3_IO22 0x140 /* SODIMM 32 - PWR_2_VALID with PU */
MX8MP_IOMUXC_SAI5_MCLK__GPIO3_IO25 0x140 /* SODIMM 30 - PWR_1_VALID with PU */
...
...
>;
};
};
But I can not observe any pullup on the SODIMM pins 30 and 32 when they are inputs. When I assemble external pullup, below command returns 1 and 0 as expected. But once I remove external pullups, I always get zero.
root@verdin-imx8mp-06976886:~# gpioget 2 22
0
root@verdin-imx8mp-06976886:~# gpioget 2 25
0
root@verdin-imx8mp-06976886:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
gpio-0 ( )
gpiochip1: GPIOs 32-63, parent: platform/30210000.gpio, 30210000.gpio:
gpio-32 ( )
gpio-42 ( |id ) in hi IRQ
gpio-43 ( |regulator-wifi-en ) out hi
gpio-44 ( |cd ) in hi IRQ ACTIVE LOW
gpio-52 ( |regulator-module-eth) out hi
gpio-61 ( |CTRL_SLEEP_MOCI# ) out hi
gpiochip2: GPIOs 64-95, parent: platform/30220000.gpio, 30220000.gpio:
gpio-64 ( )
gpio-83 ( |led_status_1 ) out lo
gpio-84 ( |led_red ) out lo
gpio-90 ( |scl ) out lo
gpio-91 ( |sda ) in lo
gpiochip3: GPIOs 96-127, parent: platform/30230000.gpio, 30230000.gpio:
gpio-96 ( |Wake-Up ) in hi IRQ ACTIVE LOW
gpio-98 ( |led_status_2 ) out lo
gpio-115 ( |reset ) out hi ACTIVE LOW
gpio-118 ( |regulator-usdhc2 ) out lo
gpio-121 ( |led_green ) out lo
gpiochip4: GPIOs 128-159, parent: platform/30240000.gpio, 30240000.gpio:
gpio-128 ( )
gpio-137 ( |spi_imx ) out hi
gpio-142 ( |scl ) out lo
gpio-143 ( |sda ) in lo
gpio-144 ( |scl ) out lo
gpio-145 ( |sda ) in lo
gpio-148 ( |scl ) out lo
gpio-149 ( |sda ) in lo
No actually I didn’t touch any toradex specific dtsi file. But of course we included that file in our custom dst file. None of the SAI modules are enabled, all have status = "disabled". Still shall we remove them? What is the proper way of removing those pins without touching imx8mp-verdin.dtsi file?
I added following lines into root of our custom dst file, it is compiled, I put it into the device, reboot but still no pull ups.
Could you please share the entire device tree that you created? So we can have a deeper look into it.
Have you tried with another carrier board? Did you see the same problem?
No, I didn’t try with another carrier board but the carrier board seems ok. If I assemble an external 100kohm pull-up, SoM reads the pin as 0 and 1 as expected. Do you mean that trying with another Verdin SoM? (no I didn’t either, but I will…)
Ok, if you could try with a different SoM and give us feedback it would be great. In the meanwhile, now that I have your device tree, I’ll try it on a Verdin here and check if I can reproduce your issue.
I could make it work here using a default device tree from Toradex: imx8mp-verdin-wifi-dev.dtb with a device tree overlay. Here is my code:
/dts-v1/;
/plugin/;
#include <imx8mp-pinfunc.h>
/ {
compatible = "toradex,verdin-imx8mp-wifi-gprarray",
"toradex,verdin-imx8mp-wifi",
"toradex,verdin-imx8mp",
"fsl,imx8mp";
};
&sai1 {
status = "disabled";
};
&sai3 {
status = "disabled";
};
&iomuxc {
pinctrl-0 = <&pinctrl_additionalgpio>;
pinctrl_additionalgpio: additionalgpios {
fsl,pins = <
MX8MP_IOMUXC_SAI5_RXD1__GPIO3_IO22 0x140 /* SODIMM 32- PWR_2_VALID with PU */
MX8MP_IOMUXC_SAI5_MCLK__GPIO3_IO25 0x140 /* SODIMM 30- PWR_1_VALID with PU */
>;
};
};
The default value for both inputs is 1 and the inputs are working fine with an external button.
However, still, I’m not sure why your device tree isn’t working. I’ve built it here and indeed the pullups are not working. I’m still investigating.
Please, try this overlay and check if you can make it work, and then please give us feedback.
In addition, can you send us your dmesg log? So we can take a deeper look into possible errors.
Now we have received our second prototype with external pull ups. But we are hit by same problem. We observe that 100kohm external pull ups were not sufficient to pull the port pins up.
Something on the SoM takes the IOs ( GPIO_SODIMM_30 and GPIO_SODIMM_32) down.
I investigated the issue and realized that somehow u-boot device tree and linux kernel device tree which supposed to be totally isolated affect each other.
My problem has been solved when I added the same entries for pinctrl_additionalgpio in linux kernel device tree to the u-boot device tree in u-boot-toradex_imx_v2020.04_5.4.70_2.3.0\arch\arm\dts\imx8mp-verdin.dts
I’m glad you could work this out. Just one comment from my side:
It’s not 100% accurate the device trees are isolated from each other. Depending on the device or what is going on, u-boot can change some settings from the Linux device tree, so make sure to also check the u-boot source code if you see any unexpected behavior. Although this doesn’t happen all the time, it’s possible to happen.
Anyways, let me know if you need anything else. I’ll mark your last reply as “solved”.