Apalis-imx6 power-off and GPIO

Hi,

We actually are testing an Apalis-imx6 module on an Ixora carrier board and want to implement the power off function based on explanation from High performance, low power Embedded Computing Systems | Toradex Developer Center

So far, kernel is built with the required config (CONFIG_POWER_RESET_GPIO) and the device tree is modified with:

gpio-poweroff {
    compatible = "gpio-poweroff";
    gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
};

The power off GPIO we are using is the GPIO1 defined on the Ixora board as MX6QDL_PAD_NANDF_D4__GPIO2_IO04 connected on the MXM3 pin 1 (X27 connector pin 13 on Ixora board).

Actually the GPIO is not triggered at all and we are not sure about the <&gpio2 4 that we put in the device tree. How can we find the relationship between the MX6QDL_PAD_NANDF_D4__GPIO2_IO04 pad and the gpio bank/numbers that should be used in the device tree?

We can successfully power off the board by triggering manually the gpio by doing

echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction
echo 1 > /sys/class/gpio/gpio36/value

Thanks

Hi

I had to test if it still works with our latest kernel. It does.

So the question is what version of things you are using, SW and HW.

… we are not sure about the <&gpio2 4> that we put in the device tree. How can we find the relationship between the MX6QDL_PAD_NANDF_D4__GPIO2_IO04 and the gpio bank/numbers that should be used in the device tree?

Your assumption is correct GPIO2 refers to the 2nd gpio controller, IO04 referes to pin 4 of said controller.
So GPIO2_IO04 is to be specified in a gpios property as <&gpio2 4>.

Max

Thank you for your answer.

It’s working now, I was using the wrong dtb file. After changing the dtb env in uboot the power-off is now working fine.

Thanks