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.

AM6442: How to find the MCU GPIO number when using the GPIO pin in Linux

Part Number: AM6442
Other Parts Discussed in Thread: SYSCONFIG, TPIC2810

Hi, I am trying to access the MCU GPIO peripherals (in the safety connector) from the Main domain on my TMDS64GPEVM. I am using the Linux processor sdk 7.3 and the updated device tree files from https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti?h=ti-linux-5.10.y .

I have generated the pinmux for these peripherals from the Sysconfig tool, but I am not sure how the MCU GPIO's get translated to the the bank/chip number when used in the Main domain. By default I could see the 2 main gpio banks and 1 that is created in one of the i2c.

I have updated the mcu_gpio status from "reserved" to "okay" and I am looking for the pin mapping so that I can test those gpios.

Based on this FAQ https://e2e.ti.com/support/processors-group/processors/f/processors-forum/948888/faq-ccs-tda4vm-tda4-how-do-i-determine-the-gpio-number-within-linux-for-a-pin-within-the-schematic I can see that the soc pin number + gpiochip offset can be used to find the gpio pin. Could you share as to how I can find the correct pin number in case of MCU pins ?

  • Hi,

    I'm sorry, but our GPIO expert is out this week. We'll try to get back to you next week.

    Thanks for your patience.

    Jianzhong

  • Hi,

    For the current SDK, the MCU resources are not mapped to Linux by system firmware. Therefore, they are not accessible to Linux. This is changing in the next SDK which will be based on v5.10. I recommend waiting until this SDK is released to validate this feature. The SDK should be available in the coming weeks.

    When this is all enabled, I believe you will see mcu-gpio in your listing and you will be able to decode the pin numbers using the method detailed above.

  • Could share the exact release date ? 

  • Hello Abin,

    We cannot promise an exact release date. As of today the tentative release date is next week. It will definitely be released sometime in August.

    Regards,

    Nick

  • We have a custom board due for delivery that needs this feature. Could you possibly point me how to do this ?

  • Hello Abin,

    Ron will be able to take a look at your thread when he returns next week. However, we hope to release SDK 8.0 next week as well, so it probably just makes sense to wait another couple of days.

    Regards,

    Nick

  • The issue persists in SDK 8.0

    I have added the MCU pinmux, enabled the mcu_gpio0 and added the pinmux for the gpio pins in the dts file.

  • Hello,

    Yes, you are correct. The following change needs to be applied:

    diff --git a/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi
    b/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi
    index 99e94dee1bd4..892db8229f77 100644
    --- a/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi
    @@ -86,7 +86,7 @@
            };
            mcu_gpio0: gpio@4201000 {
    -               compatible = "ti,am64-gpio", "keystone-gpio";
    +               compatible = "ti,am64-gpio", "ti,keystone-gpio";
                    reg = <0x0 0x4201000 0x0 0x100>;
                    gpio-controller;
                    #gpio-cells = <2>;
    After this, I've confirmed the new gpiochip shows up on an AM64x Starter Kit:
    root@am64xx-evm:~# cat /sys/kernel/debug/gpio
    gpiochip4: GPIOs 298-305, parent: i2c/1-0060, tpic2810, can sleep:
     gpio-298 (LED1                |green:activity      ) out ?
     gpio-299 (LED2                |red:activity        ) out ?
     gpio-300 (LED3                |green:activity_1    ) out ?
     gpio-301 (LED4                |amber:activity      ) out ?
     gpio-302 (LED5                |green:activity_2    ) out ?
     gpio-303 (LED6                |red:activity_1      ) out ?
     gpio-304 (LED7                |green:activity_3    ) out ?
     gpio-305 (LED8                |amber:activity_1    ) out ?
    gpiochip3: GPIOs 306-393, parent: platform/601000.gpio, 601000.gpio:
    gpiochip2: GPIOs 394-480, parent: platform/600000.gpio, 600000.gpio:
     gpio-442 (                    |fixed-regulator-wlan) out lo
     gpio-456 (                    |fixed-regulator-com8) out lo ACTIVE LOW
    gpiochip1: GPIOs 481-503, parent: platform/4201000.gpio, 4201000.gpio:
    gpiochip0: GPIOs 504-511, parent: i2c/1-0070, 1-0070, can sleep:
     gpio-504 (GPIO_CPSW2_RST      )
     gpio-505 (GPIO_CPSW1_RST      )
     gpio-506 (PRU_DETECT          )
     gpio-507 (MMC1_SD_EN          |fixed-regulator-sd  ) out hi
     gpio-508 (VPP_LDO_EN          )
     gpio-509 (RPI_PS_3V3_En       )
     gpio-510 (RPI_PS_5V0_En       )
     gpio-511 (RPI_HAT_DETECT      )
  • Thanks . With this change I can see that the gpio is being listed. However I am not able to change the output state for the GPIOs. I have tried with the MCU_GPIO0_6 &MCU_GPIO0_7 in the safety connector of the GP EVM.

    Could you check this at your end ?

    Also could you mention if the mcu_pmx0 node is needed for this change (it is not present in the device tree by default) ? I have added this to enable the pin muxing for the MCU pins.

    mymcu_gpio0_pins_default: mymcu_gpio0_pins_default {
            pinctrl-single,pins = <
                AM64X_MCU_IOPAD(0x0018, PIN_OUTPUT, 7) /* (B7) MCU_SPI1_CS1.MCU_GPIO0_6 */
                AM64X_MCU_IOPAD(0x001c, PIN_OUTPUT, 7) /* (D7) MCU_SPI1_CLK.MCU_GPIO0_7 */
            >;
        };