Spread Spectrum in i.mx6
If the CPU to DDR clock fails due to the EMI, there is a quick software solution - Spread Spectrum. The changes can be made in the u-boot. You will need to create the u-boot in SPL mode. Add the following code ( located at board/freescale/mx6sabresd/).
#include <config.h>
/* Enable Spread Spectrum */
.macro spreadspectrum_vikas
ldr r0, =CCM_BASE_ADDR
ldr r1, [r0,#0x18]
ldr r3, [r0,#0x18]
/*need Delay short time before switch PLL2 it back*/
ldr r4, =0x0
pu_delay:
add r4, r4, #0x1
cmp r4, #0x200000
bne pu_delay
/* recovery the previous PLL source setting */
ldr r0, =CCM_BASE_ADDR
str r3, [r0,#0x18]
.endm
.macro spreadspectrum_rohitab
ldr r0, =CCM_BASE_ADDR
ldr r1, [r0,#0x18]
ldr r3, [r0,#0x18]
/* set periph_clik2_sel to select OSC_CLK */
and r1, r1, #0xffffcfff
orr r1, r1, #0x00001000
str r1, [r0,#0x18]
/*need Delay short time before switch PLL2 it back*/
ldr r4, =0x0
pu_delay:
add r4, r4, #0x1
cmp r4, #0x200000
bne pu_delay
/* recovery the previous PLL source setting */
ldr r0, =CCM_BASE_ADDR
str r3, [r0,#0x18]
.endm
.macro spreadspectrum
ldr r0, =CCM_BASE_ADDR
ldr r1, [r0,#0x18]
ldr r3, [r0,#0x18]
/* set periph_clik2_sel to select OSC_CLK */
and r1, r1, #0xffffcfff
orr r1, r1, #0x00001000
str r1, [r0,#0x18]
/* set periph_clk_set to switch to OSC_CLK */
ldr r1, [r0,#0x14]
ldr r2, [r0,#0x14]
orr r1, r1, #0x02000000
str r1, [r0,#0x14]
/* power down PLL2 */
ldr r0, =0x020c8000
ldr r1, [r0,#0x30]
orr r1, r1, #0x00010000
str r1, [r0,#0x30]
/* enable spread spectrum & configure */
ldr r1, =0x00001770
str r1, [r0,#0x60]
ldr r1, =0x05dc8006
str r1, [r0,#0x40]
ldr r1, [r0,#0x30]
and r1, r1, #0xFFFEFFFF
str r1, [r0,#0x30]
/*need Delay short time before switch PLL2 it back*/
ldr r4, =0x0
pu_delay:
add r4, r4, #0x1
cmp r4, #0x200000
bne pu_delay
/* recovery the previous PLL source setting */
ldr r0, =CCM_BASE_ADDR
str r2, [r0,#0x14]
str r3, [r0,#0x18]
.endm
/* End Enable Spread Spectrum */
.globl blhss
.type blhss,%function
blhss:
.fnstart
spreadspectrum
bx lr
.fnend
Save the file as spreadspectrum.S and then update the Make file to include this file.
obj-y := mx6sabresd.o
obj-y += spreadspectrum.o
In file mx6sabresd.c make following changes
- Just before
int dram_init(void);
Add
extern int blhss(void);
2. Just after
gpr_init();
Add following
blhss();
Compile and try. Results will be updated lated.