4.2.2. CMU配置

4.2.2.1. 内核配置

4.2.2.1.1. clock驱动使能

Device Drivers
    Common Clock Framework--->
        [*] Clock driver for ZX SoC

4.2.2.1.2. reset驱动使能

Device Drivers
    Reset Controller Support--->
        [*] ZX Reset Driver

4.2.2.2. DTS配置

4.2.2.2.1. clock DTS配置

cmu: clock@18020000 {
        compatible = "zx,aic-cmu-v1.0";
        reg = <0x18020000 0x1000>;
        clocks = <&osc24m>, <&rc1m>, <&osc32k>;
        clock-names = "osc24m", "rc1m", "osc32k";
        #clock-cells = <1>;
        status = "okay";
};

4.2.2.2.2. reset DTS配置

rst: reset@18020000 {
        compatible = "zx,aic-reset-v1.0";
        reg = <0x18020000 0x1000>;
        #reset-cells = <1>;
        status = "okay";
};

4.2.2.2.3. 模块时钟DTS配置

各个模块的时钟和复位信号由CMU模块控制,所以各个模块需要引用各自相应的时钟和复位信号。以CIR为例说明:

cir: cir@19260000 {
        compatible = "zx,aic-cir";
        reg = <0x19260000 0x400>;
        interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cmu CLK_CIR>;
        resets = <&rst RESET_CIR>;
};

通过clocks属性引用CIR模块的时钟,通过resets属性引用CIR模块的复位信号。

如果模块需要两个时钟,则需要分别引用这两个时钟信号。如下图所示:

rgb0: rgb@18800000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "zx,aic-rgb-v1.0";
        reg = <0x18800000 0x1000>;
        clocks = <&cmu CLK_RGB>, <&cmu CLK_SCLK>;
        clock-names = "rgb0", "sclk";
        resets = <&rst RESET_RGB>;
        reset-names = "rgb0";
};

可以通过clock-names属性为模块所引用的时钟命名。在查找时钟时,可以直接通过时钟名字进行查找。