Browse Source

Fixup the info command for memory frequency

Target:LS3A2000780E

Change-Id: I0541a09c2170c548581bfa7149537aaf74bc970a
master
lixuefeng 9 years ago
parent
commit
45def5a29a
  1. 21
      pmon/cmds/sysinfo.c

21
pmon/cmds/sysinfo.c

@ -112,6 +112,21 @@ static int cpuinfo(){
#else /*for 3a/3b ddr controller */ #else /*for 3a/3b ddr controller */
if(clk != 0x1f) { if(clk != 0x1f) {
if ((*(volatile unsigned char*)0xbfe00187) == 0x37) {
if ((clk & 0xf) == 0xf) { /* set ddr frequency by software */
div_loopc = ((*(volatile unsigned int *)(0xbfe001c0)) >> 14 ) & 0x3ff;
div_out = ((*(volatile unsigned int *)(0xbfe001c0)) >> 24) & 0x3f;
memfreq = (100 * div_loopc) / div_out / 3;
} else { /* set ddr frequency by hareware */
clk30 = clk & 0x0f;
clk4 = (clk >> 4) & 0x01;
/* to calculate memory frequency.
* we can find this function in loongson 3A manual,
* memclk * (clksel[8:5] + 30)/(clksel[9] + 3)
*/
memfreq = 100*(clk30 + 30)/(clk4 + 3)/3;
}
}else{
clk30 = clk & 0x0f; clk30 = clk & 0x0f;
clk4 = (clk >> 4) & 0x01; clk4 = (clk >> 4) & 0x01;
/* to calculate memory frequency. /* to calculate memory frequency.
@ -119,14 +134,14 @@ static int cpuinfo(){
* memclk * (clksel[8:5] + 30)/(clksel[9] + 3) * memclk * (clksel[8:5] + 30)/(clksel[9] + 3)
*/ */
memfreq = 100*(clk30 + 30)/(clk4 + 3)/3; memfreq = 100*(clk30 + 30)/(clk4 + 3)/3;
}
printf("/ Bus @ %d MHz\n",memfreq); printf("/ Bus @ %d MHz\n",memfreq);
} }else
else
printf("/ Bus @ 33 MHz\n"); printf("/ Bus @ 33 MHz\n");
#endif #endif
} }
static int meminfo(){ static int meminfo(){

Loading…
Cancel
Save