DTS tree changes to access GPIO from linux on IMX6SL-EVK Board

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

DTS tree changes to access GPIO from linux on IMX6SL-EVK Board

Jump to solution
3,972 Views
deej
Contributor II

Hi all,

My problem exactly matches this discussion which doesn't seem to come to a resolution. Additionally, there are other discussions that get started, but never seems to find a resolution. If I manage to solve the issue, I'll post the solution here as well so that others will a tleast have something to go on.

I'm working on a IMX6SL-EVK board where I want to control a gpio pin from within linux. Currently, as a test platform I'm trying to control the LED that's connection to GPIO3:20 but haven't had much luck.

I'm running the kernel (Linux version 3.10.53) that is shipped with android KK by freescale.

The following is what I tried to perform the IO operation:

1. SYSFS GPIO access is enabled in the kernel

2. Modified iomux section in arch/arm/boot/dts/imx6sl-evk-common.dtsi to include the GPIO line in question as follows (see line 14)

&iomuxc {

        pinctrl-names = "default", "sleep";

        pinctrl-0 = <&pinctrl_hog>;

        pinctrl-1 = <&pinctrl_hog_sleep>;

        hog {

                pinctrl_hog: hoggrp {

                        fsl,pins = <

                                MX6SL_PAD_KEY_ROW7__GPIO4_IO07    0x17059

                                MX6SL_PAD_KEY_COL7__GPIO4_IO06    0x17059

                                MX6SL_PAD_SD2_DAT7__GPIO5_IO00    0x17059

                                MX6SL_PAD_SD2_DAT6__GPIO4_IO29    0x17059

                                MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0xc7030

                                MX6SL_PAD_REF_CLK_32K__GPIO3_IO22 0x17059

                                MX6SL_PAD_FEC_TX_CLK__GPIO4_IO21  0x80000000

3. Issued the following commands from within linux to control the GPIOs

echo 84>/sys/class/gpio/export

echo out>/sys/class/gpio/gpio84/direction

echo -n 0x01>/sys/class/gpio/gpio84/value

I know the above command tries to access the GPIO port because, I've added some printk messages and see the results in the kernel log (this is issued from within static void bgpio_write32(void __iomem *reg, unsigned long data) in drivers/gpio/gpio-generic.c)

drivers/gpio/gpio-generic.c:87 a0828000=40f000

drivers/gpio/gpio-generic.c:87 a0828004=100000

However, the GPIO line itself doesn't change state.

I feel, I'm missing something in my dts configuration, but can't figure it out.

Thanks in advance.

Labels (3)
0 Kudos
1 Solution
1,966 Views
deej
Contributor II

Finally figured out what was going on. My original STROBE pad setting was correct, however I didn't realise, the contents of DTS file that I was modifying was getting overridden by another file which is arch/arm/boot/dts/imx6sl-evk-csi.dts. After adding the STROBE entry in that file, I'm able to control the GPIO line through the sysfs interface.

Thanks for all your help.

View solution in original post

0 Kudos
6 Replies
1,967 Views
deej
Contributor II

Finally figured out what was going on. My original STROBE pad setting was correct, however I didn't realise, the contents of DTS file that I was modifying was getting overridden by another file which is arch/arm/boot/dts/imx6sl-evk-csi.dts. After adding the STROBE entry in that file, I'm able to control the GPIO line through the sysfs interface.

Thanks for all your help.

0 Kudos
1,966 Views
fabio_estevam
NXP Employee
NXP Employee

Could you try applying/adapting this patch to 3.10?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/imx6sl-evk....

Regards,

Fabio Estevam

0 Kudos
1,966 Views
deej
Contributor II

Thanks for the reply Fabio, but that patch has already been applied.

0 Kudos
1,966 Views
igorpadykov
NXP Employee
NXP Employee

could you check that HSIC_STROBE is not used somewhere as pwm2 ?

Also one can attach jtag and try to toggle this pin.

~igor

.

0 Kudos
1,966 Views
igorpadykov
NXP Employee
NXP Employee

Hi dee

according to linux documentation ...bindings/pinctrl/fsl,imx-pinctrl.txt :

Bits used for CONFIG:

NO_PAD_CTL(1 << 31): indicate this pin does not need config.

SION(1 << 30): Software Input On Field.

Force the selected mux mode input path no matter of MUX_MODE functionality.

By default the input path is determined by functionality of the selected

mux mode (regular).

One can try to change MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 to 0x400c7030

Some examples can be found on

linux-imx6/imx6qdl-nit6xlite.dtsi at boundary-imx_3.10.53_1.1.1_ga · boundarydevices/linux-imx6 · Gi...

Other option to check/set GPIO register value with memtool

Best regards

igor

0 Kudos
1,966 Views
deej
Contributor II

The change to 0x400c7030 didn't address the issue. As to the other reference you gave, I tried it once earlier, but will try it again and post my changes for comment.

Thanks

0 Kudos