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.

AM62L: How to control GPIO in U-Boot

Part Number: AM62L

I'm using U-Boot 2025.01 with AM62L.

I configured GPIO nodes in device trees for our custom board:

&main_gpio0 {
        status = "okay";
        pinctrl-names = "default";
        bootph-all;
        pinctrl-0 = <&gpio0_pins_default>;
};
&pmx0 {
...
        gpio0_pins_default: gpio0-default-pins {
                pinctrl-single,pins = <
                        AM62LX_IOPAD(0x0044, PIN_OUTPUT, 7) /* (E22) OSPI0_DQS.GPIO0_2 */
                        AM62LX_IOPAD(0x0058, PIN_OUTPUT, 7) /* (F21) OSPI0_D4.GPIO0_7 */
                        AM62LX_IOPAD(0x005c, PIN_OUTPUT, 7) /* (F19) OSPI0_D5.GPIO0_8 */
                        AM62LX_IOPAD(0x006c, PIN_INPUT, 7) /* (D20) OSPI0_CSn1.GPIO0_12 */
                        AM62LX_IOPAD(0x0070, PIN_INPUT, 7) /* (D18) OSPI0_CSn2.GPIO0_13 */
                        AM62LX_IOPAD(0x0074, PIN_INPUT, 7) /* (C23) OSPI0_CSn3.GPIO0_14 */
                        AM62LX_IOPAD(0x0098, PIN_INPUT, 7) /* (H19) GPMC0_AD8.GPIO0_23 */
                        AM62LX_IOPAD(0x009c, PIN_INPUT, 7) /* (H20) GPMC0_AD9.GPIO0_24 */
                        AM62LX_IOPAD(0x00a0, PIN_INPUT, 7) /* (H21) GPMC0_AD10.GPIO0_25 */
                        AM62LX_IOPAD(0x00a4, PIN_INPUT, 7) /* (H18) GPMC0_AD11.GPIO0_26 */
                        AM62LX_IOPAD(0x00b0, PIN_OUTPUT, 7) /* (F22) GPMC0_AD14.GPIO0_29 */
                        AM62LX_IOPAD(0x00b4, PIN_OUTPUT, 7) /* (F23) GPMC0_AD15.GPIO0_30 */
                        AM62LX_IOPAD(0x00e8, PIN_INPUT, 7) /* (L19) GPMC0_CSn1.GPIO0_42 */
                        AM62LX_IOPAD(0x0128, PIN_INPUT, 7) /* (Y11) RGMII1_TD2.GPIO0_57 */
                        AM62LX_IOPAD(0x012c, PIN_INPUT, 7) /* (AA11) RGMII1_TD3.GPIO0_58 */
                        AM62LX_IOPAD(0x0140, PIN_INPUT, 7) /* (AA8) RGMII1_RD2.GPIO0_63 */
                        AM62LX_IOPAD(0x0144, PIN_INPUT, 7) /* (W8) RGMII1_RD3.GPIO0_64 */
                        AM62LX_IOPAD(0x017c, PIN_INPUT, 7) /* (AB8) RGMII2_RD3.GPIO0_78 */
                        AM62LX_IOPAD(0x018c, PIN_INPUT, 7) /* (B9) MCASP0_AXR0.GPIO0_82 */
                        AM62LX_IOPAD(0x019c, PIN_INPUT, 7) /* (A12) MCASP0_ACLKR.GPIO0_86 */
                        AM62LX_IOPAD(0x01a0, PIN_INPUT, 7) /* (E11) SPI0_CS0.GPIO0_87 */
                        AM62LX_IOPAD(0x01a4, PIN_OUTPUT, 7) /* (D11) SPI0_CS1.GPIO0_88 */
                        AM62LX_IOPAD(0x01a8, PIN_INPUT, 7) /* (E13) SPI0_CLK.GPIO0_89 */
                        AM62LX_IOPAD(0x01ac, PIN_INPUT, 7) /* (E12) SPI0_D0.GPIO0_90 */
                        AM62LX_IOPAD(0x01b0, PIN_INPUT, 7) /* (B12) SPI0_D1.GPIO0_91 */
                        AM62LX_IOPAD(0x01cc, PIN_INPUT, 7) /* (B7) I2C0_SCL.GPIO0_98 */
                        AM62LX_IOPAD(0x01d0, PIN_INPUT, 7) /* (A7) I2C0_SDA.GPIO0_99 */
                        AM62LX_IOPAD(0x01dc, PIN_OUTPUT, 7) /* (B8) I2C2_SCL.GPIO0_102 */
                        AM62LX_IOPAD(0x01e0, PIN_OUTPUT, 7) /* (D8) I2C2_SDA.GPIO0_103 */
                        AM62LX_IOPAD(0x01e4, PIN_INPUT, 7) /* (D16) EXT_REFCLK1.GPIO0_104 */
                        AM62LX_IOPAD(0x0238, PIN_OUTPUT, 7) /* (D6) MMC1_SDWP.GPIO0_123 */
                        AM62LX_IOPAD(0x0248, PIN_INPUT, 7) /* (A5) USB1_DRVVBUS.GPIO0_125 */
                >;
        };
...
};

 

