Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
468 views
in Technique[技术] by (71.8m points)

arm - Linux Clock Architecture

In Linux how is the Clock Architecture implemented. There is a file include/linux/clkdev.h

struct clk_lookup {
    struct list_head    node;
    const char      *dev_id;
    const char      *con_id;
    struct clk      *clk;
};

What are the various fields and it is extensively used in Clock architecture in arch/arm/Board***/... ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The generic Linux clock infra-structure is documented in clk.rst. For the ARM, Sasha Hauer created the common clock frame-work recently (last two years). The clocks are structured in a parent/child relation. Typical SOC (system on chip) has main clocks created from a crystal which are either scaled down (with a counter) or up with a PLL and maybe both. They hierarchy is important for power savings. Usually devices are only using one of the lowest/youngest clocks in the tree. When a device requests a clock, the infra-structure ensures that all parents are started.

Previously (legacy), clocks were passed from the machine file (reference arch/arm/Board***/) to the driver/device via platform data; ultimately through platform_device_register(). Sometimes, the clocks were/are derived from the device name. For example the fec driver might use fec-clk. This did not work well for multiple machine configurations, so the platform data mechanism was introduced. Even newer machinery uses a dt (or device table). Here, there are no machine files, only a device table that is passed from the boot loader to the kernel. In this case, the dt tells the driver which clock to use.

Originally, the dev_id and con_id were to relate clocks for a device and clocks that are connected (parent/child). Usually either dev_id or con_id are NULL as only one aspect is needed. I think that this view was found wanting; especially for starting an entire clock chain. So, depending on the Linux version, the answer varies. Even in the current source, some platforms (like orion) still use an older mechanism. I don't think orion supports device trees.

Specific answers will depend on your Linux version and the machine (and possibly platform) in use.
See also: clkdev.c, clk.c

Open source - There are many mutations. They all have a different plan.BSG re-imaged

Reference: Russell Kings message on ARM clkdev, original did not imply ordering.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...