From 95a4a593b577b6e2f1da2d4b0f5ec86975c33413 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 11 Sep 2009 17:07:55 +0200 Subject: [PATCH 1/3] ppc4xx: Fix 405EZ uart base baud calculation With this fix, Linux correctly configures the baudrate when booting with FDT passed from U-Boot to Linux. Signed-off-by: Stefan Roese --- cpu/ppc4xx/speed.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpu/ppc4xx/speed.c b/cpu/ppc4xx/speed.c index 1f751372c..9c4bc0990 100644 --- a/cpu/ppc4xx/speed.c +++ b/cpu/ppc4xx/speed.c @@ -914,6 +914,7 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) unsigned long sysClkPeriodPs = ONE_BILLION / (CONFIG_SYS_CLK_FREQ/1000); unsigned long primad_cpudv; unsigned long m; + unsigned long plloutb; /* * Read PLL Mode registers @@ -999,7 +1000,10 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) / sysInfo->pllExtBusDiv; - sysInfo->freqUART = sysInfo->freqVCOHz; + plloutb = ((CONFIG_SYS_CLK_FREQ * ((cpr_pllc & PLLC_SRC_MASK) ? + sysInfo->pllFwdDivB : sysInfo->pllFwdDiv) * sysInfo->pllFbkDiv) / + sysInfo->pllFwdDivB); + sysInfo->freqUART = plloutb; } /******************************************** From 84a45d33c2cc261dbd5411f7c2ad45f6003025b6 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 11 Sep 2009 17:09:45 +0200 Subject: [PATCH 2/3] ppc4xx: Enable commands for FDT enabled Linux booting on AMCC Acadia Acadia still used the "old" arch/ppc bootm commands for booting Linux images without FDT. This patch now enables these fdt-aware boot commands for Acadia as well. Signed-off-by: Stefan Roese --- include/configs/acadia.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/configs/acadia.h b/include/configs/acadia.h index b71010769..2fb48b641 100644 --- a/include/configs/acadia.h +++ b/include/configs/acadia.h @@ -225,7 +225,8 @@ */ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_AMCC_DEF_ENV \ - CONFIG_AMCC_DEF_ENV_PPC \ + CONFIG_AMCC_DEF_ENV_POWERPC \ + CONFIG_AMCC_DEF_ENV_PPC_OLD \ CONFIG_AMCC_DEF_ENV_NOR_UPD \ CONFIG_AMCC_DEF_ENV_NAND_UPD \ "kernel_addr=fff10000\0" \ From e67af44d0167d8237dd2c2ddf8e301d19ca12914 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 14 Sep 2009 11:13:34 +0200 Subject: [PATCH 3/3] 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: Stefan Roese --- cpu/ppc4xx/speed.c | 90 ++++++++-------------------------------------- 1 file changed, 15 insertions(+), 75 deletions(-) diff --git a/cpu/ppc4xx/speed.c b/cpu/ppc4xx/speed.c index 9c4bc0990..988ba9742 100644 --- a/cpu/ppc4xx/speed.c +++ b/cpu/ppc4xx/speed.c @@ -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->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 * return PCI bus freq in Hz @@ -752,14 +735,6 @@ unsigned long determine_pci_clock_per(void) } #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) extern void get_sys_info (sys_info_t * sysInfo); extern ulong get_PCI_freq (void); @@ -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 * return PCI bus freq in Hz @@ -997,6 +955,9 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) sysInfo->freqPLB = (CONFIG_SYS_CLK_FREQ * m) / sysInfo->pllFwdDiv / sysInfo->pllPlbDiv; + sysInfo->freqOPB = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) / + sysInfo->pllOpbDiv; + sysInfo->freqEBC = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv) / sysInfo->pllExtBusDiv; @@ -1006,22 +967,6 @@ void get_sys_info (PPC4xx_SYS_INFO * sysInfo) 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) /* @@ -1168,22 +1113,6 @@ void get_sys_info (sys_info_t * sysInfo) 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 int get_clocks (void) @@ -1235,3 +1164,14 @@ ulong get_bus_freq (ulong dummy) 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