This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352: Having problems enabling gpio2

Part Number: AM3352

Hello,

I've added statements to my device tree to enable gpio2 for input. To keep it simple, just gpio2_6:

    gpio2_pins: pinmux-gpio2_pins {
        pinctrl-single,pins = <
            AM33XX_IOPAD(0x8a0, PIN_INPUT | MUX_MODE7) /* (R1) lcd_data0.gpio2[6] */
        >;
    };

&gpio2 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio2_pins>;
};

With the addition of those two sections, I still can't access gpio2. When I try it crashes:
   # devmem2 0x481AC134
   /dev/mem opened.[ 1178.015843] Unhandled fault: external abort on non-linefetch (0x1018) at 0xb6f32134
   [ 1178.024764] pgd = 08bbe99d
   [ 1178.027486] [b6f32134] *pgd=99abe831, *pte=481ac303, *ppte=481aca33
   Memory mapped at address 0xb6f32000.
   Bus error (core dumped)

I've determined the problem is gpio2 isn't enabled. When I read CM_PER_GPIO2_CLKCTRL (using devmem2) it reports a value of 0x00030000 which means "Module is disabled and cannot be accessed". I can use devmem2 and write 2 to enable gpio2 and then I can read gpio2 but this should be able to be part of the device tree.

I've verified the statement "AM33XX_IOPAD(0x8a0, PIN_INPUT | MUX_MODE7)" is working, because I can change PIN_INPUT to PIN_INPUT_PULLUP or PIN_INPUT_PULLDOWN and I see the value of conf_lcd_data0 (0x44E108A0) change correctly from no pull up/down to pull up or pull down. (I've also used the "pinmux" program and verified the address 0x8a0 is correct according to the TRM)

I can read the gpio2 bits if I add these statements to the "gpio2" section:

    BMODE00 {
        gpio-hog;
        input;
        gpios = <6 GPIO_ACTIVE_LOW>;

Should that be needed? I've also tried "ti,gpio-always-on" and "ti,reset-on-init" but neither seem to make a difference. (

I'm probably missing something simple, but most of the web searches result in a TI web page stating the content is no longer available. (conf_lcd_data0 still reads as disabled)

Do you have any suggestions?

Thanks,

Scott

  • Hi Scott,

    Please see this excellent discussion here for an explanation and a couple of ideas.

    For a DT solution, could you try adding a "ti, no-idle" node to your GPIO2 section? However, understand that this has some power trade offs.

  • Hi Ron,

    The link to the discussion was the same process I followed to diagnose the issue.

    When I added "ti,no-idle" to my "gpio2" device tree section, I didn't need the "gpio-hog" work around.

    Yes, there are power trade offs if gpio2 won't go into idle mode. That's ok because our board uses various gpio pins while it's running.

    Thanks,

    Scott