DTS GPIO Pinmux on Kernel 4.1.15

Hi,

I am struggling with toggling I/O from expander P9 from the BeagleBoard-xM using the device tree source. I used as reference the Technical Reference Manual looking into the System Control Module and looking into the table 13-4 to set the correct offset but my pin are not toggling using the echo command from sysfs.

If I compare the offset from http://elinux.org/BeagleBoardPinMux I see diffrent value like for gpio_139 (Connector PinP9.3) the offset is 0x16A while my calculation gave 0x13A which derived from 0x4800 2168 (Physical Address gpio_139 from table 13-4) minus 0x48002030 +0x02

Below my codde for the P9 GPIO pin muxing omap3-beagle-xm-dts:
/*
* Copyright © 2011 Texas Instruments Incorporated - http://www.ti.com/

Hi,

I am struggling with toggling I/O from expander P9 from the BeagleBoard-xM using the device tree source. I used as reference the Technical Reference Manual looking into the System Control Module and looking into the table 13-4 to set the correct offset but my pin are not toggling using the echo command from sysfs.

If I compare the offset from http://elinux.org/BeagleBoardPinMux I see diffrent value like for gpio_139 (Connector PinP9.3) the offset is 0x16A while my calculation gave 0x13A which derived from 0x4800 2168 (Physical Address gpio_139 from table 13-4) minus 0x48002030 +0x02

Below my codde for the P9 GPIO pin muxing omap3-beagle-xm-dts:
/*
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;

#include “omap36xx.dtsi”

/ {
model = “TI OMAP3 BeagleBoard xM”;
compatible = “ti,omap3-beagle-xm”, “ti,omap36xx”, “ti,omap3”;

.

.
gpio_pins: pinmux_gpio_pins {
pinctrl-single,pins = <
0x12C (PIN_INPUT_PULLUP | MUX_MODE4) /* sdmmc2_dat1.gpio_133 /
0x134 (PIN_INPUT_PULLUP | MUX_MODE4) /
sdmmc2_dat4.gpio_136 /
0x136 (PIN_INPUT_PULLUP | MUX_MODE4) /
sdmmc2_dat5.gpio_137 /
0x138 (PIN_INPUT_PULLUP | MUX_MODE4) /
sdmmc2_dat6.gpio_138 /
0x13A (PIN_INPUT_PULLUP | MUX_MODE4) /
sdmmc2_dat7.gpio_139 /
0x142 (PIN_INPUT | MUX_MODE1) /
mcbsp3_fsx.uart2_rx.gpio_143 /
0x144 (PIN_OUTPUT | MUX_MODE2) /
uart2_cts.mcbsp3_dx.gpt9_pwmevt.gpio_144 /
0x146 (PIN_OUTPUT | MUX_MODE2) /
uart2_rts.mcbsp3_dr.gpt10_pwmevt.gpio_145 /
0x148 (PIN_OUTPUT | MUX_MODE0) /
uart2_tx.mcbsp3_clkx.gpio_146 /
0x160 (PIN_INPUT_PULLUP | MUX_MODE4) /
mcbsp1_dx.gpio_158 /
0x162 (PIN_INPUT_PULLUP | MUX_MODE4) /
mcbsp1_dr.gpio_159 /
0x166 (PIN_INPUT_PULLUP | MUX_MODE4) /
mcbsp1_fsx.gpio_161 /
0x168 (PIN_INPUT_PULLUP | MUX_MODE1) /
mcbsp1_clkx.gpio_162 */
>;
};

I have added this:
&gpio5 {
pinctrl-names = “default”;
pinctrl-0 = <&gpio_pins>;
};

Can anybody help on this, is there anybody who has succeeded to correctely configure the GPIO MUX for the beagleboardxM?

any help will be appreciated.

To export gpio_139 correctely, the pin, an offset of 32 must be added to the gpio pin number like this:

echo 171 > /sys/class/gpio/export.

Now It seems that my problem is solved.