When I booted U-Boot and executed the gpio command, it looked like the following.

Some GPIOs was configured as output but it seems that all of GPIOs was actually configured as input.

=> gpio status -a
Bank gpio@600000_:
gpio@600000_0: input: 0 [ ]
gpio@600000_1: input: 0 [ ]
gpio@600000_2: input: 0 [ ]
gpio@600000_3: input: 0 [ ]
gpio@600000_4: input: 0 [ ]
gpio@600000_5: input: 0 [ ]
gpio@600000_6: input: 0 [ ]
gpio@600000_7: input: 0 [ ]
gpio@600000_8: input: 0 [ ]
gpio@600000_9: input: 0 [ ]
gpio@600000_10: input: 0 [ ]
gpio@600000_11: input: 0 [ ]
gpio@600000_12: input: 1 [ ]
gpio@600000_13: input: 0 [ ]
gpio@600000_14: input: 0 [ ]
gpio@600000_15: input: 0 [ ]
gpio@600000_16: input: 1 [ ]
gpio@600000_17: input: 0 [ ]
gpio@600000_18: input: 0 [ ]
gpio@600000_19: input: 0 [ ]
gpio@600000_20: input: 1 [ ]
gpio@600000_21: input: 1 [ ]
gpio@600000_22: input: 0 [ ]
gpio@600000_23: input: 1 [ ]
gpio@600000_24: input: 1 [ ]
gpio@600000_25: input: 1 [ ]
gpio@600000_26: input: 1 [ ]
gpio@600000_27: input: 0 [ ]
gpio@600000_28: input: 1 [ ]
gpio@600000_29: input: 0 [ ]
gpio@600000_30: input: 0 [ ]
gpio@600000_31: input: 0 [ ]
gpio@600000_32: input: 0 [ ]
gpio@600000_33: input: 0 [ ]
gpio@600000_34: input: 0 [ ]
gpio@600000_35: input: 0 [ ]
gpio@600000_36: input: 0 [ ]
gpio@600000_37: input: 1 [ ]
gpio@600000_38: input: 0 [ ]
gpio@600000_39: input: 0 [ ]
gpio@600000_40: input: 0 [ ]
gpio@600000_41: input: 0 [ ]
gpio@600000_42: input: 0 [ ]
gpio@600000_43: output: 0 [x] led-0.gpios
gpio@600000_44: output: 0 [x] led-1.gpios
gpio@600000_45: input: 0 [ ]
gpio@600000_46: input: 0 [ ]
gpio@600000_47: output: 0 [x] led-4.gpios
gpio@600000_48: output: 0 [x] led-5.gpios
gpio@600000_49: input: 0 [ ]
gpio@600000_50: output: 0 [x] led-2.gpios
gpio@600000_51: output: 0 [x] led-3.gpios
gpio@600000_52: output: 0 [ ]
gpio@600000_53: input: 0 [ ]
gpio@600000_54: input: 0 [ ]
gpio@600000_55: input: 0 [ ]
gpio@600000_56: input: 0 [ ]
gpio@600000_57: input: 0 [ ]
gpio@600000_58: input: 0 [ ]
gpio@600000_59: input: 0 [ ]
gpio@600000_60: input: 1 [ ]
gpio@600000_61: input: 0 [ ]
gpio@600000_62: input: 0 [ ]
gpio@600000_63: input: 1 [ ]
gpio@600000_64: input: 1 [ ]
gpio@600000_65: input: 1 [ ]
gpio@600000_66: input: 0 [ ]
gpio@600000_67: input: 0 [ ]
gpio@600000_68: input: 0 [ ]
gpio@600000_69: input: 0 [ ]
gpio@600000_70: input: 0 [ ]
gpio@600000_71: input: 0 [ ]
gpio@600000_72: input: 0 [ ]
gpio@600000_73: input: 0 [ ]
gpio@600000_74: input: 0 [ ]
gpio@600000_75: input: 0 [ ]
gpio@600000_76: input: 0 [ ]
gpio@600000_77: input: 0 [ ]
gpio@600000_78: input: 0 [ ]
gpio@600000_79: input: 0 [ ]
gpio@600000_80: input: 0 [ ]
gpio@600000_81: input: 0 [ ]
gpio@600000_82: input: 1 [ ]
gpio@600000_83: input: 0 [ ]
gpio@600000_84: input: 0 [ ]
gpio@600000_85: input: 0 [ ]
gpio@600000_86: input: 0 [ ]
gpio@600000_87: input: 1 [ ]
gpio@600000_88: input: 0 [ ]
gpio@600000_89: input: 1 [ ]
gpio@600000_90: input: 1 [ ]
gpio@600000_91: input: 1 [ ]
gpio@600000_92: input: 1 [ ]
gpio@600000_93: input: 0 [ ]
gpio@600000_94: input: 0 [ ]
gpio@600000_95: input: 0 [ ]
gpio@600000_96: input: 0 [ ]
gpio@600000_97: input: 0 [ ]
gpio@600000_98: input: 0 [ ]
gpio@600000_99: input: 0 [ ]
gpio@600000_100: input: 0 [ ]
gpio@600000_101: input: 0 [ ]
gpio@600000_102: input: 0 [ ]
gpio@600000_103: input: 0 [ ]
gpio@600000_104: input: 0 [ ]
gpio@600000_105: input: 1 [ ]
gpio@600000_106: input: 1 [ ]
gpio@600000_107: input: 1 [ ]
gpio@600000_108: input: 1 [ ]
gpio@600000_109: input: 1 [ ]
gpio@600000_110: input: 1 [ ]
gpio@600000_111: input: 1 [ ]
gpio@600000_112: input: 1 [ ]
gpio@600000_113: input: 1 [ ]
gpio@600000_114: input: 0 [ ]
gpio@600000_115: input: 1 [ ]
gpio@600000_116: input: 1 [ ]
gpio@600000_117: input: 1 [ ]
gpio@600000_118: input: 1 [ ]
gpio@600000_119: input: 1 [ ]
gpio@600000_120: input: 0 [ ]
gpio@600000_121: input: 1 [ ]
gpio@600000_122: input: 0 [ ]
gpio@600000_123: input: 0 [ ]
gpio@600000_124: input: 0 [ ]
gpio@600000_125: input: 0 [ ]

 

