Commit e67af44d authored by Stefan Roese's avatar Stefan Roese

ppc4xx: Consolidate get_OPB_freq()

All 4xx variants had their own, mostly identical get_OPB_freq()
function. Some variants even only had the OPB frequency calculated
in this routine and not supplied the sys_info.freqOPB variable
correctly (e.g. 405EZ). This resulted in incorrect OPB values passed
via the FDT to Linux.

This patch now removes all those copies and only uses one function
for all 4xx variants (except for IOP480 which doesn't have an OPB).
Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent 84a45d33
...@@ -165,29 +165,12 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) ...@@ -165,29 +165,12 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
} }
} }
sysInfo->freqOPB = sysInfo->freqPLB / sysInfo->pllOpbDiv;
sysInfo->freqEBC = sysInfo->freqPLB / sysInfo->pllExtBusDiv; sysInfo->freqEBC = sysInfo->freqPLB / sysInfo->pllExtBusDiv;
sysInfo->freqUART = sysInfo->freqProcessor; sysInfo->freqUART = sysInfo->freqProcessor;
} }
/********************************************
* get_OPB_freq
* return OPB bus freq in Hz
*********************************************/
ulong get_OPB_freq (void)
{
ulong val = 0;
PPC4xx_SYS_INFO sys_info;
get_sys_info (&sys_info);
val = sys_info.freqPLB / sys_info.pllOpbDiv;
return val;
}
/******************************************** /********************************************
* get_PCI_freq * get_PCI_freq
* return PCI bus freq in Hz * return PCI bus freq in Hz
...@@ -752,14 +735,6 @@ unsigned long determine_pci_clock_per(void) ...@@ -752,14 +735,6 @@ unsigned long determine_pci_clock_per(void)
} }
#endif #endif
ulong get_OPB_freq (void)
{
sys_info_t sys_info;
get_sys_info (&sys_info);
return sys_info.freqOPB;
}
#elif defined(CONFIG_XILINX_405) #elif defined(CONFIG_XILINX_405)
extern void get_sys_info (sys_info_t * sysInfo); extern void get_sys_info (sys_info_t * sysInfo);
extern ulong get_PCI_freq (void); extern ulong get_PCI_freq (void);
...@@ -874,23 +849,6 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) ...@@ -874,23 +849,6 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
} }
/********************************************
* get_OPB_freq
* return OPB bus freq in Hz
*********************************************/
ulong get_OPB_freq (void)
{
ulong val = 0;
PPC4xx_SYS_INFO sys_info;
get_sys_info (&sys_info);
val = sys_info.freqPLB / sys_info.pllOpbDiv;
return val;
}
/******************************************** /********************************************
* get_PCI_freq * get_PCI_freq
* return PCI bus freq in Hz * return PCI bus freq in Hz
...@@ -997,6 +955,9 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) ...@@ -997,6 +955,9 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
sysInfo->freqPLB = (CONFIG_SYS_CLK_FREQ * m) / sysInfo->freqPLB = (CONFIG_SYS_CLK_FREQ * m) /
sysInfo->pllFwdDiv / sysInfo->pllPlbDiv; sysInfo->pllFwdDiv / sysInfo->pllPlbDiv;
sysInfo->freqOPB = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) /
sysInfo->pllOpbDiv;
sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) / sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) /
sysInfo->pllExtBusDiv; sysInfo->pllExtBusDiv;
...@@ -1006,22 +967,6 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) ...@@ -1006,22 +967,6 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo)
sysInfo->freqUART = plloutb; sysInfo->freqUART = plloutb;
} }
/********************************************
* get_OPB_freq
* return OPB bus freq in Hz
*********************************************/
ulong get_OPB_freq (void)
{
ulong val = 0;
PPC4xx_SYS_INFO sys_info;
get_sys_info (&sys_info);
val = (CONFIG_SYS_CLK_FREQ * sys_info.pllFbkDiv) / sys_info.pllOpbDiv;
return val;
}
#elif defined(CONFIG_405EX) #elif defined(CONFIG_405EX)
/* /*
...@@ -1168,22 +1113,6 @@ void get_sys_info (sys_info_t * sysInfo) ...@@ -1168,22 +1113,6 @@ void get_sys_info (sys_info_t * sysInfo)
sysInfo->freqUART = sysInfo->freqPLB; sysInfo->freqUART = sysInfo->freqPLB;
} }
/********************************************
* get_OPB_freq
* return OPB bus freq in Hz
*********************************************/
ulong get_OPB_freq (void)
{
ulong val = 0;
PPC4xx_SYS_INFO sys_info;
get_sys_info (&sys_info);
val = sys_info.freqPLB / sys_info.pllOpbDiv;
return val;
}
#endif #endif
int get_clocks (void) int get_clocks (void)
...@@ -1235,3 +1164,14 @@ ulong get_bus_freq (ulong dummy) ...@@ -1235,3 +1164,14 @@ ulong get_bus_freq (ulong dummy)
return val; return val;
} }
#if !defined(CONFIG_IOP480)
ulong get_OPB_freq (void)
{
PPC4xx_SYS_INFO sys_info;
get_sys_info (&sys_info);
return sys_info.freqOPB;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment