本文介绍了Linux的时钟结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux下如何是时钟架构来实现。
有一个文件在include / linux / clkdev.h

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;
};

什么是各个领域,它是在弓/ ARM /板时钟架构广泛使用*** / ...

推荐答案

通用Linux时钟基础结构中的。对于ARM,萨沙豪尔创造最近(过去两年)的的公共时钟的框架工作。该时钟在的父/子的关系结构。典型的SOC(片上系统)具有从要么缩小(带计数器)晶体创建主时钟或与一个PLL,也许两者兼而有之。这些层次是节省功耗很重要。通常的设备只使用的最低/最小的树时钟之一。当一个设备请求一个时钟,基础结构,确保所有的家长都开始了。

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(传统),时钟是从的机文件通过的(参考弓/ ARM /板*** / )通过平台数据驱动器/设备;最终通过 platform_device_register()。有时,时钟均/从设备名称派生而来。例如, FEC 的驱动程序可能使用的 FEC-CLK 的。这并没有对多机配置运作良好,因此引入平台数据机制。即使是较新的机器使用的 DT (或设备表)。在这里,没有机文件,只有从引导装载程序传递到内核的设备表。在这种情况下,在 DT 告诉使用哪个时钟驱动。

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.

本来,的dev_id CON_ID 是要涉及时钟为设备并时钟是的连接(父/子)。通常是的dev_id CON_ID 因为只需要一个方面是NULL。我认为这种观点是发现自己的不足;特别是对于启动整个时钟链。因此,根据Linux版本,答案而变化。即使在电流源,一些平台(如猎户座)仍然使用旧的机制。我不认为猎户座支持

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.

具体的答案将取决于你的Linux版本和机器(也可能是平台)
参见:的,的

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

开源 - 有许多突变。他们都有不同的计划。

参考:ARM的clkdev 罗素国王消息,原来并不意味着排序。

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

这篇关于Linux的时钟结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!