Linux Clock Architecture

a 夏天 提交于 2019-11-29 07:39:02

The generic Linux clock infra-structure is documented in clk.txt. 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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!