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.

SK-AM62: about gpio register

Part Number: SK-AM62

Tool/software:

HI

I applied pinctl with gpio0-0 pin in the device tree. I realized the control of gpio by manipulating the register as shown below. I would like to ask if GPIO pins, which are not described in the device tree, can be directly implemented by manipulating registers at the application layer?

thanks

  • Hello,

    Our GPIO expert is out of office for the next 2 weeks. Feel free to ping the thread in the second week of July if he hasn't responded.

    -Daolin

  • Hi Teng,

    As Daolin mentioned, our GPIO expert is out of office, but I will provide my comments:

    Yes, the GPIO pins can be controlled directly by their registers. But please note that the GPIO DATA/DIR registers mentioned in your TRM screenshot are for controlling the GPIO input/output or high/low. Before you control these, please ensure the GPIO pin padconfig registers are set properly to put the pin in GPIO mode.

  • Hello, I would like to configure mcu_gpio0-0 to gpio mode. Which other registers do I need to configure? Do I still need to configure ctrl-MMR register, power register, and clock register in TRM 14.2?

  • Hi,

    Configuring GPIO mode is done through kernel device tree, but not directly modifying registers.

    I am routing your query to our GPIO expert for comments.

  • Hello,

    To define MCU GPIO via device tree, see below:

    diff --git a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    index b1980b85c..d6794153f 100644
    --- a/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi
    @@ -329,6 +329,15 @@ AM62X_IOPAD(0x0078, PIN_OUTPUT, 1) /* (U24) GPMC0_AD15.VOUT0_DATA23 */
         };
     };
      
    +&mcu_pmx0 {
    +    mcugpio0_pins_default: mcugpio0-default-pins {
    +        pinctrl-single,pins = <
    +            AM62X_MCU_IOPAD(0x003c, PIN_INPUT, 7) /* (E5) MCU_MCAN1_TX.MCU_GPIO0_15 */
    +            AM62X_MCU_IOPAD(0x0040, PIN_INPUT, 7) /* (D4) MCU_MCAN1_RX.MCU_GPIO0_16 */
    +        >;
    +    };
    +};
    +
     &wkup_uart0 {
         /* WKUP UART0 is used by DM firmware */
         status = "reserved";
    @@ -578,11 +587,12 @@ dpi1_out: endpoint {
         };
     };
      
    -/* mcu_gpio0 and mcu_gpio_intr are reserved for mcu firmware usage */
     &mcu_gpio0 {
    -    status = "reserved";
    +    status = "okay";
    +    pinctrl-names = "default";
    +    pinctrl-0 = <&mcugpio0_pins_default>;
     };
      
     &mcu_gpio_intr {
    -    status = "reserved";
    +    status = "okay";
     };
     

    Then the GPIO can be toggled from Linux Command Line as shown in this FAQ: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1260373/faq-transitioning-the-gpio-userspace-interface-from-sysfs-to-chardev

    Best Regards,

    Anshu