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.

How to change the DSP clock in TI816x

Hi,

Does anyone knows how to change the DSP clock in TI816x?
Can it be done on run time?

Thanks,
Gabi 

  • Hi Gabi,

    We can chagne the DSP frequency in u-boot (code), in kernel we have a provision to change the DSP clock rate runtime.

    Details can get from http://processors.wiki.ti.com/index.php?title=TI81XX_PSP_PM_Clock_Framework_User_Guide

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil, 

    Thank you very much for your answer, i have read the wiki you have sent me carefully, i have a few questions, where exactly is the file that i need to modify in order to change the DSP frequency? since i couldn't find it at the wiki, it is explained only how to do it.
    Which device_id should i use for changing the DSP clock frequency?

    Thanks,
    Gabi 

  • Hi Gabi,

    Generally frequency modification required for a module, so we can add it in driver or driver initialization code. In case of DSP you can add to "ti8168_evm_init()" in arch/arm/mach-omap2/board-ti8168evm.c file. Refer the same document for adding the necessary clk APIs.

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    Thank you very much for your answer, now i know that i have to add the code 

    clk = clk_get(dev_id,clk_name);
    rate = clk_get_rate(clk);
    ret = clk_set_rate(clk, new_clk_rate);
    
    
    in the function "ti8168_evm_init()" in the file arch/arm/mach-omap2/board-ti8168evm.c
    but i still don't know what are the values for dev_id and clk_name that i need to put in order to change the DSP clock rate, can you please help with that?
    
    
    Thanks,
    Gabi 



  • Hi Gabi,

    Steps for change the DSP frequency.

    clk = clk_get(NULL, "gem_ick");
    rate = clk_get_rate(clk);
    ret = clk_set_rate(clk, new_clk_rate);

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

     
     
  • Hi Anil,

    I have changed the fuction "ti8168_evm_init()" as listed below, recompiled the kernel and checked and there is no change in DSP clock rate, please advice.

    static void __init ti8168_evm_init(void)
    {

    struct clk *clk;
    unsigned long rate;

    ti81xx_mux_init(board_mux);
    omap_serial_init();
    ti816x_evm_i2c_init();
    i2c_add_driver(&ti816xevm_cpld_driver);
    ti81xx_register_mcasp(0, &ti8168_evm_snd_data);
    ti816x_spi_init();
    /* initialize usb */
    usb_musb_init(&musb_board_data);
    board_nand_init(ti816x_nand_partitions,
    ARRAY_SIZE(ti816x_nand_partitions), 0, NAND_BUSWIDTH_16);
    omap2_hsmmc_init(mmc);
    board_nor_init(ti816x_evm_norflash_partitions,
    ARRAY_SIZE(ti816x_evm_norflash_partitions), 0);
    ti816x_vpss_init();
    ti816x_gpio_vr_init();
    ti816x_hdmi_init();
    regulator_has_full_constraints();
    regulator_use_dummy_regulator();

    // change DSP clock rate
    clk = clk_get(NULL, "gem_ick");
    rate = clk_get_rate(clk);
    ret = clk_set_rate(clk, 990000000);

    }

    Thanks,
    Gabi 

  • Hi Gabi,

    What is the error message you are seeing?

    Lookat "dmesg"

    $ dmesg | tail

    Regards

    AnilKumar

  • Hi Anil,

    Thanks for your reply, there is no error in the dmesg, i have looked on all of it.
    It is just that the DSP performances stay the same so i guess that there is no change in the DSP clock.

    Thanks,
    Gabi 

  • Hi Anil,

    Can you please refer?

    Thanks,
    Gabi 

  • Hi Gabi,

    Sorry for delay in response

    Can you add clk_enable(); before clk_set_rate(), so that you can able to change the rate. Wiki page will be updated with a note.

    // change DSP clock rate
    clk = clk_get(NULL, "gem_ick");
    clk_enable(clk);
    rate = clk_get_rate(clk);
    ret = clk_set_rate(clk, 990000000);

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    It didn't help, DSP clock doesn't change.

    Gabi

  • Hi Gabi,

    Which kernel version are you using? I tried with the latest one and its worked for me, I am able to change the rate.

    If you are on the old kernel, can you change it to new one

    http://software-dl.ti.com/dsps/dsps_public_sw/psp/LinuxPSP/TI81XX_04_04/04_04_00_01/index_FDS.html

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    I have linux-2.6.37-psp04.00.01.13.patch2, shouldn't it work on this version as well?

    Gabi

  • Hi Gabi,

    I had tested recently, that is the reason why I asked you to test on the same.

    If you don't have any other dependencies can you try with recent kernel, mean while I will check with "psp04.00.01.13.patch2" also

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    Thank you very much for your effort, i am sorry but i have other dependencies, therefore it is impossible for me to update the kernel.

    Gabi 

  • Hi Gabi,

    I have checked, its working, can you follow these steps?

    // change DSP clock rate
    rrate = 990000000;
    clk = clk_get(NULL, "gem_ick");
    ret = clk_set_rate(clk, rrate);
    if (ret)
    pr_err("Failed to set the requested rate %lu and dsp running at %lu", rrate, clk_get_rate(clk));

    Recent kernel versions clk_enable(clk); is required to change the rate, and not required in your case.

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Anil said:
    We can chagne the DSP frequency in u-boot (code),

    How is the DSP clock set in u-boot?  The referenced document says nothing about this.

    By the way, I have located the clock settings in u-boot for the ARM.

    Lee

     

  • Hi Lee,

    Better go throgh the TRM of DM8168 for pll configuration. section "1.10.3 Flying Adder PLL"

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Lee,

    MAIN_*1 (u-boot, evm.c, main_pll_init_ti816x) macros are coresponding to DSP clock out rate values, change to required values. Make sure that you are not exceeding the limits.

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

     

  • Hi Anil,

    Anil said:
    // change DSP clock rate
    rrate = 990000000;
    clk = clk_get(NULL, "gem_ick");
    ret = clk_set_rate(clk, rrate);
    if (ret)
    pr_err("Failed to set the requested rate %lu and dsp running at %lu", rrate, clk_get_rate(clk));

    I have done what you have written above, i saw no error, but the clock frequency doesn't change, i am working with an OMX application could it be that some where else the clock frequency is set back to 800MHz?

    Thanks,
    Gabi 

  • Hi Gabi,

    I am not aware of OMX application, Can you print the rate after setting to new value? We can conclude at this position setrate on your setup is working/not.

    Another option is you can write some kernel module application, after kernel boots up you can control the clock rate using some sysfs/debugfs entries.

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!