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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…