AnsweredAssumed Answered

External clock that provide root clock for SAI3 and SPDIF modules freeze the system

Question asked by AURELIEN BOUIN on Jan 29, 2020
Latest reply on Feb 13, 2020 by Wolfgang Bär

Hi,
I am trying to use an external clock of 22579200 Hz on CLK_EXT3 Ball AG11 of an iMX8MM
This clock is supposed to provide the clock to SAI3 and SPDIF modules
Unfortunately the board freeze once it try to change the clock parent
This is pretty close to the thread : https://community.nxp.com/thread/496566

Here is my relevant dts declarations :

 

clocks {
    clk_ext3: clock@4 {
        compatible = "fixed-clock";
        reg = <5>;
        #clock-cells = <0>;
        clock-frequency = <22579200>;
        clock-output-names = "clk_ext3";
    };
};

    captina: captina {
        compatible = "cp,captina";
        #sound-dai-cells = <0>;/* simple-card needs */
        clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
        clock-names = "mclk";
    };

    sound-captina {
        compatible = "simple-audio-card";
        simple-audio-card,name = "captina Card";
        simple-audio-card,format = "i2s";
        simple-audio-card,bitclock-master = <&dailink0_master>;
        simple-audio-card,frame-master = <&dailink0_master>;
        /* Switch between Right and Left channels */
        simple-audio-card,frame-inversion;
        simple-audio-card,widgets =
            "Line", "Line Out Jack",
            "Line", "Line In Jack";
        simple-audio-card,routing =
            "Line Out Jack", "LOUT",
            "Line Out Jack", "ROUT",
            "LIN", "Line In Jack",
            "RIN", "Line In Jack";
        dailink0_master: simple-audio-card,cpu {
            sound-dai = <&sai3>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
        };
        simple-audio-card,codec {
            sound-dai = <&captina>;
            clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
            clock-names = "mclk";
        };
    };

    sound-spdif {
        compatible = "fsl,imx-audio-spdif";
        model = "imx-spdif";
        spdif-controller = <&spdif1>;
        spdif-out;
        spdif-in;
    };


pinctrl_sai3: sai3grp {
    fsl,pins = <
        MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC     0xd6
        MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0     0xd6
        MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK      0xd6
         /* RXFS have to be tri state since TXFS also play on the same wire */
        MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28       0x19
        MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0     0xd6
        MX8MM_IOMUXC_SAI3_RXC_SAI3_RX_BCLK      0xd6
        /* MCLK input from oscillator */
        MX8MM_IOMUXC_GPIO1_IO06_CCMSRCGPCMIX_EXT_CLK3   0x00000011
    >;
};

&sai3 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    #sound-dai-cells = <0>;/* simple-card needs */
    assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
    assigned-clock-parents = <&clk IMX8MM_CLK_EXT3>;
    assigned-clock-rates = <22579200>;
    status = "okay";
};

&spdif1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_spdif1>;
    assigned-clocks = <&clk IMX8MM_CLK_SPDIF1>;
    assigned-clock-parents = <&clk IMX8MM_CLK_EXT3>;
    assigned-clock-rates = <22579200>;
    clocks = <&clk IMX8MM_CLK_AUDIO_AHB>, <&clk IMX8MM_CLK_24M>,
        <&clk IMX8MM_CLK_SPDIF1>, <&clk IMX8MM_CLK_DUMMY>,
        <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>,
        <&clk IMX8MM_CLK_AUDIO_AHB>, <&clk IMX8MM_CLK_DUMMY>,
        <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>,
        <&clk IMX8MM_AUDIO_PLL1_OUT>, <&clk IMX8MM_AUDIO_PLL2_OUT>;
    clock-names = "core", "rxtx0", "rxtx1", "rxtx2", "rxtx3",
        "rxtx4", "rxtx5", "rxtx6", "rxtx7", "spba", "pll8k", "pll11k";
    status = "okay";
};

when sai3 and spdif have their assigned-clock-parents like this :

assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL2_OUT>;

The system doesn't freeze, but they are not sync on clk_ext3

 

Thank you by advance if you have any reference, any hints, any help, anything

 

Regards
Aurelien BOUIN

Outcomes