AnsweredAssumed Answered

change imx6ul mclk rate to 48Mhz

Question asked by Ed Nash on Jun 7, 2017
Latest reply on Jul 7, 2017 by tom fang

I need to change the CSI mclk output to 48MHz (reference clock required by imager).


I have tried changing the device tree and driver code:


 mclk = <48000000>; mclk_source = <0>; // must be 0 for imx6ul

ret = of_property_read_u32(dev->of_node, "mclk", &xxx_data.mclk);

if (ret) {

   dev_err(dev, "mclk frequency is invalid\n");

   return ret;


ret = of_property_read_u32(dev->of_node, "mclk_source", (u32 *) &(xxx_data.mclk_source));

if (ret) {

   dev_err(dev, "mclk_source invalid\n");

   return ret;


ret = clk_set_rate(xxx_data.sensor_clk, xxx_data.mclk);

if (ret < 0) {

   dev_err(dev, "set rate failed, rate=%d\n", xxx_data.mclk);

   return ret;


dev_info(dev, "mclk: %lu\n", clk_get_rate(xxx.sensor_clk));  <<<<<<< always prints 24000000


I have tried changing this in clk-imx6ul.c


   clk_set_rate(clks[IMX6UL_CLK_CSI], 24000000); to  clk_set_rate(clks[IMX6UL_CLK_CSI], 48000000);


But I still get 24000000.


If I comment out the line above, I get 12000000.


How do I get an output of 48000000 on MX6UL_PAD_CSI_MCLK__CSI_MCLK ?


Thanks in advance.