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: Question about config clock resource on early SPL

Part Number: TDA4VM

Tool/software:

Hello,TI

Now  I research the code about  SPL, found the arch\arm\mach-k3\j721e\clk-data.c can config the board clock resource.

And about program this file have some user guide to add other resources if user want to use resource early before sysfw sci load?

and for example:

CLK_MUX("mcu_clkout_mux_out0", mcu_clkout_mux_out0_parents, 2, 0x40f08010, 0, 1, 0),

how to explain this code? the param about  resource name \ parents group \ the address how to get it and set?

Thanks

  • Hi Xu,

    There is no programming guide currently. That said what are the modules/clocks that you are trying to turn on?
    I can check with the internal team on this.

    - Keerthy

  • Hi,

    I want to turn on the ID 274 device mcuspi0 that used clock resource

    thanks

  • Hi Xu,

    Sciclient_pmSetModuleState()

    Can you try that from U-Boot instead of R5 SPL is that okay? We do not have the dev-data clk-data for the MCU_MCSPI0 & hence the request.

    - Keerthy

  • hi,

    does the Sciclient_pmSetModuleState() can used at SPL stage that sysfw has not load?

    I want control some SPI device at SPL stage at early in 200ms when from power on.

    Any method can got the goal?

  • the Sciclient_pmSetModuleState() used at mcu RTOS side right?we need coding at SPL uboot side, in SPL the mcu1_0 load too late

  • Hi Xu,

    Yes that's after R5 SPL. I will look into the dev_data clk_data for the relevant module. I will get back early next week. We do not have a ready example as of now.

    Best regards,

    Keerthy 

  • Thanks for your support,I will wait for your reply ,in SPL success use this resource is important for us now

  • I am yet to get feedback from the internal team on this. I will keep you updated on this.

    - Keerthy

  • hello,

    is there any update?

  • I have not yet received the feedback. I will get back next week. Thanks for your patience.

    - Keerthy

  • Hello Xu,

    We don't have any feedback on this. Is this still needed?

    - Keetrhy

  • Yes,need it, it is important for us

  • is there any update?

  • Hi Xu,

    I want to turn on the ID 274 device mcuspi0 that used clock resource

    I believe MCU_MCSPI0 is already accessible. I got a chance to try on the board with the latest 10.1 SDK.

    md 40300000 1
    40300000: 40301a0b                             ..0@
    => 
    40300004: 00000009                             ....
    => 
    40300008: 00000000                             ....
    => 
    4030000c: 00000000                             ....
    => 
    40300010: 00000008                             ....
    => 
    40300014: 00000000                             ....
    => 
    40300018: 00000000                             ....
    => 
    4030001c: 00000000                             ....
    => 
    40300020: 00000000                             ....
    => 
    40300024: 00000000                             ....
    => 
    40300028: 00000000                             ....
    => 
    4030002c: 00000000                             ....
    => 
    40300030: 00000000                             ....
    => 
    40300034: 00000000                             ....
    => 
    40300038: 00000000                             ....
    => 
    4030003c: 00000000                             ....
    => 
    40300040: 00000000                             ....
    => 
    40300044: 00000000                             ....
    => 
    40300048: 00000000                             ....
    => 
    4030004c: 00000000                             ....
    => 
    40300050: 00000000                             ....
    => 
    40300054: 00000000                             ....
    => 
    40300058: 00000000                             ....
    => 
    4030005c: 00000000                             ....
    => 
    40300060: 00000000                             ....
    => 
    40300064: 00000000                             ....
    => 
    40300068: 00000000                             ....
    => 
    4030006c: 00000000                             ....
    => 
    40300070: 00000000                             ....
    => 
    40300074: 00000000                             ....
    => 
    40300078: 00000000                             ....
    => 
    4030007c: 00000000            

    The register space is already accessible. You can try to access the same at R5 SPL stage. This should be accessible.

    - Keerthy

  • hello,

    is it meaning we need 10.1SDK? now we used 0801 uboot and with 0900 sysfw

  • Hi Xu,

    Can you try accessing the above registers from your version of binaries and check?

    Best regards,

    Keerthy 

  • ok, we  will try  and feedback later

  • => md 40300000 1 40300000: 40301a0b ..0@ => 40300004: 00000009 .... => 40300008: 00000000 .... => 4030000c: 00000000 .... => 40300010: 00000004 .... => 40300014: 00000000 .... => 40300018: 00000000 .... => 4030001c: 00000000 .... => 40300020: 00000000 .... => 40300024: 00000000 .... => 40300028: 00000000 .... => 4030002c: 00000000 .... => 40300030: 00000000 .... => 40300034: 00000000 .... => 40300038: 00000000 .... => 4030003c: 00000000 .... => 40300040: 00000000 .... => 40300044: 00000000 .... => 40300048: 00000000 .... => 4030004c: 00000000 .... => 40300050: 00000000 .... => 40300054: 00000000 .... => 40300058: 00000000 .... => 4030005c: 00000000 .... => 40300060: 00000000 .... => 40300064: 00000000 .... => 40300068: 00000000 .... => 4030006c: 00000000 .... => 40300070: 00000000 .... => 40300074: 00000000 .... => 40300078: 00000000 .... => 4030007c: 00000000 .... => 40300080: 00000000 ....

  • this is our register dump

  • Hi Xu,

    So it is the same in your case as well. You are able to access the registers. Then you can try to program them from r5 SPL and Check if you are able to?

    - Keerthy

  • What can program ? not understand,can access the register means the resource can access,but how to config in arch\arm\mach-k3\j721e\clk-data.c ?

    it is my original question

  • it is my original question

    The dev-data clk-data is needed to access those registers. If you are able to access the registers then that might not be needed.
    I believe you want to enable the MCU_MCSPI0 at R5 SPL. Isn't that the end goal?

    - Keerthy

  • we want to enable SPI driver the drive PMIC chip in SPL,need config SPI resource give driver, it is the end goal

  • we want to enable SPI driver the drive PMIC chip in SPL,need config SPI resource give driver,

    This is not supported in the U-Boot SPL. The instance you are looking for is already clocked & enabled. So you will have to program the above registers.
    In summary clk/dev-data is needed to turn on the module and for this particular instance its already on. Hope I am clear.

    - Keerthy

  • let me make this clear, the dump register stage is normal uboot the resource is ok,it is config by sysfw,but it is too late,we want to use the SPI bus when power on in 256ms,in this stage sysfw have not loaded so the resource not config ready,and we found in the early stage of SPL can use the code arch\arm\mach-k3\j721e\clk-data.c to config clk resource,so we want to get the method to config mcu_spi0 clk. Hope I explain clear

  • Hi Xu,

    I am working with the team internally. I got the data but its not yet enabling. I can see that at R5 SPL accessing the registers is causing a hang.
    So I will get back to you once i have it functional.

    - Keerthy

  • ok,waiting for your feedback

  • Hi Xu,

    Can you try with the diff below for clk/dev data:

    diff --git a/arch/arm/mach-k3/r5/j721e/clk-data.c b/arch/arm/mach-k3/r5/j721e/clk-data.c
    index bb7f61901b4..5a6e86949e1 100644
    --- a/arch/arm/mach-k3/r5/j721e/clk-data.c
    +++ b/arch/arm/mach-k3/r5/j721e/clk-data.c
    @@ -518,6 +518,7 @@ static const struct clk_data clk_list[] = {
     	CLK_FIXED_RATE("ddr32ss_16ffc_ew_dv_wrap_main_0_ddrss_io_ck_n", 0, 0),
     	CLK_FIXED_RATE("emmc8ss_16ffc_main_0_emmcss_io_clk", 0, 0),
     	CLK_FIXED_RATE("emmcsd4ss_main_0_emmcsdss_io_clk_o", 0, 0),
    +	CLK_FIXED_RATE("spi_mcu_0_io_clkspio_clk", 0, 0),
     	CLK_DIV_DEFFREQ("hsdiv4_16fft_main_1_hsdivout0_clk", "pllfrac2_ssmod_16fft_main_1_foutvcop_clk", 0x681080, 0, 7, 0, 0, 192000000),
     	CLK_DIV("hsdiv4_16fft_main_1_hsdivout2_clk", "pllfrac2_ssmod_16fft_main_1_foutvcop_clk", 0x681088, 0, 7, 0, 0),
     	CLK_DIV("hsdiv4_16fft_mcu_1_hsdivout1_clk", "pllfrac2_ssmod_16fft_mcu_1_foutvcop_clk", 0x40d01084, 0, 7, 0, 0),
    @@ -779,6 +780,9 @@ static const struct dev_clk soc_dev_clk_data[] = {
     	DEV_CLK(289, 17, "board_0_hfosc1_clk_out"),
     	DEV_CLK(289, 18, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
     	DEV_CLK(289, 19, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
    +	DEV_CLK(157, 14, "spi_mcu_0_io_clkspio_clk"),
    +	DEV_CLK(274, 0, "k3_pll_ctrl_wrap_wkup_0_chip_div1_clk_clk"),
    +	DEV_CLK(274, 1, "hsdiv4_16fft_mcu_2_hsdivout0_clk"),
     };
     
     const struct ti_k3_clk_platdata j721e_clk_platdata = {
    diff --git a/arch/arm/mach-k3/r5/j721e/dev-data.c b/arch/arm/mach-k3/r5/j721e/dev-data.c
    index b0adb1857be..ab5cb6785c3 100644
    --- a/arch/arm/mach-k3/r5/j721e/dev-data.c
    +++ b/arch/arm/mach-k3/r5/j721e/dev-data.c
    @@ -67,6 +67,7 @@ static struct ti_dev soc_dev_list[] = {
     	PSC_DEV(103, &soc_lpsc_list[13]),
     	PSC_DEV(104, &soc_lpsc_list[14]),
     	PSC_DEV(102, &soc_lpsc_list[15]),
    +	PSC_DEV(274, &soc_lpsc_list[11]),
     };
     

    I tried accessing in R5 SPL

    diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
    index dedef505441..bbff8caf5e6 100644
    --- a/arch/arm/mach-k3/j721e_init.c
    +++ b/arch/arm/mach-k3/j721e_init.c
    @@ -358,6 +358,10 @@ void board_init_f(ulong dummy)
     		setup_navss_nb();
     
     	setup_qos();
    +	printf("Just before accessing MCU_MCSPI regs\n");
    +	u32 debug;
    +	debug = readl(0x40300000);
    +	printf("The value of reg 0 is 0x%x\n", debug);
     }

    U-Boot SPL 2024.04-dirty (Jan 23 2025 - 14:44:00 +0530)

    SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.6--v10.01.06 (Fiery Fox)')

    Just before accessing MCU_MCSPI regs

    The value of reg 0 is 0x40301a0b

    Trying to boot from DFU

    - Keerthy

  • Hi, Keerthy

       Actually, we want to use MCU_MCSPI0 immediately after spl_early_init() in arch/arm/mach-k3/j721e_init.c , is this possible?Where can I use MCU_SPI0 first?

  • Hello,

    Yes. Please try reading from there and check. After spl_early_init add prints.

    - Keerthy

  • Hi, Keerthy

    It seems like the console is not ready right after spl_early_init. After adding prints there is no output from the serial port

  • Do you have a debugger? You can attach and read register values. 

    I tried accessing in R5 SPL

    Please try adding where I have added above and program the registers.

    Thanks, 

    Keerthy 

  • yes, but we don't have the related configuration file. Can you provide it to us

  • Hello,

    This was a request to enable the register access. The driver can be referred to see what registers need to configured.

    We do not have any such configuration as we use the driver. The request here was to enable the register access early and that is enabled.

    - Keerthy 

  • Hi, keerthy

    What I want is the configuration file used for debugging TDA4VM through the JTAG port, which is a CMM type file. Can this type of file be provided?

  • If you install CCS and pick j7200 as SOC then that will have all the required configs to connect cores. I do not understand why we need.
    R5 SPL once the prints are enabled could be used to read/write any values.

    - Keerthy

  • Hi, Keerthy

    Here is the diff for using mcu_stpi0 in spl

    diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
    index 5d898d3b45..49eb4f8d85 100644
    --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
    +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
    @@ -13,6 +13,7 @@
    aliases {
    remoteproc0 = &sysctrler;
    remoteproc1 = &a72_0;
    + spi2 = &mcu_spi0;
    };

    chosen {
    @@ -157,6 +158,16 @@
    J721E_WKUP_IOPAD(0x38, PIN_INPUT, 0) /* (A23) MCU_OSPI1_LBCLKO */
    >;
    };
    +
    + mcu_spi0_pins_default: mcu_spi0_pins_default {
    + u-boot,dm-spl;
    + pinctrl-single,pins = <
    + J721E_WKUP_IOPAD(0x90, PIN_OUTPUT, 0) /* (E27) MCU_SPI0_CLK */
    + J721E_WKUP_IOPAD(0x94, PIN_OUTPUT, 0) /* (E24) MCU_SPI0_D0 */
    + J721E_WKUP_IOPAD(0x98, PIN_INPUT, 0) /* (E28) MCU_SPI0_D1 */
    + J721E_WKUP_IOPAD(0x9C, PIN_OUTPUT, 0) /* (E25) MCU_SPI0_CS0 */
    + >;
    + };
    };

    &main_pmx0 {
    @@ -476,3 +487,22 @@
    &wkup_i2c0 {
    /delete-property/ power-domains;
    };
    +
    +&cbass_mcu_wakeup {
    + status = "okay";
    + u-boot,dm-spl;
    + mcu_spi0: spi@40300000 {
    + u-boot,dm-spl;
    + compatible = "ti,omap4-mcspi";
    + reg = <0x00 0x040300000 0x00 0x400>;
    + interrupts = <GIC_SPI 848 IRQ_TYPE_LEVEL_HIGH>;
    + #address-cells = <1>;
    + #size-cells = <0>;
    + power-domains = <&k3_pds 274 TI_SCI_PD_EXCLUSIVE>;
    + clocks = <&k3_clks 274 0>;
    + status = "okay";
    + pinctrl-names = "default";
    + pinctrl-0 = <&mcu_spi0_pins_default>;
    + ti,pindir-d0-out-d1-in;
    + };
    +};
    diff --git a/arch/arm/mach-k3/j721e/clk-data.c b/arch/arm/mach-k3/j721e/clk-data.c
    index 5540c7af62..1b8a4f6591 100644
    --- a/arch/arm/mach-k3/j721e/clk-data.c
    +++ b/arch/arm/mach-k3/j721e/clk-data.c
    @@ -513,6 +513,7 @@ static const struct clk_data clk_list[] = {
    CLK_FIXED_RATE("ddr32ss_16ffc_ew_dv_wrap_main_0_ddrss_io_ck_n", 0, 0),
    CLK_FIXED_RATE("emmc8ss_16ffc_main_0_emmcss_io_clk", 0, 0),
    CLK_FIXED_RATE("emmcsd4ss_main_0_emmcsdss_io_clk_o", 0, 0),
    + CLK_FIXED_RATE("spi_mcu_0_io_clkspio_clk", 0, 0),
    CLK_DIV_DEFFREQ("hsdiv4_16fft_main_1_hsdivout0_clk", "pllfrac2_ssmod_16fft_main_1_foutvcop_clk", 0x681080, 0, 7, 0, 192000000),
    CLK_DIV("hsdiv4_16fft_main_1_hsdivout2_clk", "pllfrac2_ssmod_16fft_main_1_foutvcop_clk", 0x681088, 0, 7, 0),
    CLK_DIV("hsdiv4_16fft_mcu_1_hsdivout1_clk", "pllfrac2_ssmod_16fft_mcu_1_foutvcop_clk", 0x40d01084, 0, 7, 0),
    @@ -771,12 +772,15 @@ static const struct dev_clk soc_dev_clk_data[] = {
    DEV_CLK(289, 17, "board_0_hfosc1_clk_out"),
    DEV_CLK(289, 18, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
    DEV_CLK(289, 19, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
    + DEV_CLK(157, 14, "spi_mcu_0_io_clkspio_clk"),
    + DEV_CLK(274, 0, "k3_pll_ctrl_wrap_wkup_0_chip_div1_clk_clk"),
    + DEV_CLK(274, 1, "hsdiv4_16fft_mcu_2_hsdivout0_clk"),
    };

    const struct ti_k3_clk_platdata j721e_clk_platdata = {
    .clk_list = clk_list,
    - .clk_list_cnt = 156,
    + .clk_list_cnt = 157,
    .soc_dev_clk_data = soc_dev_clk_data,
    - .soc_dev_clk_data_cnt = 171,
    + .soc_dev_clk_data_cnt = 174,
    };

    diff --git a/arch/arm/mach-k3/j721e/dev-data.c b/arch/arm/mach-k3/j721e/dev-data.c
    index 32a8aed55a..cadf17a6e4 100644
    --- a/arch/arm/mach-k3/j721e/dev-data.c
    +++ b/arch/arm/mach-k3/j721e/dev-data.c
    @@ -61,6 +61,7 @@ static struct ti_dev soc_dev_list[] = {
    PSC_DEV(103, &soc_lpsc_list[13]),
    PSC_DEV(104, &soc_lpsc_list[14]),
    PSC_DEV(102, &soc_lpsc_list[15]),
    + PSC_DEV(274, &soc_lpsc_list[11]),
    };

    const struct ti_k3_pd_platdata j721e_pd_platdata = {
    @@ -71,6 +72,6 @@ const struct ti_k3_pd_platdata j721e_pd_platdata = {
    .num_psc = 2,
    .num_pd = 5,
    .num_lpsc = 16,
    - .num_devs = 22,
    + .num_devs = 23,
    };

    diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
    index ae1fb94dd1..70a261f6a9 100644
    --- a/arch/arm/mach-k3/j721e_init.c
    +++ b/arch/arm/mach-k3/j721e_init.c
    @@ -218,7 +218,17 @@ void board_init_f(ulong dummy)

    /* Init DM early */
    spl_early_init();
    -
    + u32 debug;
    + debug = readl(0x40300000);
    + printf("\n");
    + ret = uclass_find_device_by_seq(UCLASS_SPI, 2, true, &dev);
    + if (ret)
    + panic("failed to find spi2!\n");
    + /*struct udevice *bus;
    + ret = uclass_get_device_by_seq(UCLASS_SPI, 2, &bus);
    + if (ret)
    + panic("failed to get spi2!\n");
    + */
    #ifdef CONFIG_K3_LOAD_SYSFW
    /*
    * Process pinctrl for the serial0 a.k.a. MCU_UART0 module and continue
    @@ -259,6 +269,7 @@ void board_init_f(ulong dummy)

    /* Prepare console output */
    preloader_console_init();
    + printf("xiuqi:0x%x\n", debug);

    /* Disable ROM configured firewalls right after loading sysfw */
    #ifdef CONFIG_TI_SECURE_DEVICE
    diff --git a/configs/pecu_r5_defconfig b/configs/pecu_r5_defconfig
    index 5c7fba370c..d45a740b06 100644
    --- a/configs/pecu_r5_defconfig
    +++ b/configs/pecu_r5_defconfig
    @@ -162,3 +162,4 @@ CONFIG_FS_EXT4=y
    CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
    CONFIG_LIB_RATIONAL=y
    CONFIG_SPL_LIB_RATIONAL=y
    +CONFIG_OMAP3_SPI=y

    I read the register after spl_early_init() and print it after preloader_console_init(),the serial port output is as follows

    But once I add uclass_get_device_by_seq after uclass_find_device_by_seq,spl will get stuck and there will no output from serial port

  • I believe you will need to add register write sequences to directly program the module. Are you trying to get the spi driver probe?

    Regards, 

    Keerthy