public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc4xx: Consolidate get_OPB_freq()
Date: Mon, 14 Sep 2009 11:39:53 +0200	[thread overview]
Message-ID: <1252921193-18554-1-git-send-email-sr@denx.de> (raw)

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 <sr@denx.de>
---
 cpu/ppc4xx/speed.c |   90 +++++++++-------------------------------------------
 1 files changed, 15 insertions(+), 75 deletions(-)

diff --git a/cpu/ppc4xx/speed.c b/cpu/ppc4xx/speed.c
index 9c4bc09..988ba97 100644
--- a/cpu/ppc4xx/speed.c
+++ b/cpu/ppc4xx/speed.c
@@ -165,30 +165,13 @@ 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);
@@ -875,23 +850,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
-- 
1.6.4.3

             reply	other threads:[~2009-09-14  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14  9:39 Stefan Roese [this message]
2009-09-17 12:08 ` [U-Boot] [PATCH] ppc4xx: Consolidate get_OPB_freq() Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252921193-18554-1-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox