3

I was trying to configure the clock for a new device included to the Kernel. I have an older version of the Kernel, in which the device already included.

So I tried to make similar changes to the Kernel for the clock. But in the older version of the Kernel there was a C file for configuring the clock for almost all Devices, but I couldn't find any similar file in the newer Kernel.

After my investigation I found that, in newer versions of the Kernel the parameters for configuring the clocks are passed to the Kernel through the Device Tree. So I tried to change the DT to include the clock for new device , but I couldn't succeed completely. So my questions are:

1)How the Kernel get parameters and register addresses for configuring the clock for a particular device

2)Can we access this information(like register adders ) in Kernel or Driver?

3)Is there any other way , that we can use the registers directly in the driver or Kernel to set the clock (like frequency )

Vineesh Vijayan
  • 313
  • 1
  • 5
  • 13
  • Please specify the device and driver you use. Some devices can have the frequency handed to the with _clock-frequency_ parameter, for others you will need to define a clock. – moorray Apr 09 '15 at 13:56

1 Answers1

1

In device tree file you can specify the clock frequency of a device. For example consider a device tree where serial port (UART) clock-frequency is set as "clock-frequency = <3686400>;". As far as next part of your question is concerned that how the Kernel get parameters, it is as easy for a driver to use api "of_get_property" to get any data out of device tree. As an example see legacy_serial.c file, also take a look at "Documentation/devicetree/bindings/serial" for above example.

Vijay Katoch
  • 548
  • 1
  • 6
  • 14
  • thanks for your answer,I set the clock-frequency in DT as above, but it didn't work properly, some other frequency i got in the driver.Can we access the clock configuring registers and change the clock frequency in the driver? – Vineesh Vijayan Dec 03 '14 at 04:06
  • 1
    Take a look at "Documentation/clk.txt". This will help you to understand how of_serial driver at /drivers/tty/serial is making use of clock-frequency property in device tree. – Vijay Katoch Dec 03 '14 at 06:55