<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: iMX8M Mini: How to use MCLK pad as master clock input?</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802066#M219667</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/205278"&gt;@iicsanjeev01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Yes I did in the end, but it's been a while.&lt;/P&gt;&lt;P&gt;Two IOMUX GRP registers need setting in uboot or early on to use the MCLK pin as an input. Also the SAI MCLK Control Register (MCR)&amp;nbsp;needs to be told to set the MCLK as an input [look in fsl_sai.c].&lt;/P&gt;&lt;P&gt;Try in UBoot:&lt;/P&gt;&lt;P&gt;set GPR_SAI1_EXT_MCLK_EN of the IOMUXC_GPR_GPR2 and&lt;BR /&gt;Set bit 5 of register IOMUXC_GPR_GPR6 (GPR_SAI1_SEL1) to 1 (SAI1_MCLK)&lt;/P&gt;&lt;P&gt;mw.l 0x30340008 0x00000001&lt;BR /&gt;mw.l 0x30340018 0x00100000&lt;/P&gt;&lt;P&gt;----------------&lt;/P&gt;&lt;P&gt;If your trying to achieve every audio rate (44100, 48000 -&amp;gt; 352K8, 384K) like I was, then you will also need to add some code into the driver to switch between your two MCLK frequencies. You might have to do a few 'work-arounds' if your I2S card is derived off the&amp;nbsp;simple-audio-card like a lot are. Problem is the driver only receives one value for MCLK and everything is divided off that, so when you switch the physical MCLK frequency (to the other) the driver doesn't actually know, so a little 'tweaking' might be necessary. You can worry about all this though once you have got the MCLK working as an input.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The docs are not the easiest to follow when it comes to SAI clocking and tend to change the names in different chapters! One thing though, the SAI still needs a clock or two for internal use, but&amp;nbsp; - what I'll term as the 'final I2S output register' which clocks the I2S pins - is what the MCLK input is connected too (if that makes sense).&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't forget to modify the SAI your device tree.&lt;/P&gt;&lt;P&gt;Useful&amp;nbsp; -&amp;gt;&amp;nbsp; cat /sys/kernel/debug/clk/clk_summary | grep sai1&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 17:32:50 GMT</pubDate>
    <dc:creator>edwardtyrrell</dc:creator>
    <dc:date>2024-02-05T17:32:50Z</dc:date>
    <item>
      <title>iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1464610#M190859</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to use iMX8M Mini SAI1 to output i2s audio to codec. In order to minimize master clock jitter, I want to use an external high quality oscillator to provide master clock to both iMX8 processor and external DAC chip.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the iMX8M Mini Reference manual, it says that the SAI1_MCLK pin can either be configured as input or output. So, what exactly in the device tree (or what registers) do I have to write in order to configure this pin as input?&lt;/P&gt;&lt;P&gt;So far I have done the following:&lt;/P&gt;&lt;P&gt;1. Set bit 5 of register&amp;nbsp;&lt;SPAN&gt;IOMUXC_GPR_GPR6 (&lt;/SPAN&gt;&lt;SPAN&gt;GPR_SAI1_SEL1&lt;/SPAN&gt;&lt;SPAN&gt;) to 1 (SAI1_MCLK) in u-boot code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Removed the "fsl,sai-mclk-direction-output" property in sai1 device tree&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Created a fixed-clock node in the device tree, and set the mclk1 clock of sai1 to be that clock.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;	i2s_mclk: fixed-24576 {
		compatible = "fixed-clock";
		#clock-cells = &amp;lt;0&amp;gt;;
		clock-frequency = &amp;lt;24576000&amp;gt;;
		clock-accuracy = &amp;lt;20000&amp;gt;;
	};

