From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 04/13] i.MX51: Fix mmcclk rate
Date: Fri, 22 Oct 2010 15:15:22 +0200 [thread overview]
Message-ID: <1287753331-7696-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1287753331-7696-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/speed-imx51.c | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/speed-imx51.c b/arch/arm/mach-imx/speed-imx51.c
index dcfc874..9983297 100644
--- a/arch/arm/mach-imx/speed-imx51.c
+++ b/arch/arm/mach-imx/speed-imx51.c
@@ -90,6 +90,26 @@ static unsigned long pll3_sw_get_rate(void)
return pll_get_rate((void __iomem *)MX51_PLL3_BASE_ADDR);
}
+static unsigned long get_rate_select(int select,
+ unsigned long (* get_rate1)(void),
+ unsigned long (* get_rate2)(void),
+ unsigned long (* get_rate3)(void),
+ unsigned long (* get_rate4)(void))
+{
+ switch (select) {
+ case 0:
+ return get_rate1() ? get_rate1() : 0;
+ case 1:
+ return get_rate2() ? get_rate2() : 0;
+ case 2:
+ return get_rate3 ? get_rate3() : 0;
+ case 3:
+ return get_rate4 ? get_rate4() : 0;
+ }
+
+ return 0;
+}
+
unsigned long imx_get_uartclk(void)
{
u32 reg, prediv, podf;
@@ -140,15 +160,22 @@ unsigned long imx_get_mmcclk(void)
{
u32 reg, prediv, podf, rate;
+ reg = ccm_readl(MX51_CCM_CSCMR1);
+ reg &= MX51_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_MASK;
+ reg >>= MX51_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_OFFSET;
+ rate = get_rate_select(reg,
+ pll1_main_get_rate,
+ pll2_sw_get_rate,
+ pll3_sw_get_rate,
+ NULL);
+
reg = ccm_readl(MX51_CCM_CSCDR1);
prediv = ((reg & MX51_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_MASK) >>
MX51_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_OFFSET) + 1;
podf = ((reg & MX51_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PODF_MASK) >>
MX51_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PODF_OFFSET) + 1;
- rate = pll2_sw_get_rate() / (prediv * podf);
-
- return rate;
+ return rate / (prediv * podf);
}
void imx_dump_clocks(void)
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-10-22 13:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 13:15 more patches for next Sascha Hauer
2010-10-22 13:15 ` [PATCH 01/13] ARM pca100: Use a flash bbt Sascha Hauer
2010-10-22 13:15 ` [PATCH 02/13] i.MX nand: optimize nand boot code for size Sascha Hauer
2010-10-22 13:15 ` [PATCH 03/13] mci-core: add multiple block support Sascha Hauer
2010-10-22 13:40 ` Juergen Beisert
2010-10-22 14:03 ` Juergen Beisert
2010-10-22 13:15 ` Sascha Hauer [this message]
2010-10-22 13:15 ` [PATCH 05/13] i.MX esdctl: Add register bits from redboot Sascha Hauer
2010-10-22 13:15 ` [PATCH 06/13] i.MX35 regs: Add watchdog base Sascha Hauer
2010-10-22 13:15 ` [PATCH 07/13] fb: i.MX IPU: remove unnecessary printf Sascha Hauer
2010-10-22 13:15 ` [PATCH 08/13] fb: i.MX IPU: move fb_info initialization to a single function Sascha Hauer
2010-10-22 13:15 ` [PATCH 09/13] fb: i.MX IPU: fold mx3fb_set_par into its only user Sascha Hauer
2010-10-22 13:15 ` [PATCH 10/13] mci: align data for commands Sascha Hauer
2010-10-22 13:41 ` Juergen Beisert
2010-10-22 13:15 ` [PATCH 11/13] ARM: Add Garz+Fricke Cupid board support Sascha Hauer
2010-10-22 13:15 ` [PATCH 12/13] defaultenv: fix mtdparts Sascha Hauer
2010-10-22 13:15 ` [PATCH 13/13] ARM: Add defconfig for Garz+Fricke cupid board Sascha Hauer
2010-10-26 9:20 ` more patches for next Juergen Beisert
2010-10-26 9:48 ` Marc Kleine-Budde
2010-10-26 18:58 ` Sascha Hauer
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=1287753331-7696-5-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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