Bdinit PM sample

From wiki
Jump to navigation Jump to search
void bdinit1() {
	
*(volatile unsigned int *)(0xffe00004) =  0x00bda0c8;

//Initialize DDR PHY. If not done and program is accessing address from 0x60000000, the board will be locked   
*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C000;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C100;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C200;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C400; 

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C500;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C600;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C800;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000C900;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000CA00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000CC00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000CD00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000CE00; 

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D000;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D100;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D200;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D400;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D500; 

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D600;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D800;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000D900;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000DA00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000DC00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000DD00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000DE00;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x08020802;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x08040804;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E000;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x61610060;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00120024;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E100;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x40404040;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E200;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x00004005;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E400;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0xfffbfffb;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0xfffbfffb;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E500;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0xfffbfffb;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E600;

*(volatile unsigned int *)(0xffe0001C) =  0x04000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x00000000;
*(volatile unsigned int *)(0xffe00018) =  0x00000000;
*(volatile unsigned int *)(0xffe0001C) =  0x4000E700;

*(volatile unsigned int *)(0xffe0001C) =  0x80200000;
*(volatile unsigned int *)(0xffe0001C) =  0xc0206300;
*(volatile unsigned int *)(0xffe0001C) =  0x8c206300;
*(volatile unsigned int *)(0xffe0001C) =  0x88216300; 

//IS46DR16640C -25D  DDR2-800D 

// Trtp=7.5ns   Twr=15ns  CL=5ns  Trcd=12.5ns 	Trc=55ns  Trp=12.5 Trfc=105 Tras=40ns  tREFI=7.8us

*(volatile unsigned int *)(0xffe00004) =  0x00bda0c8;
*(volatile unsigned int *)(0xffe00008) =  0x141d0000;
*(volatile unsigned int *)(0xffe0000c) =  0x2700;
*(volatile unsigned int *)(0xffe00010) =  0x309f0309;
*(volatile unsigned int *)(0xffe00000) =  0x96a18c30;

}
void bdinit2 () {
	
// Enable UART. After reset to run the program with print statement, UART terminal must be connected or program will stack till output is done 	
//*(volatile unsigned int *)(0x80000108) =  0x80000843;

//Enable L2Cache 	
*(volatile unsigned int *)(0xf0000008) |=  0x7;                	//Invalidate all Lines 	
*(volatile unsigned int *)(0xf0000000) =  0xC0040000;          	//Enable L2Cache
	
}