I use an i.mx6 board (yocto(jethro)) and am configuring a device tree. I changed a dts file and put the dtb file in a boot partition. I set GPIO4_IO19 in dts file as follows.

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;
imx6ul-evk {
pinctrl_hog_1: hoggrp-1 {
fsl,pins = <

At first MX6UL_PAD_CSI_VSYNC__GPIO4_IO19 was defined in other group (usdhcgrp) but I commented out them.

After booting, I checked if gpio is successfully determined as I set. The result is

echo 115 > /sys/class/gpio/export
-sh: echo: write error: Device or resource busy

So I checked this.

cat /sys/kernel/debug/gpio

    GPIOs 0-31, platform/209c000.gpio, 209c000.gpio:
    gpio-10 (phy-reset ) out lo
    GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
    GPIOs 64-95, platform/20a4000.gpio, 20a4000.gpio:
    gpio-68 (ft5x06_irq_gpio ) in hi
    GPIOs 96-127, platform/20a8000.gpio, 20a8000.gpio:
    gpio-109 (? ) out lo
    gpio-115 (cd ) in lo
    gpio-116 (? ) out lo
    gpio-117 (? ) out lo
    gpio-118 (sysfs ) in hi
    GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:
    gpio-128 (phy-reset ) out lo

gpio-115 is used by cd. Maybe it means card detection. I want to use it as sysfs to read the state. Any other way to read it ? Furthermore, gpio-10, 68, 109, 116, 117 is used by other device. How can I use them by sysfs?

I think I need to do is checking whether register is correctly set value or not. If the register value is not the same as I set, I guess the other process set the pin control.However I do not know the way of accessing a register.

What I know about gpio115 is as follows

 mux_reg address: 0x01DC and the value.
 conf_reg address: 0x0468 and the value.
 input_reg address: 0x0000 and the value.

The same as the other gpios.

How can I access 0x01DC and then get the value in linux(yocto)?

Thank you for your cooperation.


If you just want to know the state of the pin, It is already presented to you in /sys/kernel/debug/gpio

gpio-115 (cd ) in lo

It is configured as an input, and the current value is low, This will change if you insert/remove the card in the slot!

If you really want to or need to access the register value directly, try checking up the utility devregs!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.