ppc4xx: Add freqUART to CPU speed detection
This value is needed later for the device tree configuration of the uart clock. Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
837c730b4d
commit
fa8aea2045
@ -79,10 +79,17 @@ static void do_fixup_uart(void *fdt, int offset, int i, bd_t *bd)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
PPC4xx_SYS_INFO sys_info;
|
||||||
|
|
||||||
|
get_sys_info(&sys_info);
|
||||||
|
|
||||||
debug("Updating node UART%d\n", i);
|
debug("Updating node UART%d\n", i);
|
||||||
|
|
||||||
|
#if defined(CFG_EXT_SERIAL_CLOCK)
|
||||||
val = cpu_to_fdt32(CFG_EXT_SERIAL_CLOCK);
|
val = cpu_to_fdt32(CFG_EXT_SERIAL_CLOCK);
|
||||||
|
#else
|
||||||
|
val = cpu_to_fdt32(sys_info.freqUART);
|
||||||
|
#endif
|
||||||
rc = fdt_setprop(fdt, offset, "clock-frequency", &val, 4);
|
rc = fdt_setprop(fdt, offset, "clock-frequency", &val, 4);
|
||||||
if (rc)
|
if (rc)
|
||||||
printf("Unable to update node UART, err=%s\n", fdt_strerror(rc));
|
printf("Unable to update node UART, err=%s\n", fdt_strerror(rc));
|
||||||
|
@ -162,6 +162,8 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
|
|||||||
sysInfo->freqProcessor = sysInfo->freqPLB * sysInfo->pllPlbDiv;
|
sysInfo->freqProcessor = sysInfo->freqPLB * sysInfo->pllPlbDiv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sysInfo->freqUART = sysInfo->freqProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,6 +267,7 @@ void get_sys_info (sys_info_t *sysInfo)
|
|||||||
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
||||||
sysInfo->freqEBC = sysInfo->freqPLB/sysInfo->pllExtBusDiv;
|
sysInfo->freqEBC = sysInfo->freqPLB/sysInfo->pllExtBusDiv;
|
||||||
sysInfo->freqPCI = sysInfo->freqPLB/sysInfo->pllPciDiv;
|
sysInfo->freqPCI = sysInfo->freqPLB/sysInfo->pllPciDiv;
|
||||||
|
sysInfo->freqUART = sysInfo->freqPLB;
|
||||||
|
|
||||||
/* Figure which timer source to use */
|
/* Figure which timer source to use */
|
||||||
if (mfspr(ccr1) & 0x0080) { /* External Clock, assume same as SYS_CLK */
|
if (mfspr(ccr1) & 0x0080) { /* External Clock, assume same as SYS_CLK */
|
||||||
@ -277,6 +280,7 @@ void get_sys_info (sys_info_t *sysInfo)
|
|||||||
else /* Internal clock */
|
else /* Internal clock */
|
||||||
sysInfo->freqTmrClk = sysInfo->freqProcessor;
|
sysInfo->freqTmrClk = sysInfo->freqProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************
|
/********************************************
|
||||||
* get_PCI_freq
|
* get_PCI_freq
|
||||||
* return PCI bus freq in Hz
|
* return PCI bus freq in Hz
|
||||||
@ -318,7 +322,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
|||||||
sysInfo->freqPLB >>= 1;
|
sysInfo->freqPLB >>= 1;
|
||||||
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
||||||
sysInfo->freqEBC = sysInfo->freqOPB/sysInfo->pllExtBusDiv;
|
sysInfo->freqEBC = sysInfo->freqOPB/sysInfo->pllExtBusDiv;
|
||||||
|
sysInfo->freqUART = sysInfo->freqPLB;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void get_sys_info (sys_info_t * sysInfo)
|
void get_sys_info (sys_info_t * sysInfo)
|
||||||
@ -403,7 +407,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
|||||||
sysInfo->freqDDR = ((sysInfo->freqPLB) * SDR0_DDR0_DDRM_DECODE(sdr_ddrpll));
|
sysInfo->freqDDR = ((sysInfo->freqPLB) * SDR0_DDR0_DDRM_DECODE(sdr_ddrpll));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
sysInfo->freqUART = sysInfo->freqPLB;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -632,7 +636,8 @@ extern void get_sys_info (sys_info_t * sysInfo);
|
|||||||
extern ulong get_PCI_freq (void);
|
extern ulong get_PCI_freq (void);
|
||||||
|
|
||||||
#elif defined(CONFIG_AP1000)
|
#elif defined(CONFIG_AP1000)
|
||||||
void get_sys_info (sys_info_t * sysInfo) {
|
void get_sys_info (sys_info_t * sysInfo)
|
||||||
|
{
|
||||||
sysInfo->freqProcessor = 240 * 1000 * 1000;
|
sysInfo->freqProcessor = 240 * 1000 * 1000;
|
||||||
sysInfo->freqPLB = 80 * 1000 * 1000;
|
sysInfo->freqPLB = 80 * 1000 * 1000;
|
||||||
sysInfo->freqPCI = 33 * 1000 * 1000;
|
sysInfo->freqPCI = 33 * 1000 * 1000;
|
||||||
@ -640,13 +645,12 @@ void get_sys_info (sys_info_t * sysInfo) {
|
|||||||
|
|
||||||
#elif defined(CONFIG_405)
|
#elif defined(CONFIG_405)
|
||||||
|
|
||||||
void get_sys_info (sys_info_t * sysInfo) {
|
void get_sys_info (sys_info_t * sysInfo)
|
||||||
|
{
|
||||||
sysInfo->freqVCOMhz=3125000;
|
sysInfo->freqVCOMhz=3125000;
|
||||||
sysInfo->freqProcessor=12*1000*1000;
|
sysInfo->freqProcessor=12*1000*1000;
|
||||||
sysInfo->freqPLB=50*1000*1000;
|
sysInfo->freqPLB=50*1000*1000;
|
||||||
sysInfo->freqPCI=66*1000*1000;
|
sysInfo->freqPCI=66*1000*1000;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CONFIG_405EP)
|
#elif defined(CONFIG_405EP)
|
||||||
@ -678,9 +682,8 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
|
|||||||
* Determine FBK_DIV.
|
* Determine FBK_DIV.
|
||||||
*/
|
*/
|
||||||
sysInfo->pllFbkDiv = ((pllmr1 & PLLMR1_FBMUL_MASK) >> 20);
|
sysInfo->pllFbkDiv = ((pllmr1 & PLLMR1_FBMUL_MASK) >> 20);
|
||||||
if (sysInfo->pllFbkDiv == 0) {
|
if (sysInfo->pllFbkDiv == 0)
|
||||||
sysInfo->pllFbkDiv = 16;
|
sysInfo->pllFbkDiv = 16;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine PLB_DIV.
|
* Determine PLB_DIV.
|
||||||
@ -735,6 +738,8 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
|
|||||||
sysInfo->freqPLB = sysInfo->freqProcessor / sysInfo->pllPlbDiv;
|
sysInfo->freqPLB = sysInfo->freqProcessor / sysInfo->pllPlbDiv;
|
||||||
|
|
||||||
sysInfo->freqEBC = sysInfo->freqPLB / sysInfo->pllExtBusDiv;
|
sysInfo->freqEBC = sysInfo->freqPLB / sysInfo->pllExtBusDiv;
|
||||||
|
|
||||||
|
sysInfo->freqUART = sysInfo->freqProcessor * pllmr0_ccdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -808,6 +813,7 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
|
|||||||
* Read CPR_PRIMAD register
|
* Read CPR_PRIMAD register
|
||||||
*/
|
*/
|
||||||
mfcpr(cprprimad, cpr_primad);
|
mfcpr(cprprimad, cpr_primad);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine PLB_DIV.
|
* Determine PLB_DIV.
|
||||||
*/
|
*/
|
||||||
@ -861,6 +867,8 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
|
|||||||
|
|
||||||
sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) /
|
sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) /
|
||||||
sysInfo->pllExtBusDiv;
|
sysInfo->pllExtBusDiv;
|
||||||
|
|
||||||
|
sysInfo->freqUART = sysInfo->freqVCOHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************
|
/********************************************
|
||||||
@ -1022,6 +1030,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
|||||||
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
||||||
sysInfo->freqDDR = sysInfo->freqPLB;
|
sysInfo->freqDDR = sysInfo->freqPLB;
|
||||||
sysInfo->freqEBC = sysInfo->freqOPB / sysInfo->pllExtBusDiv;
|
sysInfo->freqEBC = sysInfo->freqOPB / sysInfo->pllExtBusDiv;
|
||||||
|
sysInfo->freqUART = sysInfo->freqPLB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************
|
/********************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user