0

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?

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

Hello World for Common Clock Framework on Raspberry PI

Community
  • 1
  • 1
David Cater
  • 415
  • 3
  • 15

1 Answers1

1

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
Krzysztof Adamski
  • 2,039
  • 11
  • 14
  • I did use bcm2709_defconfig, but COMMON_CLK was set to n, not y. FWIW, I am cross-compiling from Ubuntu and I used this line to create the .config: `make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig`. It makes sense that I wouldn't be able to select COMMON_CLK directly, but I'm confused as to why the "Common Clock Framework" option under Device Drivers isn't present. – David Cater Aug 10 '16 at 20:32
  • Ah, wait. I see. I can't just use `make menuconfig`, I need to do `make ARCH=arm menuconfig`. That makes sense. – David Cater Aug 10 '16 at 20:35
  • Confirmed! Once I switched to `make ARCH=arm menuconfig`, I was able to see Device Drivers > Common Clock Framework as expected. And the COMMON_CLK info looks correct now. Thanks so much! – David Cater Aug 10 '16 at 20:46