It was also failed to change output.

=> gpio set 123=1
gpio: pin 123=1 (gpio 123) value is 1
   Warning: value of pin is still 0

 

What should I do to control GPIO output in U-Boot.

 

Best Regards,

Koji

 

  • Hi Koji, 

    For the GPIO, the error 'Warning: value of pin is still 0' occurs when the U-Boot device tree differs from the Linux Device Tree. Specifically, when the pinmux is even slightly different, the error occurs and gpio will not toggle. Please try the following:  gpio set gpio@600000_123. For more information refer to the following FAQ: [FAQ] PROCESSOR-SDK-AM62X: How to Toggle GPIOs and LEDs from U-Boot Command Prompt - Processors forum - Processors - TI E2E support forums. 

    - Shriya

  • Hi Shriya,

    Why Linux device tree is influence on U-Boot before booting Kernel?

    In U-Boot console, it should be undetermined which boot media to load linux device tree from.

    Should I match the device trees that in stalled in all of media if there are multiple boot media?

     

    I would like to integrate U-Boot for several variation custom boards in same series.

    Is it impossible if pinmux of the boards are partially different?

     

    Best Regards,

    Koji

  • Hi Koji,

    We keep each thread focused on a single topic, so please close this discussion and open a new thread for your additional questions.

    Thanks,
    Shriya

  • For the GPIO, the error 'Warning: value of pin is still 0' occurs when the U-Boot device tree differs from the Linux Device Tree. Specifically, when the pinmux is even slightly different, the error occurs and gpio will not toggle.

    According to Bin Liu statement in the following thread, the pinmux of device trees for U-Boot and Linux don't have to match.

    AM62L: GPIO device tree configuration in U-Boot and Linux

    Please for your correctly support.

  • Hello Koji, 

    I believe I misspoke earlier. What I was trying to say is that the syntax for the command line you were trying to use in U-Boot differed from what was expected which was causing the issue. That is why gpio set 123=1 gave you the previous error message. Apologies for the confusion.

    Regards,

    Shriya

  • Please try the following:  gpio set gpio@600000_123.

    I understood you said the above command is correct.

    I tried the command but the same error was occurred.

    However, the GPIO direction was changed input to output before and after executing the command.

    It seems that GPIO direction is changed by executing "gpio set" or "gpio input".

    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: input: 0 [ ]
    => gpio set gpio@600000_123
    gpio: pin gpio@600000_123 (gpio 123) value is 1
       Warning: value of pin is still 0
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: output: 0 [ ]
    => gpio input gpio@600000_123
    gpio: pin gpio@600000_123 (gpio 123) value is 0
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: input: 0 [ ]
    =>

    GPIO output value could not be changed, so my issue is not resolved yet.
     
    Best Regards,
    Koji
  • Hi Koji, 

    Would you be able to try 2 things. 

    1. Test if you get this warning on other banks within the main_gpio0 module. Take a look at Table 4-104. MAIN.GPIO.0 GPIO Register/Pin Mapping within the AM62L TRM: AM62L Technical Reference Manual (Rev. A)

    2. Look into the following E2E which encountered a similar issue to yours: (+) AM625: related thread: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1271243/am625-u-boot-cmd_gpio-run-gpio-status--a-and-value-is-always-0 - Processors forum - Processors - TI E2E support forums. They were able to resolve their issue with a memory write to a padconfig register. Please look at Table 14-5772. Description Of The Pad Configuration Register Bits and Table 14-5773. AM62L PADCONFIG Registers within the TRM as well. 

    Best Regards,

    Shriya

  • Hi Shriya,

    1. Test if you get this warning on other banks within the main_gpio0 module.

    It was occurred the same issue when I executed "gpio set" to the other GPIO configured as output in pinmux.

    But it wasn't occurred the issue to GPIO configured as input in pinmux, and changed output value.

     

    They were able to resolve their issue with a memory write to a padconfig register.

    I need time to confirm this method, so I would like to try this if it is impossible to set output with "gpio set".

    Before that, I would like to know why it could not be succeeded when using "gpio set".

     

    Best Regards,

    Koji

  • Hi Koji,

    As mentioned in the previous thread, a memory write command is needed to configure the PADCONFIG register of the GPIO you want to control and enable its output. Once the proper PADCONFIG settings were applied, they were able to use gpio set successfully to change the pin value. It is not that the gpio set will not succeed, but may require configuring beforehand.

    Best Regards,
    Shriya

  • It is not that the gpio set will not succeed, but may require configuring beforehand.

    So, you mean it needs to set PADCONFIG register to control GPIO with "gpio set" in U-Boot, correct?

    I understood need to do the following step.

    1. Log in U-Boot Console
    2. Write PADCONFIG register for GPIO
    3. execute "gpio set" to change output

    In the end, is it impossible to configure pinmux in device tree instead of writing PADCONFIG?

     

    Best Regards,

    Koji

  • Hi Koji, 

    From my understanding, this is just one possible solution, but it should not be impossible to configure pinmux in a device tree. However, we are currently in the process of debugging the issue to better understand the root cause which is why we are taking these steps. In the meantime, I would like to also suggest an additional troubleshooting step: please run the gpio set command on the pin again, and read the register value both before and after executing the command. This will help us determine if the command is actually modifying the register value.

    Best Regards,

    Shriya

  • Hi Shriya,

    I tried to read and write the PADFONFIG.

    It's the result when read and write the PADCONFIG for GPIO0_123.

    The register value did not change before and after the "gpio set" command executed.

    => md 0x4084238
    04084238: 00010007
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: input: 0 [ ]
    => gpio set gpio@600000_123
    gpio: pin gpio@600000_123 (gpio 123) value is 1
       Warning: value of pin is still 0
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: output: 0 [ ]
    => md 0x4084238
    04084238: 00010007

     

    When I tried the same method to the register for GPIO0_125 configured as input in the pinmux of device tree, the register value was not changed but GPIO status was changed.

    => md 0x04084248
    04084248: 00054007
    => gpio stats -a gpio@600000_125
    Bank gpio@600000_:
    gpio@600000_125: input: 1 [ ]
    => gpio set gpio@600000_125
    gpio: pin gpio@600000_125 (gpio 125) value is 1
    => gpio stats -a gpio@600000_125
    Bank gpio@600000_:
    gpio@600000_125: output: 1 [ ]
    => md 0x04084248
    04084248: 00054007
    

     

    I tried to write the same value with GPIO0_125 to the PADCONFIG for GPIO0_123 before executing "gpio set".
    As a result, I could changed the GPIO0_123 status by "gpio set".
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: input: 0 [ ]
    => mw 0x4084238 00054007
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: input: 0 [ ]
    => gpio set gpio@600000_123
    gpio: pin gpio@600000_123 (gpio 123) value is 1
    => gpio stats -a gpio@600000_123
    Bank gpio@600000_:
    gpio@600000_123: output: 1 [ ]
    =>
     
    I would like to know why it is necessary to write to the register when pinmux is configured output.
     
    Best Regards,
    Koji
  • Hi Koji, 

    It is not necessary to write to the register, however, we were taking these steps as a sanity check. Would you be able to tell me where your device tree is located, where you are defining the pinmux in your device tree, and how you are structuring your device tree?

    Regards,

    Shriya

  • Hi Shriya,

    I'm structuring the device tree to following:

    arch/arm64/boot/dts/ti/
    |-- k3-am62l-custom.dts
    `-- k3-am62l3-custom-pinmux.dtsi

    and pinmux.dtsi is included in k3-am62l-custom.dts.

    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/leds/common.h>
    #include "k3-am62l3.dtsi"
    #include "k3-pinctrl.h"
    
    #include "k3-am62l3-custom-pinmux.dtsi"
    

    Please reference my first post to confirm the GPIO configure.
    I configured GPIO nodes in device trees for our custom board:

     

    Best Regards,

    Koji

  • Hi Koji,
    It appears that the device tree changes you are making are being applied to the Linux kernel source under arch/arm64/boot/dts/ti, rather than within the U-Boot source tree. U-Boot maintains its own copy of the device tree, so any GPIO-related modifications must be made in the corresponding U-Boot device tree directory for them to take effect during the bootloader stage.
    Since no updates have been applied to the U-Boot device tree, the changes you expect are not being reflected in U-Boot, which is likely the root cause of the issue you're seeing.
    Regards,
    Shriya

  • Hi Shriya,

    Sorry, I have attached wrong device tree.

    This is correct one.

    dts/upstream/src/arm64/ti/
    |-- k3-am62l3-custom.dts
    `-- k3-am62lx-custom-pinmux.dtsi

    The pinmux is included in the dts.

    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/leds/common.h>
    #include <dt-bindings/net/ti-dp83867.h>
    #include "k3-am62l3.dtsi"
    #include "k3-am62lx-custom-pinmux.dtsi"
    #include "k3-pinctrl.h"

    Even though the U-Boot device tree is configured as above, "gpio set" command could not be succeeded.

     

    Best Regards,

    Koji

  • Hi Koji, 

    Would you be able to send both your u-boot and linux device tree files? I also would like to know why you enabled certain bits for the PADCONFIG in the following line: 

    mw 0x4084238 00054007

    Regards,

    Shriya

  • Would you be able to send both your u-boot and linux device tree files?

    As I mentioned before, I don't understand why linux device tree is influence on working in U-Boot.

    Do you need the all contents in device tree?

    I think that already attached the contents related GPIO before.

    I would like to get your explanation why  your want me to these information and what information is insufficient.

     

    I also would like to know why you enabled certain bits for the PADCONFIG in the following line: 

    GPIOI0_125 could be controlled by "gpio set" command, so I tried to enable the bits for GPIO0_123 to match with GPIO0_125.

  • As we go through the process of troubleshooting this issue, I want to clarify an earlier statement. Previously, I mentioned that the u-boot and linux device tree do not need to match up. However, they do need to match in respect to pinmux configurations. A mismatch in pinmux values between both dts files could be causing the issue you see above which is something we have not covered yet. That is why I would like to compare both files (specifically both GPIO configurations). 

    That alongside incorrect PADCONFIG values can prevent a GPIO form physically toggling even if it appears to be toggled in software. Can you please explain further why you enabled the specific values you did in the PADCONFIG register? Here is a helpful guide that goes over the PADCONFIG registers bits: [FAQ] AM625 / AM623 / AM620-Q1 / AM62L / AM64x/ AM243x (ALV) / AM62Ax / AM62D-Q1 / AM62Px Design Recommendations / Custom board hardware design – Information on PADCONFIG bits and PADCONFIG registers default values summary - Processors forum - Processors - TI E2E support forums. 

    Hope this helps,

    Shriya

  • I've said  the pinmux of device trees for U-Boot and Linux don't have to match, and you didn't deny.

    I ask the same thing again, why Linux device tree is influence on U-Boot before booting Kernel?

    According to Bin Liu statement in the following thread, the pinmux of device trees for U-Boot and Linux don't have to match.

    AM62L: GPIO device tree configuration in U-Boot and Linux

     

    Can you please explain further why you enabled the specific values you did in the PADCONFIG register?

    I already mentioned the reason above, and I have no further explanation.

    I will try to write the specific bit for the PADCONFIG correctly, but I need your explanation why I could not set GPIO to output in the current situation.

     

    You said me to read the register value, but you've never mentioned about the value yet.

    In the first place, is this the expected value when the GPIO is set to output?

    I tried to read and write the PADFONFIG.

    It's the result when read and write the PADCONFIG for GPIO0_123.

  • Hi Koji, 

    The development team I would need to consult with regarding your issue is currently out of office on holiday. We will get back to you next week with more information. In the meantime, if you are able to manipulate GPIO0_123 by writing the same value you had for GPIO0_125 PADCONFIG, would you be able to try this with other pins as well?

    Thank you,

    Shriya

  • Hi Koji, 

    I see you have reopened the thread, was there any more information you would like to add until we hear back from the development team?

    Regards,

    Shriya

  • I already added all information I could.

    In the meantime, if you are able to manipulate GPIO0_123 by writing the same value you had for GPIO0_125 PADCONFIG, would you be able to try this with other pins as well?

    If your development team can't start to research before I have not done to confirm other pin's working, I will confirm it first.

     

    Best Regards,

    Koji

  • Do you have any update?

    When I confirmed the other GPIO that configured as output, it seems that gpio-hog also could not be working.

    I guess this issue is related with the gpio set issue.

    p2-hog {
    		/* P2 - ET1_RSTn */
    		gpio-hog;
    		gpios = <2 GPIO_ACTIVE_HIGH>;
    		output-high;
    		line-name = "ET1_RSTn";
    	};

     

    Best Regards,

    Koji

  • Hi Koji,

    I believe I can offer clarification. GPIOs configured as PIN_OUTPUT are failing to drive the pin even though the GPIO direction changes from input to output and the output register is written. In contrast, GPIOs initially configured as PIN_INPUT work correctly with gpio set, with no warning, as observed in your testing.

    The failing GPIO0_123 showed a PADCONFIG value of 0x00010007, while a working GPIO0_125 showed 0x00054007. When the working PADCONFIG value was manually written to GPIO0_123 using mw, the pin immediately began working correctly with no warning and correct output readback. This confirms that the GPIO controller itself is functioning correctly and that the root cause is the PADCONFIG value for output pins.

    Since neither gpio set nor gpio-hog updates the PADCONFIG register, both were physically unable to drive the pin until the PADCONFIG was manually corrected, meaning the permanent fix must be in the pinmux macro rather than in the GPIO commands.

    The reason PIN_INPUT pins worked is that it enables the GPIO input buffer, allowing the pin level to be read correctly and to be used as an input or output. However, proper PADCONFIG settings are still required for reliable output driving. If the pins are set as inputs, you can use gpio set in U-Boot to change them. Otherwise, the PADCONFIG value must be modified (as done with GPIO0_123) if you want to keep the pin defined as PIN_OUTPUT in the device tree.

    Hope this helps,

    Shriya

  • I understood that gpio-hog issue is occurred by same reason with gpio set.

     

    You have said it is not necessary to write to the PADCONFIG register.

    Is your explanation consistent?

    It is not necessary to write to the register, however, we were taking these steps as a sanity check.

    Otherwise, the PADCONFIG value must be modified (as done with GPIO0_123) if you want to keep the pin defined as PIN_OUTPUT in the device tree.

     

    meaning the permanent fix must be in the pinmux macro rather than in the GPIO commands.

    I attached the GPIO pinmux before.

    Is that configure correct?

     

    There are the other questions you haven't answered yet.

    This thread cannot be closed until these questions are resolved.

    I ask the same thing again, why Linux device tree is influence on U-Boot before booting Kernel?

    You said me to read the register value, but you've never mentioned about the value yet.

    In the first place, is this the expected value when the GPIO is set to output?

     

    How is your development team progressing?

     

    Best Regards,

    Koji

  • Hi Koji,
    I apologize for the confusion caused by my earlier explanations.


    My initial thought process was that the issue stemmed from differences between the Linux and U-Boot device trees. This is a common source of GPIO-related problems, as U-Boot pulls in a snapshot of the Linux device tree at build time and builds on top of that copy, rather than dynamically referencing the active Linux DTS at runtime. Because of this, any mismatch in how GPIO pins are defined between Linux and U-Boot can lead to the behavior you observed.

    Is your explanation consistent?

    Regarding my earlier comments on the PADCONFIG register: after additional testing on my side, I was able to set and control GPIO output pins in U-Boot only after updating the PADCONFIG register. I also can confirm that your register values for gpio0_123 and gpio0_125 are consistent with what is to be expected. This is why in my later explanation I recommended modifying the PADCONFIG value. Enabling the appropriate PADCONFIG bits through the U-Boot command line is required for this approach to function correctly. 

    How is your development team progressing?

    From the device tree code you shared, your configuration does appear correct. I am not certain why the expected output state is not reflected at initial boot, and I am working with the development team on resolving your issue, however, their responses may be delayed due to an upcoming release.
    Please let me know if you would like further clarification.


    Best regards,
    Shriya

  • Because of this, any mismatch in how GPIO pins are defined between Linux and U-Boot can lead to the behavior you observed.

    Do you mean it may be caused if there was just one difference between Linux and U-Boot device tree?

    The pinmux for the GPIO where the problem occurs matches, but there are some differences in the other configure.

    According to the another thread I asked, it is allowed difference between these device tree.

     

    Enabling the appropriate PADCONFIG bits through the U-Boot command line is required for this approach to function correctly. 

    In my understanding, it is not necessary to write to PADCONFIG normally, but it is necessary to write in the current situation.

    Is it correct?
     
    I'm waiting for response from your development team.
     
    Best Regards,
    Koji
  • Hi Koji,

    I believe your current Linux and U-Boot device tree configuration should be fine, as you indicated that the GPIO pinmux settings match. In regards to the PADCONFIG register, your statement is correct. In general, PADCONFIG does not need to be explicitly written to, but based on the current behavior we are seeing, it appears to be necessary in this situation. I believe writing to the PADCONFIG register is the solution you are looking for. I will update you once I hear back from the development team in case there are any additional solutions.

    Regards,
    Shriya

  • I will work around by writing PADCONFIG until updating from development team.

    The register value for GPIO output pin before write is 0x00010007.

    According to TRM, I think this is already appropriate value as configuration for GPIO output.

    Could you tell me what value I should write to the register?

     

    Best Regards,

    Koji