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.

TDA4VM: Where to apply PinMux settings

Part Number: TDA4VM
Other Parts Discussed in Thread: TDA2

Hi,

I have a question regarding the PinMux settings on TDA4.

Following scenario: I run a linux and load and start firmware for the other DSPs/R5-Cores via remoteproc from linux. Where do I need to apply the PinMux settings?

1. SPL for R5?

2. SPL for A72?

3. U-Boot for A72?

4. Linux-Kernel ?

5. PDK for the DSPs/R5 firmware?

Is there any way in Linux to  verfiy, that my PinMux configuration was applied?

Best regards,
Thomas

  • Hi Thomas,

    The pinmux is applied in SPL for R5.

    We have a very good guide to help you understand this: e2e.ti.com/.../927526

    I hope you have taken a look at this guide on how to use pinmux tool and verify that too.

    Regards

    Karthik

  • Hi Karthik,

    thank you for the link, I am aware of this post.

    I know how to configure and generate the PinMux related files. But I'm not 100% sure, in which situations I need to apply these to SPL/U-Boot/Kernel/PDK.

    This is what I assume. It would be great if you could confirm or decline my assumptions:

    1. I need to apply at least the PinMux-Config for the SPL R5, to be able to access the data storage for loading SYSFW, A72 ATF/OPTEE and depending hardware. (For example OSPI/UFS)

    2. I need to apply at least the PinMux-Config for the U-Boot, to be able to access the kernel, dtb and rootfs. For example ethernet for booting over ethernet.

    3. In the case that the firmware for MAIN_R5_0_0 requires SPI Port, the required PinMux configuration should be applied by linux kernel, and should not changed by firmware itself via
    boardCfg = (BOARD_INIT_PINMUX_CONFIG)   
    boardReturn = Board_init(boardCfg);
    because changing PinMux configuration after linux booted is not supported.

    Q1: Based on these assumptions, could I just apply the whole PinMux configuration on SPL R5, SPL A72 and U-Boot and Linux? Just for simplification of the build process.

    Q2: Is it wrong or could it lead to problems, if I apply the whole PinMux configuration on Linux, and also configure within my firmware the identical PinMux configuration after firmware start?

    Q3: Do I even need to apply the PinMux Configuration to the PSDK and rebuild the PDK for my firmware, when the whole PinMux configuration is done by Linux?

    Best regards,
    Thomas

  • Thomas,

    Thomas Dorsch said:

    1. I need to apply at least the PinMux-Config for the SPL R5, to be able to access the data storage for loading SYSFW, A72 ATF/OPTEE and depending hardware. (For example OSPI/UFS)

    2. I need to apply at least the PinMux-Config for the U-Boot, to be able to access the kernel, dtb and rootfs. For example ethernet for booting over ethernet.

    3. In the case that the firmware for MAIN_R5_0_0 requires SPI Port, the required PinMux configuration should be applied by linux kernel, and should not changed by firmware itself via
    boardCfg = (BOARD_INIT_PINMUX_CONFIG)   
    boardReturn = Board_init(boardCfg);
    because changing PinMux configuration after linux booted is not supported.

    That is right. We configure the pins of the modules that are exercised/used by the R5 SPL, A72 SPL, A72 u-boot, Linux kernel in the corresponding
    places.

    That said doing all the pinmux in the Linux side will have some challenges:

    1) The firmwares for R5f get loaded at R5 SPL stage really early. That means you need to be aware of which stage your firmware is loaded so that correspondingly the SPL or u-boot or Linux have to configure pinmux upfront for you. This is still doable but the bigger problem is as below.

    2) The SPL/u-boot configures pinmuxes as and when needed.

    For example: We need to change the voltage of a PMIC that is connected to i2c0. Only when the pmic driver is probed the corresponding
    i2c pinmux is configured.

    Ex; wkup_i2c0_pins_default in "arch/arm/dts/k3-j721e-r5-common-proc-board.dts".

    Is setup when the tps659413 is probed:

    &wkup_i2c0 {
            u-boot,dm-spl;
            tps659413a: tps659413a@48 {
                    reg = <0x48>;
                    compatible = "ti,tps659413";
                    u-boot,dm-spl;
                    pinctrl-names = "default";
                    pinctrl-0 = <&wkup_i2c0_pins_default>;
                    clock-frequency = <400000>;
    

    The pinmux are configured only when you have their phandles are populated in the nodes that use them.
    Like pinctrl-0 = <&wkup_i2c0_pins_default>; is used by tps659413a.

    So when you cannot initialize some pinmux for modules that are not probed by SPL/U-boot you better use the firmware
    to set your pinmux.

    My suggestion is to configure pinmux where the modules are needed. Otherwise it will be a hack & you will end up debugging
    u-boot/SPL/Linux when firmware are not functional.

    Hope you got my perspective.

    Best Regards,
    Keerthy

  • Thank you very much Keerthy, I think its almost clear to me now.

    One last question: "My suggestion is to configure pinmux where the modules are needed".
    I understand this, but does this conflict with my third assumption?

    Lets examine your example with changing the voltage of a PMIC via i2c0. This is done via firmware of MAIN_R5_0_0.
    Firmware of MAIN_R5_0_0 is loaded and startet by Linux/remoteproc.

    So first of all the R5 SPL, A72 SPL, A72 u-boot and Linux kernel will change the default PinMux configuration of the SoC.
    After linux has boot and MAIN_R5_0-0 firmware has been loaded and started, the PinMux configuration is changed again for usage of i2c0.

    Isn't this, technically spoken, a change of PinMux configuration after linux has booted?
    I've read somehwere in e2e forum, that this is offical not supported.

    Best regards,
    Thomas

  • Thomas Dorsch said:
    So first of all the R5 SPL, A72 SPL, A72 u-boot and Linux kernel will change the default PinMux configuration of the SoC.
    After linux has boot and MAIN_R5_0-0 firmware has been loaded and started, the PinMux configuration is changed again for usage of i2c0.

    This is not right. R5 SPL loads MAIN_R5_0-0 firmware & firmware does pinmux settings needed for the functionality it intends to do.
    You should make sure that the same pin configuration is not overwritten by other entities.


    Thomas Dorsch said:
    Isn't this, technically spoken, a change of PinMux configuration after linux has booted?
    I've read somehwere in e2e forum, that this is offical not supported.

    This is true for TDA2. The pinmux configuration is all done one time at u-boot due to IODelay.

    For the TDA4 that can be done in any place SPL/U-boot/Kernel or even firmware. Hope this answers all your questions."
    Please resolve if i have answered all your questions.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    "This is not right. R5 SPL loads MAIN_R5_0-0 firmware & firmware does pinmux settings needed for the functionality it intends to do.
    You should make sure that the same pin configuration is not overwritten by other entities."

    Sorry, I think we have a misunderstanding here: In my hypothetical scenario, linux would load and start a custom firmware on MAIN_R5_0_0 via remoteproc. (Pretty late, after linux has booted)
    This custom firmware needs to access i2c0.

    Where should I put the PinMux configuration for i2c0 for that case?

    This was the post which made me thinking not changing PinMux configuration after linux has boot:

    "1) No runtime changing of pinmux."

    Sorry for asking all these questions.

    Very best regards,
    Thomas

  • Hi Thomas,

    Thomas Dorsch said:

    Sorry, I think we have a misunderstanding here: In my hypothetical scenario, linux would load and start a custom firmware on MAIN_R5_0_0 via remoteproc. (Pretty late, after linux has booted)
    This custom firmware needs to access i2c0.

    Where should I put the PinMux configuration for i2c0 for that case?

    Since the firmware is the one that uses the i2c it should be part of that. Like you mentioned via
    boardCfg = (BOARD_INIT_PINMUX_CONFIG)   
    boardReturn = Board_init(boardCfg);

    Linux does not plan to use I2C as per your hypothetical scenario so we should not configure from Linux.

    Thomas Dorsch said:
    "1) No runtime changing of pinmux."

    That means only to say that device tree at boot time will configure the pinmux neded for Linux & does not happen runtime.
    That does not mean other entities like firmware cannot.
    So your firmware that runs on a remotecore can configure I2c pinmux when it runs after Linux boots up.

    FYI: Most firmware today are loaded by either SPL or u-boot. Linux only attaches to the already running remotecore. Early boot by SPL/U-boot and Latea attach by Linux.

    Best Regards,
    Keerthy

  • Thank you very much Keerthy, that answers all my questions.

    Best Regards,
    Thomas