Linux 时钟架构 [英] Linux Clock Architecture

查看:32
本文介绍了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;
};

arch/arm/Board***/... 中的时钟架构有哪些不同的领域和广泛的应用?

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

推荐答案

通用 Linux 时钟基础结构记录在 clk.rst.对于 ARM,Sasha Hauer 最近(最近两年)创建了common clock 框架.时钟的结构是父/子关系.典型的 SOC(片上系统)具有由晶体创建的主时钟,这些时钟要么按比例缩小(用计数器)要么用 PLL 放大,也可能两者都有.它们的层次结构对于节能很重要.通常设备只使用树中最低/最年轻时钟之一.当设备请求时钟时,基础结构确保所有父设备都已启动.

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.

以前(旧版),时​​钟通过平台数据从机器文件(参考arch/arm/Board***/)传递到驱动程序/设备;最终通过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_idcon_id 是将设备的时钟与连接的时钟相关联(父母/孩子).通常dev_idcon_id 为NULL,因为只需要一个方面.我认为这种观点是缺乏的;特别是用于启动整个时钟链.因此,根据 Linux 版本,答案各不相同.即使在当前的源代码中,某些平台(如 orion)仍然使用较旧的机制.我不认为 orion 支持 设备树.

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 版本和所使用的机器(可能还有平台).
另见:clkdev.c, clk.c

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

开源 - 有很多变化.他们都有不同的计划.BSG 重新镜像

参考:Russell Kings 在 ARM clkdev 上的消息,原文不表示订购.

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