Hi @edwardtyrrell
Thank you so much for your response.
1) dts changes:
sai1_mclk: fixed-24576 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24576000>;
clock-accuracy = <20000>;
};
&sai1 {
pinctrl-names = "default", "dsd";
pinctrl-0 = <&pinctrl_sai1>;
pinctrl-1 = <&pinctrl_sai1_dsd>;
clocks = <&clk IMX8MM_CLK_SAI1_IPG>,
// MCLK1 is switched to SAI1.MCLK in the IOMUXC_GPR_GPR6 register in uboot code
<&sai1_mclk>,
<&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>,<&clk IMX8MM_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
status = "okay";
};
this is our customized codec and machine driver
audiofpga: audiofpga-titan-cpucodec {
compatible = "fsl,audiofpga-titan-cpucard";
pinctrl-names = "default";
//clocks = <&clk IMX8MM_CLK_SAI1_ROOT>;
clocks = <&sai1_mclk>;
clock-names = "mclk";
status = "okay";
};
sound-audiofpga {
compatible = "fsl,imx-audio-audiofpga-titan-cpucard";
model = "audiofpga-titan-cpucard-audio";
audio-cpu = <&sai1>;
audio-codec = <&audiofpga>;
};
2) I tried adding code changes in the uboot by making changes in ("board/freescale/imx8mm_val/imx8mm_val.c)
static int setup_sai1_mclk(void)
{
struct iomuxc_gpr_base_regs *gpr =
(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
// GPR2
// GPR_SAI1_EXT_MCLK_EN = 1
setbits_le32(&gpr->gpr[2], 1);
// GPR_SAI1_SEL1 = 1
setbits_le32(&gpr->gpr[6], (1 << 5));
return 0;
}
int board_init(void)
{
setup_sai1_mclk();
}
Now if I read the memory as below
root@device-000000[~]# devmem 0x30340008
0x00000001
root@device-000000[~]# devmem 0x30340018
0x00000020
as per result the GPR_SAI1_EXT_MCLK_EN is set correctly however GPR_SAI1_SEL1 not set with correct values.
here is the clock summery:
root@device-000000[~]# cat /sys/kernel/debug/clk/clk_summary | grep sai1
157: sai1_src 0 0 24000000 0 0
158: sai1_cg 0 0 24000000 0 0
159: sai1_pre_div 0 0 24000000 0 0
160: sai1_div 0 0 24000000 0 0
161: sai1_root_clk 0 0 24000000 0 0
309: sai1_ipg_clk 0 1 400000000
2) if I set these fields from the uboot terminal as you mentioned in your recent post
mw.l 0x30340008 0x00000001
mw.l 0x30340018 0x00100000
then both GPR2 and GPR6 register values are correct, however there is no change is clk_summary of sai1, if you see below:
root@device-000000[~]# devmem 0x30340008
0x00000001
root@device-000000[~]# devmem 0x30340018
0x00100000
root@device-000000[~]# cat /sys/kernel/debug/clk/clk_summary | grep sai1
157: sai1_src 0 0 24000000 0 0
158: sai1_cg 0 0 24000000 0 0
159: sai1_pre_div 0 0 24000000 0 0
160: sai1_div 0 0 24000000 0 0
161: sai1_root_clk 0 0 24000000 0 0
309: sai1_ipg_clk 0 1 400000000
root@device-000000[~]#
So, I wanted to know
a) are my uboot changes are not kept at correct place e.g: board/freescale/imx8mm_val/imx8mm_val.c ?
b) what is the expected result in cat /sys/kernel/debug/clk/clk_summary | grep sai1 ?
c) how to do you check if MCLK pin configured correctly as input in the actual imx8mm device?
Am I missing something here?
Thank you so much again, your input is really helpful.
Regards,
Sanjeev