cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
516 Views
Registered: ‎01-31-2018

How to disable/enable FCLK

Jump to solution

Hi, I'm looking at disabling FCLKs for power savings.  

I'm using petalinux 2015.4 for the boot and kernel images. My linux version is:

root@Xilinx-ZC706-2015_4:~# uname -a
Linux Xilinx-ZC706-2015_4 4.4.0-ge42619c-dirty #2 SMP PREEMPT Sat May 16 13:26:33 SGT 2020 armv7l GNU/Linux

We found out that changing the FCLK frequencies (set_rate) from high to low gave us a lower current drawn, which is translated to lower power. This is a correct observation. 

However, disabling and enabling FCLK has no impact on the current/power drawn. May I know why? Does enable = 0 disables the FCLK as stated in the wiki link https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841795/Controlling+FCLKs+in+Linux? For example, the current drawn is the same with { enable = 1, set_rate = 50Mhz } and {enable = 0, set_rate = 50Mhz }. Is this correct? 

root@Xilinx-ZC706-2015_4:/sys/devices/soc0/amba/f8007000.devcfg/fclk/fclk0# grep "" *
enable:1       
round_rate:0 => 251953
set_rate:50000000

Hope to hear from you soon.

Thanks. 

 

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
289 Views
Registered: ‎04-02-2014

Re: How to disable/enable FCLK

Jump to solution

If you are good at building Linux Device Driver and Device Tree (Overlay), try fclkcfg.

https://github.com/ikwzm/fclkcfg

fclkcfg is a Linux Device Driver that I made.
fclkcfg can turn the clock output on and off.
fclkcfg safely changes the frequency.

View solution in original post

11 Replies
Highlighted
Moderator
Moderator
509 Views
Registered: ‎09-12-2007

Re: How to disable/enable FCLK

Jump to solution

The CCF disables unused clocks by default unless used in your driver in later releases. Im not sure about 2015.4.

You can also disable this in device tree

0 Kudos
Highlighted
Participant
Participant
495 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

 

"cpu_ignore_unused" is already in the bootargs of my device tree. Is this what you mean? 

chosen {

bootargs = "clk_ignore_unused console=ttyPS0,115200 earlyprintk";
};

For a given clk frequency (set_rate), setting the enable=0 or enable=1 has no impact on the current drawn. 

root@Xilinx-ZC706-2015_4:/sys/devices/soc0/amba/f8007000.devcfg/fclk/fclk0/power# grep "" *
async:disabled
control:auto
runtime_active_kids:0
runtime_active_time:0
runtime_enabled:disabled
runtime_status:unsupported
runtime_suspended_time:0
runtime_usage:0

Runtime PM is not enabled for this device. 

0 Kudos
Highlighted
Moderator
Moderator
493 Views
Registered: ‎09-12-2007

Re: How to disable/enable FCLK

Jump to solution

if you want the clocks to be disabled by default, then you should remove this bootarg. Then you can enable the clocks in your device driver

0 Kudos
Highlighted
Participant
Participant
490 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

 

We tried with both versions, with cpu_ignore_unused and without. The result is the same. 

0 Kudos
Highlighted
Moderator
Moderator
479 Views
Registered: ‎09-12-2007

Re: How to disable/enable FCLK

Jump to solution

Are these enabled or disabled in the DT? in the *_ccf.dtsi

0 Kudos
Highlighted
Participant
Participant
475 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

 

Thanks for getting back. Really appreciate it. 

I'm not quite sure if you are referring to the below in zynq7000.dtsi. I didn't put set the status as disabled or okay. Will it have any impact? 

devcfg: devcfg@f8007000 {
clock-names = "ref_clk", "fclk0", "fclk1", "fclk2", "fclk3";
clocks = <&clkc 12>, <&clkc 15>, <&clkc 16>, <&clkc 17>, <&clkc 18>;
compatible = "xlnx,zynq-devcfg-1.0";
interrupt-parent = <&intc>;
interrupts = <0 8 4>;
reg = <0xf8007000 0x100>;
syscon = <&slcr>;
};

0 Kudos
Highlighted
Moderator
Moderator
460 Views
Registered: ‎09-12-2007

Re: How to disable/enable FCLK

Jump to solution

Can you share your HDF?

 

Can you try something like:

&clkc {
fclk-enable = <0x0>;
};

0 Kudos
Highlighted
Participant
Participant
458 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

 

Sure. I'm using the reference design from Xilinx with no changes - hdl_2016_r1_hdf. I can't seems to upload the file. We are evaluating the power management feature for zynq7000 devices. 

Ok, let me try the below and I will update. Currently, it is set as fclk-enable=<0xf>; But will this setting make it permanently disabled? I want to have the option of being able to enable and disable it.  

&clkc {
fclk-enable = <0x0>;
};

0 Kudos
Highlighted
Participant
Participant
425 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

Setting the fclk-enable=0x0 do not register a different current/power when enable=0 or 1. 

root@Xilinx-ZC706-2015_4:/sys/kernel/debug/clk/fclk0# grep "" *
clk_accuracy:0
clk_enable_count:2
clk_flags:0x00000024
clk_notifier_count:0
clk_phase:0
clk_prepare_count:3
clk_rate:50000000

the clk_enable_count start from 3 and i cannot reduce to 0. it will stay at 2. is that the reason why the clock cannot be disabled?  

0 Kudos
Highlighted
Contributor
Contributor
290 Views
Registered: ‎04-02-2014

Re: How to disable/enable FCLK

Jump to solution

If you are good at building Linux Device Driver and Device Tree (Overlay), try fclkcfg.

https://github.com/ikwzm/fclkcfg

fclkcfg is a Linux Device Driver that I made.
fclkcfg can turn the clock output on and off.
fclkcfg safely changes the frequency.

View solution in original post

Highlighted
Participant
Participant
242 Views
Registered: ‎01-31-2018

Re: How to disable/enable FCLK

Jump to solution

Thanks! The value of clk_enable_count = 0 now when i disable FCLK0. 

root@Xilinx-ZC706-2015_4:/sys/kernel/debug/clk/fclk0# grep "" *
clk_accuracy:0
clk_enable_count:0
clk_flags:0x00000024
clk_notifier_count:0
clk_phase:0
clk_prepare_count:0
clk_rate:99999999

 

0 Kudos