How to use CLK1 differential input as source for SSI on Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use CLK1 differential input as source for SSI on Linux

710 Views
matthewcampbell
Contributor III

Hi All,

I'm currently working on a prototype design on the MCIMX6SLEVK. I'm interfacing with an external codec that can only be in I2S slave mode, and will be using an SSI module in master mode to interface with it. The catch is that we have an externally generated master clock (must be external for performance reasons), and all the I2S signals from the SSI must be derived from it. The plan is to bring in the master clock (24.576MHz = 512*48KHz) through the CLK1_P/N, set the PLL4 into bypass and set the bypass source to CLK1 and the divide and route it to the SSI. I would know how to do this on bare metal, but I'm using Linux for this project and haven't done this before. Could I get some guidance on how I would set this up. I'm pretty sure it revolves around some device tree tweaks, I'm just not sure exactly where to start and haven't been able to track down any documentation or examples that are close enough to what I'm doing.

Thanks,

~Matt

Labels (2)
0 Kudos
3 Replies

465 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Matthew,

     CLK1_N & CLK1_P pins on i.mx6SL processor are output , you can see it at chapter 56.2 on page 3469 of i.MX6SL datasheet , so you can't input 24.576MHz clock here.

     The better way for your solution(24.576MHz clock must be used) is to make audio codec work at Master Mode(output bitclock and LRCLK to processor).

Regards,

Weidong

0 Kudos

465 Views
matthewcampbell
Contributor III

Hi Weidong,

Unfortunately the codec we are using only supports slave mode, so setting it in master isn't an option. I updated my original question explicitly state this. Our design requires an external master clock for performance reasons so that can't be changed either.

Also, CLK1_N and CLK1_P (also refereed to as CLK1N, CLK1P, AUX clk1, and XTAL_OSC_CLK1_P/N in various Freescale documentation) (balls AC23 and AD23) can be used as inputs. I was unable to find the section in the data sheet or reference manual that you are referring to, but section 3.1 (Special Signal Considerations) of the data sheet (page 15) states that CLK1P/N can be used as either an input or output. Also, Chapter 55.2 of the reference manual (Crystal Oscillators - External Signals), shows CLK1_N and CLK1_P as IO. Finally, Chapter 15.7.5 (Clock Controller Module - Analog Audio PLL control Register (CCM_ANALOG_PLL_AUDIOn)) shows that you can set the Aaudio PLL (PLL4) into PLL bypass using bit 16 (BYPASS) and select CLK1_N / CLK1_P as the source (BYPASS_CLK_SRC). From looking at the IMX6SL clock driver in the Linux kernel, it's seen that all the proper muxes and clocks are implemented to achieve my goal.

It's clear to me that what I want to do is possible, and I would know how to do it in a bare metal design. My problem comes with understanding how to do this within the context of the common clock framework of the Linux kernel and the device tree. I have actually managed to get the SSI1 root clock to derive from the CLK1 source by setting various parameters for the muxes and dividers in the CCM device tree entry using the assigned-clocks, assigned-clock-parents, assigned-clock-rates parameters. I'm not sure that this is the right way to do this, and would appreciate any further guidance about best practice for setting clocks with device tree or from the driver level.

Either way, thank you for taking the time to look into this an reply.

Best,

~Matt

0 Kudos

465 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Ok, got it !

    I confirmed your question with my colleague, you can find corresponding usage in Sabre AI board, 24.576MHz clock was also used , and converted into differential clock ,then input CPU from CLK2, from referenc manual:

0x0 REF_CLK_24M Select the 24MHz oscillator as source.

0x1 CLK1 Select the CLK1_N / CLK1_P as source.

0x2 CLK2 Select the CLK2_N / CLK2_P as source.

0x3 XOR Select the XOR of CLK1_N / CLK1_P and CLK2_N / CLK2_P as source

PLL4 has 4 kinds of clock source input, so you can select one of them.

Regards,

Weidong

0 Kudos