public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] ADS5121: add LPC clock support
Date: Sat, 27 Sep 2008 23:37:53 +0200	[thread overview]
Message-ID: <1222551475-20965-2-git-send-email-wd@denx.de> (raw)
In-Reply-To: <1222551475-20965-1-git-send-email-wd@denx.de>

From: Ralph Kondziella <rk@argos-messtechnik.de>

(needed for PATA support)

Signed-off-by: Ralph Kondziella <rk@argos-messtechnik.de>
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 cpu/mpc512x/speed.c           |   13 ++++++++++++-
 include/asm-ppc/global_data.h |    1 +
 include/mpc512x.h             |    4 ++++
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/cpu/mpc512x/speed.c b/cpu/mpc512x/speed.c
index e62477b..24ec062 100644
--- a/cpu/mpc512x/speed.c
+++ b/cpu/mpc512x/speed.c
@@ -68,6 +68,7 @@ int get_clocks (void)
 	u8 sys_div;
 	u8 ips_div;
 	u8 pci_div;
+	u8 lpc_div;
 	u32 ref_clk = CFG_MPC512X_CLKIN;
 	u32 spll;
 	u32 sys_clk;
@@ -75,6 +76,7 @@ int get_clocks (void)
 	u32 csb_clk;
 	u32 ips_clk;
 	u32 pci_clk;
+	u32 lpc_clk;
 
 	if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
 		return -1;
@@ -101,15 +103,23 @@ int get_clocks (void)
 	if (pci_div != 0) {
 		pci_clk = csb_clk / pci_div;
 	} else {
-		/* in case we cannot get a sane IPS divisor, fail gracefully */
+		/* in case we cannot get a sane PCI divisor, fail gracefully */
 		pci_clk = 333333;
 	}
+	lpc_div = (im->clk.scfr[0] & SCFR1_LPC_DIV_MASK) >> SCFR1_LPC_DIV_SHIFT;
+	if (lpc_div != 0) {
+		lpc_clk = ips_clk / lpc_div;
+	} else {
+		/* in case we cannot get a sane LPC divisor, fail gracefully */
+		lpc_clk = 0;
+	}
 
 	gd->ips_clk = ips_clk;
 	gd->pci_clk = pci_clk;
 	gd->csb_clk = csb_clk;
 	gd->cpu_clk = core_clk;
 	gd->bus_clk = csb_clk;
+	gd->lpc_clk = lpc_clk;
 	return 0;
 
 }
@@ -130,6 +140,7 @@ int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	printf("  Coherent System Bus: %4d MHz\n", gd->csb_clk / 1000000);
 	printf("  IPS Bus:             %4d MHz\n", gd->ips_clk / 1000000);
 	printf("  PCI:                 %4d MHz\n", gd->pci_clk / 1000000);
+	printf("  LPC:                 %4d MHz\n", gd->lpc_clk / 1000000);
 	printf("  DDR:                 %4d MHz\n", 2 * gd->csb_clk / 1000000);
 	return 0;
 }
diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h
index 4331a15..d1d075f 100644
--- a/include/asm-ppc/global_data.h
+++ b/include/asm-ppc/global_data.h
@@ -110,6 +110,7 @@ typedef	struct	global_data {
 	u32 ips_clk;
 	u32 csb_clk;
 	u32 pci_clk;
+	u32 lpc_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC8220)
 	unsigned long   bExtUart;
diff --git a/include/mpc512x.h b/include/mpc512x.h
index cb418d1..1f808ca 100644
--- a/include/mpc512x.h
+++ b/include/mpc512x.h
@@ -191,6 +191,10 @@
 #define SCFR1_IPS_DIV_MASK		0x03800000
 #define SCFR1_IPS_DIV_SHIFT		23
 
+#define SCFR1_LPC_DIV			0x2
+#define SCFR1_LPC_DIV_MASK		0x00003800
+#define SCFR1_LPC_DIV_SHIFT		11
+
 #define SCFR1_PCI_DIV			0x6
 #define SCFR1_PCI_DIV_MASK		0x00700000
 #define SCFR1_PCI_DIV_SHIFT		20
-- 
1.5.5.1

  reply	other threads:[~2008-09-27 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-27 21:37 [U-Boot] [PATCH 0/3] ADS5121: PATA support Wolfgang Denk
2008-09-27 21:37 ` Wolfgang Denk [this message]
2008-09-27 21:37   ` [U-Boot] [PATCH 2/3] ADS5121: add " Wolfgang Denk
2008-09-27 21:37     ` [U-Boot] [PATCH 3/3] ADS5121: Code cleanup Wolfgang Denk
2008-09-28  0:01   ` [U-Boot] [PATCH 1/3] ADS5121: add LPC clock support John Rigby
2008-09-29 21:19     ` John Rigby
2008-10-14 16:20     ` Wolfgang Denk

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=1222551475-20965-2-git-send-email-wd@denx.de \
    --to=wd@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