&amp;amp;sai1 {
	pinctrl-names = "default";
	pinctrl-0 = &amp;lt;&amp;amp;pinctrl_sai1&amp;gt;;
	status = "okay";
	fsl,sai-synchronous-rx;
	clocks = &amp;lt;&amp;amp;clk IMX8MM_CLK_SAI1_IPG&amp;gt;,
			// MCLK1 is switched to SAI1.MCLK in the IOMUXC_GPR_GPR6 register in uboot code
			&amp;lt;&amp;amp;i2s_mclk&amp;gt;, 
			&amp;lt;&amp;amp;clk IMX8MM_CLK_DUMMY&amp;gt;, &amp;lt;&amp;amp;clk IMX8MM_CLK_DUMMY&amp;gt;;
	clock-names = "bus", "mclk1", "mclk2", "mclk3";
	fsl,sai-multi-lane;
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that the sai1_mclk pad is still an output pad, not accepting my external input.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 08:55:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1464610#M190859</guid>
      <dc:creator>smartdev</dc:creator>
      <dc:date>2022-05-26T08:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1464879#M190874</link>
      <description>&lt;P&gt;I debugged for a whole day, it turns out that we need to set bit &lt;SPAN&gt;GPR_SAI1_EXT_MCLK_EN&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;of the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;IOMUXC_GPR_GPR2 register to 1. This register have no description in the reference manual (see screenshot below), but an excel file of iMX8MQ can be found online to describe this register. I hope that you can add a description to the reference manual to avoid confusion.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="截屏2022-05-26 22.26.53.png" style="width: 484px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/181254i5637295867A49A0E/image-dimensions/484x256?v=v2" width="484" height="256" role="button" title="截屏2022-05-26 22.26.53.png" alt="截屏2022-05-26 22.26.53.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="截屏2022-05-26 22.27.50.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/181255iB1FEAB54B1183D9D/image-size/large?v=v2&amp;amp;px=999" role="button" title="截屏2022-05-26 22.27.50.png" alt="截屏2022-05-26 22.27.50.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:35:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1464879#M190874</guid>
      <dc:creator>smartdev</dc:creator>
      <dc:date>2022-05-26T14:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1529362#M195727</link>
      <description>&lt;P&gt;Hi smartdev,&lt;/P&gt;&lt;P&gt;There are a number of us struggling on this forum to do the same thing, did you manage to run the SAI with and external MCLK? If so, any information would be greatly appreciated!&lt;/P&gt;&lt;P&gt;FYI, our setup is SAI1 in master mode to I2S DAC but with external precision MCLK (that needs to be feed back into MCLK pad same as you)&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 08:15:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1529362#M195727</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2022-09-28T08:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557894#M197854</link>
      <description>&lt;P&gt;Hi, I'm working on a similar system, I have an external MCLK and need my SAI peripheral to get this as input and generate BCLK and LRCLK as a master... can you give me any insight if you managed to get your system working?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557894#M197854</guid>
      <dc:creator>Airbus_A320</dc:creator>
      <dc:date>2022-11-22T15:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557903#M197855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/207901"&gt;@Airbus_A320&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not yet. I've been waiting for a SPDIF dev board to arrive to bolt up to our iMX8MM EVK that provides the external MCLK we need, it's here now so it's a matter of finding the time to get back on to it! I've scoured a few forums trying to find out how to do this and I think the trick is as smartdev said the&amp;nbsp;&lt;SPAN&gt;GPR_SAI1_EXT_MCLK_EN&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;of the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;IOMUXC_GPR_GPR2 needs to be set to 1. Whether this can be done in the SAI setup in the device tree&amp;nbsp;is yet to be determined; I have to crack this problem so I'll let you know. Or if you get there first please pass on the knowhow!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:51:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557903#M197855</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2022-11-22T15:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557907#M197857</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/201363"&gt;@smartdev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you did manage to get the MCLK to work as an input could you share how please (i.e a bit more&amp;nbsp;&lt;SPAN&gt;explicitly)&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:58:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1557907#M197857</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2022-11-22T15:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1559028#M197931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/201363"&gt;@smartdev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the confusion, the reference manual does miss some important descriptions. We shall work on the improvement.&lt;/P&gt;
&lt;P&gt;Next time when you have similar unclear points, you may check on RM of other platforms, for example 8M nano:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiaocong_fu_0-1669257381456.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201535i6CF0538DF307C8F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiaocong_fu_0-1669257381456.png" alt="xiaocong_fu_0-1669257381456.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm not saying this can always solve any problem, or excusing for the problem in the document. Just want to offer some methods for you to better process your project.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 02:39:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1559028#M197931</guid>
      <dc:creator>xiaocong_fu</dc:creator>
      <dc:date>2022-11-24T02:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802043#M219663</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/92942"&gt;@edwardtyrrell&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you able to find the solution of using the MCLK pad as a master clock input?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it required to set both the register&amp;nbsp;OMUXC_GPR_GPR2 (bit:1) and&amp;nbsp;IOMUXC_GPR_GPR6 (bit:5)?&lt;/P&gt;&lt;P&gt;I would appreciate any input you can give me.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 16:45:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802043#M219663</guid>
      <dc:creator>iicsanjeev01</dc:creator>
      <dc:date>2024-02-05T16:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802066#M219667</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/205278"&gt;@iicsanjeev01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Yes I did in the end, but it's been a while.&lt;/P&gt;&lt;P&gt;Two IOMUX GRP registers need setting in uboot or early on to use the MCLK pin as an input. Also the SAI MCLK Control Register (MCR)&amp;nbsp;needs to be told to set the MCLK as an input [look in fsl_sai.c].&lt;/P&gt;&lt;P&gt;Try in UBoot:&lt;/P&gt;&lt;P&gt;set GPR_SAI1_EXT_MCLK_EN of the IOMUXC_GPR_GPR2 and&lt;BR /&gt;Set bit 5 of register IOMUXC_GPR_GPR6 (GPR_SAI1_SEL1) to 1 (SAI1_MCLK)&lt;/P&gt;&lt;P&gt;mw.l 0x30340008 0x00000001&lt;BR /&gt;mw.l 0x30340018 0x00100000&lt;/P&gt;&lt;P&gt;----------------&lt;/P&gt;&lt;P&gt;If your trying to achieve every audio rate (44100, 48000 -&amp;gt; 352K8, 384K) like I was, then you will also need to add some code into the driver to switch between your two MCLK frequencies. You might have to do a few 'work-arounds' if your I2S card is derived off the&amp;nbsp;simple-audio-card like a lot are. Problem is the driver only receives one value for MCLK and everything is divided off that, so when you switch the physical MCLK frequency (to the other) the driver doesn't actually know, so a little 'tweaking' might be necessary. You can worry about all this though once you have got the MCLK working as an input.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The docs are not the easiest to follow when it comes to SAI clocking and tend to change the names in different chapters! One thing though, the SAI still needs a clock or two for internal use, but&amp;nbsp; - what I'll term as the 'final I2S output register' which clocks the I2S pins - is what the MCLK input is connected too (if that makes sense).&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't forget to modify the SAI your device tree.&lt;/P&gt;&lt;P&gt;Useful&amp;nbsp; -&amp;gt;&amp;nbsp; cat /sys/kernel/debug/clk/clk_summary | grep sai1&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 17:32:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802066#M219667</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2024-02-05T17:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802913#M219725</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/92942"&gt;@edwardtyrrell&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) dts changes:&lt;/P&gt;&lt;P&gt;sai1_mclk: fixed-24576 {&lt;BR /&gt;compatible = "fixed-clock";&lt;BR /&gt;#clock-cells = &amp;lt;0&amp;gt;;&lt;BR /&gt;clock-frequency = &amp;lt;24576000&amp;gt;;&lt;BR /&gt;clock-accuracy = &amp;lt;20000&amp;gt;;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;amp;sai1 {&lt;BR /&gt;pinctrl-names = "default", "dsd";&lt;BR /&gt;pinctrl-0 = &amp;lt;&amp;amp;pinctrl_sai1&amp;gt;;&lt;BR /&gt;pinctrl-1 = &amp;lt;&amp;amp;pinctrl_sai1_dsd&amp;gt;;&lt;/P&gt;&lt;P&gt;clocks = &amp;lt;&amp;amp;clk IMX8MM_CLK_SAI1_IPG&amp;gt;,&lt;BR /&gt;// MCLK1 is switched to SAI1.MCLK in the IOMUXC_GPR_GPR6 register in uboot code&lt;BR /&gt;&amp;lt;&amp;amp;sai1_mclk&amp;gt;,&lt;BR /&gt;&amp;lt;&amp;amp;clk IMX8MM_CLK_DUMMY&amp;gt;, &amp;lt;&amp;amp;clk IMX8MM_CLK_DUMMY&amp;gt;,&amp;lt;&amp;amp;clk IMX8MM_CLK_DUMMY&amp;gt;;&lt;BR /&gt;clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";&lt;BR /&gt;status = "okay";&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;this is our customized codec and machine driver&lt;/P&gt;&lt;P&gt;audiofpga: audiofpga-titan-cpucodec {&lt;BR /&gt;compatible = "fsl,audiofpga-titan-cpucard";&lt;BR /&gt;pinctrl-names = "default";&lt;BR /&gt;//clocks = &amp;lt;&amp;amp;clk IMX8MM_CLK_SAI1_ROOT&amp;gt;;&lt;BR /&gt;clocks = &amp;lt;&amp;amp;sai1_mclk&amp;gt;;&lt;BR /&gt;clock-names = "mclk";&lt;BR /&gt;status = "okay";&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;sound-audiofpga {&lt;BR /&gt;compatible = "fsl,imx-audio-audiofpga-titan-cpucard";&lt;BR /&gt;model = "audiofpga-titan-cpucard-audio";&lt;BR /&gt;audio-cpu = &amp;lt;&amp;amp;sai1&amp;gt;;&lt;BR /&gt;audio-codec = &amp;lt;&amp;amp;audiofpga&amp;gt;;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;2) I tried adding code changes in the uboot by making changes in ("board/freescale/imx8mm_val/imx8mm_val.c)&lt;/P&gt;&lt;P&gt;static int setup_sai1_mclk(void)&lt;BR /&gt;{&lt;BR /&gt;struct iomuxc_gpr_base_regs *gpr =&lt;BR /&gt;(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// GPR2&lt;BR /&gt;// GPR_SAI1_EXT_MCLK_EN = 1&lt;BR /&gt;setbits_le32(&amp;amp;gpr-&amp;gt;gpr[2], 1);&lt;BR /&gt;// GPR_SAI1_SEL1 = 1&lt;BR /&gt;setbits_le32(&amp;amp;gpr-&amp;gt;gpr[6], (1 &amp;lt;&amp;lt; 5));&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int board_init(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;setup_sai1_mclk();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Now if I read the memory as below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;root@device-000000[~]# devmem 0x30340008&lt;BR /&gt;0x00000001&lt;BR /&gt;root@device-000000[~]# devmem 0x30340018&lt;BR /&gt;0x00000020&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;as per result the GPR_SAI1_EXT_MCLK_EN is set correctly however GPR_SAI1_SEL1 not set with correct values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;here is the clock summery:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;root@device-000000[~]# cat /sys/kernel/debug/clk/clk_summary | grep sai1&lt;BR /&gt;157:&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_src&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;158:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_cg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;159:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_pre_div&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;160:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_div&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;161:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_root_clk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;309:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_ipg_clk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 400000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;2) if I set these fields from the uboot terminal as you mentioned in your recent post&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;mw.l 0x30340008 0x00000001&lt;BR /&gt;mw.l 0x30340018 0x00100000&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;then both GPR2 and GPR6 register values are correct,&amp;nbsp;however there is no change is clk_summary of sai1, if you see below:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;root@device-000000[~]# devmem 0x30340008&lt;BR /&gt;0x00000001&lt;BR /&gt;root@device-000000[~]# devmem 0x30340018&lt;BR /&gt;0x00100000&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;root@device-000000[~]# cat /sys/kernel/debug/clk/clk_summary | grep sai1&lt;BR /&gt;157:&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_src&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;158:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_cg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;159:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_pre_div&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;160:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_div&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;161:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_root_clk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 24000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0&amp;nbsp;&amp;nbsp;&lt;BR /&gt;309:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sai1_ipg_clk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 400000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;root@device-000000[~]#&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;So, I wanted to know &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;a) are my uboot changes are not kept at correct place e.g: board/freescale/imx8mm_val/imx8mm_val.c ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;b) what is the expected result in&amp;nbsp;cat /sys/kernel/debug/clk/clk_summary | grep sai1 ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;c) how to do you check if MCLK pin configured correctly as input in the actual imx8mm device?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Am I missing something here?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Thank you so much again, your input is really helpful.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Sanjeev&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 19:15:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802913#M219725</guid>
      <dc:creator>iicsanjeev01</dc:creator>
      <dc:date>2024-02-06T19:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802943#M219728</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/205278"&gt;@iicsanjeev01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RE "then both GPR2 and GPR6 register values are correct,&amp;nbsp;however there is no change is clk_summary of sai1, if you see below:"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Key thing is, the values are still correct in user space, it's only pin mux routing so you may not see it represented in the clk_summary.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Don't try to code in too many changes at once as these problems are tricky and in the past I have added code that had just ended up in more wasted time. Until the problem is cracked keep the changes as simple as possible. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The changes should be the SAI in the device tree that sets it use the IPG clock, the&amp;nbsp;sai1_mclk: fixed-24576 in this case is just to supply a 'value' for the MCLK input for your driver (it doesn't know what frequency you are putting into the MCLK pin), the same clock for your audio card and the rest is MCLK pin routing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#1 The two registers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Comment out the code you added for setting the 2 registers in&amp;nbsp;imx8mm_val.c. If you set them in uboot as I described and they are still set in user space, good stop there&amp;nbsp; - leave that part of it until later.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#2&amp;nbsp; MCLK defaults to output&lt;/P&gt;&lt;P&gt;In fsl_sai.c comment out the two blocks of code that sets the MCLK pin direction, somewhere around lines 539 and 1628&amp;nbsp;&lt;/P&gt;&lt;P&gt;// if (sai-&amp;gt;soc_data-&amp;gt;max_register &amp;gt;= FSL_SAI_MCTL) {&lt;BR /&gt;// /* SAI is in master mode at this point, so enable MCLK */&lt;BR /&gt;// regmap_update_bits(sai-&amp;gt;regmap, FSL_SAI_MCTL,&lt;BR /&gt;// FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);&lt;BR /&gt;// }&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/* Select MCLK direction */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL).....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This ensures MCLK cannot be set as an output. Again, simple step to sort out later.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#3 Device tree&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Looks alright, I think it's mine from another post &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-------------------------------------------------------------------------------------------------------------------------------&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;a) are my uboot changes are not kept at correct place e.g: board/freescale/imx8mm_val/imx8mm_val.c ?&amp;nbsp; See above,&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;b) what is the expected result in&amp;nbsp;cat /sys/kernel/debug/clk/clk_summary | grep sai1 ? This might be helpful to see if the clock settings and choices in the device tree are being recognised. I haven't ran my board for some time so I can't recall what I saw.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Check the imx documents under SAI and general clock routing, there's lots of usable information in them.&amp;nbsp;IMX8MMRM.pdf&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;c) how to do you check if MCLK pin configured correctly as input in the actual imx8mm device? Difficult until it works! If it's a new board your using can you disconnect the MCLK connection and use a standard PLL1/2 device tree setup and check you are getting MCLK 'out'? If so the physical&amp;nbsp;pin you're working with is the correct one and there's no connection/solder issues. It's not the first time pins have been routed wrong..&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Try these things and see how you go. Do you have a NXP iMx8 EVK handy with the edge connector that gives a SAI port that you could experiment with? If this is a new design you might also be fighting with other things. I had to put in a lot of debug in various drivers to figure mine out, it could be you have configured the pin right but it's something totally different.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Cheers.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 23:04:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1802943#M219728</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2024-02-06T23:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1815803#M220431</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/92942"&gt;@edwardtyrrell&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you suggested to moved step by step, initially I made changes in the device tree, GPR registers, and fsl_sai.c (commented&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//regmap_update_bits(sai-&amp;gt;regmap, FSL_SAI_MCTL,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but it didn't work.&lt;/P&gt;&lt;P&gt;then I removed all the changes and kept only GPR register changes in the u-boot (&lt;SPAN&gt;board/freescale/imx8mm_val/imx8mm_val.c)&lt;/SPAN&gt;, and it did work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even though it worked I still have few questions:&lt;/P&gt;&lt;P&gt;1) does following line of code in fsl_sai.c has any impact? Because In my case it did worked only with GPR register changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regmap_update_bits(sai-&amp;gt;regmap, FSL_SAI_MCTL,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) Just like your requirement, I too need to support both 48khz and 96khz frequency. So, could you please suggest, how did you achieved it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again for you suggestions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sanjeev&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 16:57:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1815803#M220431</guid>
      <dc:creator>iicsanjeev01</dc:creator>
      <dc:date>2024-02-26T16:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8M Mini: How to use MCLK pad as master clock input?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1815837#M220440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/205278"&gt;@iicsanjeev01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Good to hear you had some success! Now you have a working 'base' build you can fine tune the code and add in the tweaks properly according to your specific BSP. Regards question 1, if the line of code worked then keep it, if not, just check that it's not responsible for setting something else! Check what each register and bit settings are actually doing. If it works in uboot then it is as mentioned throughout these forums to set the pad before the OS does - keep it that way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Point 2, the selection of 48K,96K and so on, is set in whatever driver your hardware is using, if your driver is derived from the simple-audio card it will be in there. There will be some sort of switch statement in your driver making sure your chosen clock is divisible before reporting the rates back to the ALSA framework. In my case I needed all the 44K1 rates as well as the 48K rates so I had to switch the external MCLK frequency via a GPIO line and do some driver changes to suit.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;You have listed 48K and 96K both of which are divisible off the same clock frequency, providing your clock is matched your driver should already do both rates. To use the various rates directly you can change your asound.conf or just use the hw 'device' directly i.e. no plughw. If you don't then by default everything will be resampled to the default rate of 44k1 or 48K. You can use Linux's speaker-test application so select the card, format and rates etc to force a card to render a specific rate.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 17:55:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Mini-How-to-use-MCLK-pad-as-master-clock-input/m-p/1815837#M220440</guid>
      <dc:creator>edwardtyrrell</dc:creator>
      <dc:date>2024-02-26T17:55:08Z</dc:date>
    </item>
  </channel>
</rss>

