David Cater David Cater - 1 year ago 157
Linux Question

Is the Common Clock Framework supported on Raspbian?

I am trying to create a common clock framework device driver. My test environment is a Raspberry Pi 3 hooked up to an eval board with the clock chip on it (via I2C). Right now I am just trying to understand the device tree and figure out how to modify it to include an existing clock's driver (even if that clock isn't actually connected). In particular, I plan on just adding a Si570 chip to the device tree and see if I can watch the log to see if it is loaded properly on boot (from drivers/clk/clk-si570.c).

I have successfully built a new Raspbian kernel and deployed it (4.4.16-v7). (I'm very, very new to this, btw. This is my first time compiling the kernel). Now I'm trying to use "make menuconfig" to enable the common clock framework, but I don't see the option.

From looking online, it appears the CCF is supported on Raspbian. I'm not positive, though. I used / to search for COMMON_CLK in menuconfig. It has a "selected by" line, not Depends On. That line is too long to fit on the screen, so it gets cut off. It has clauses like "X86_INTEL_QUARK [=n] && X86_32 [=n] && X86_EXTENDED_PLATFORM [=y] && X86_PLATFORM_DEVICES [=y]..." Since I'm on PI/ARM, I'm not sure exactly how to interpret that line.

Also, it appears that the .config file for the Raspbian kernel build doesn't even have CONFIG_COMMON_CLK=n in it; COMMON_CLK doesn't appear anywhere in the file.

So I really have two questions:

  1. Is the CCF supported on Raspbian at all?

  2. What other techniques can I use to figure out why Drivers > Common Clock Framework isn't showing up in menuconfig?

The common clock framework does work on the Raspberry Pi. See my other post here:

Hello World for Common Clock Framework on Raspberry PI

Answer Source

The answer

First of all, using make menuconfig is quite good idea. Don't worry that the line is too long - just use right arrow on your keyboard to scroll right. You don't really need that, though, since the most important line is this:

Symbol: COMMON_CLK [=y]

If it says "=y" then it is on. If you used bcm2709_defconfig (which you should for RaspberryPi 3), then this option is set to y by default.

Some more details

Depends On vs Selected by

You're confusing those two. Depends on, as the name suggest, describes dependency for this option. This means that all of those dependencies must be met, otherwise this option cannot be set at all. COMMON_CLK does not have any dependencies.

Selected by, on the other hand, means that this option will be automatically selected if the condition is met. In case of COMMON_CLK, the condition is quite complex but it is composed with a lot of ORed expressions. We just have to find which expression is of interest for us. You go from left to right and soon you will find:

ARCH_BCM2709 [=y] && <choice>

(and similar ARCH_BCM2708 variant for RPi0/1). So this means that our option will be automatically selected if ARCH_BCM2709 is set (the =y indicated that it indeed is). There is this strange && <choice> here which is actually an artifact caused by the fact that ARCH_BCM2709 is inside of a unnamed choice block, meaning that only one architecture can be selected.

Why can't common clock be found in menuconfig

Not all options are visible in menuconfig (or any other "gui" for kernel configuration). One reason why an option may not be visible is that its dependencies are not met. Another one, and this is the case for COMMON_CLK is that the option is not designed to be user selectible so it does not have a "prompt value". In this case, the option can only be selected if "Selected by:" expression is met.

X86_INTEL_QUARK confusion

The "Selected by" line you've pasted here suggest that you're not using you "make menuconfig" properly. Since you are trying to configure and build the kernel for non-default architecture (which is X86), you should use ARCH=arm to indicate that. Just run in this way:

make ARCH=arm menuconfig
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download