IMX6 dual GPIO Configuration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6 dual GPIO Configuration

2,820 Views
mariyapradeep
Contributor II

Hi,
I am using imx6 dual wandboard. I wanted to configure some pins as GPIO. I tested by using LEDS. By default in dts file 8 pins are configured as GPIO of which 2 pins MX6QDL_PAD_EIM_DA12__GPIO3_IO12 and MX6QDL_PAD_GPIO_18__GPIO7_IO13 are not getting configured properly. For the other 6 pins the leds blinks as I toggle using /sys/class/gpio, but on reading the value am getting some garbage values. With reference to this post: http://forums.wandboard.org/viewtopic.php?f=8&t=893 made some changes in imx6qdl.dtsi to the end.

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <
&pinctrl_hog_1
&wes_gpios
>;

imx6qdl-wandboard {
wes_gpios: hoggrp-2 {
fsl,pins = <
MX6QDL_PAD_EIM_DA12__GPIO3_IO12 0x4001b0b0 /* GPIO3_12 EDM pin 255 */
MX6QDL_PAD_EIM_D27__GPIO3_IO27 0x4001b0b0 /* GPIO3_27 EDM pin 258 */
MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0x4001b0b0 /* GPIO6_31 EDM pin 260 */
MX6QDL_PAD_ENET_RX_ER__GPIO1_IO24 0x4001b0b0 /* GPIO1_24 EDM pin 262 */
MX6QDL_PAD_SD3_RST__GPIO7_IO08 0x4001b0b0 /* GPIO7_8 EDM pin 264 */
MX6QDL_PAD_EIM_D26__GPIO3_IO26 0x4001b0b0 /* GPIO3_26 EDM pin 259 */
MX6QDL_PAD_GPIO_18__GPIO7_IO13 0x4001b0b0 /* GPIO7_13 */
MX6QDL_PAD_GPIO_19__GPIO4_IO05 0x4001b0b0 /* GPIO4_5 EDM pin 263 */
>;
};
};
};

but still the 2 pins MX6QDL_PAD_EIM_DA12__GPIO3_IO12 and MX6QDL_PAD_GPIO_18__GPIO7_IO13 are not working as intended, I tried to access pin MX6QDL_PAD_EIM_DA12__GPIO3_IO12
via user space here is the log:

~# echo 76 > /sys/class/gpio/export
~# echo "out" > /sys/class/gpio/gpio76/direction
~# echo 1 > /sys/class/gpio/gpio76/value
~# cat /sys/class/gpio/gpio76/value
4096

I'm having similar issue with MX6QDL_PAD_GPIO_18__GPIO7_IO13 also. Can anyone tell me why this value is coming?
Is there anything more I need to do to get it configured as GPIO?

Thanks in advance

Labels (4)
5 Replies

1,459 Views
BiyongSUN
NXP Employee
NXP Employee
0 Kudos

1,459 Views
fabio_estevam
NXP Employee
NXP Employee

Looks like this bug has already been fixed in recent kernels. Please try 4.1.15.

0 Kudos

1,459 Views
fabio_estevam
NXP Employee
NXP Employee

Here is the commit that fixes this bug:

commit 25b35da7f4cce82271859f1b6eabd9f3bd41a2bb
Author: Linus Walleij <linus.walleij@linaro.org>
Date: Wed Feb 5 14:08:02 2014 +0100

gpio: generic: clamp retured value to [0,1]

The generic GPIO would return 0 for low generic GPIO, and
something != 0 for high GPIO. Let's make this sane by clamping
the returned value to [0,1].

Reported-by: Evgeny Boger <boger@contactless.ru>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 8c778af..d815dd2 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -139,7 +139,7 @@ static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
{
struct bgpio_chip *bgc = to_bgpio_chip(gc);

- return bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio);
+ return !!(bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio));
}

This commit hit mainline kernel in 3.15 version.

1,459 Views
mariyapradeep
Contributor II

Hi,

    I am using kernel 3.14. I applied the above said changes and got the values 0 and 1 on toggling the GPIO. But am not able to get GPIO functionality from 2 pins MX6QDL_PAD_EIM_DA12__GPIO3_IO12 and MX6QDL_PAD_GPIO_18__GPIO7_IO13.

Is there any configurations am missing?

0 Kudos

1,459 Views
igorpadykov
NXP Employee
NXP Employee

Hi Mariya

probably these lines are used somewhere by other modules

or configured in uboot, one can try to attached jtag (or printf)

iomux settings of these pads.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------