From: maxims@google.com
To: openbmc@lists.ozlabs.org
Subject: [PATCH u-boot 3/5] aspeed: Added function to calculate APB Clock frequency.
Date: Thu, 3 Nov 2016 11:15:02 -0700 [thread overview]
Message-ID: <1478196904-143229-3-git-send-email-maxims@google.com> (raw)
In-Reply-To: <1478196904-143229-1-git-send-email-maxims@google.com>
From: Maxim Sloyko <maxims@google.com>
This is needed by I2C driver.
Signed-off-by: Maxim Sloyko <maxims@google.com>
---
arch/arm/include/asm/arch-aspeed/ast_scu.h | 1 +
arch/arm/mach-aspeed/ast-scu.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/arch/arm/include/asm/arch-aspeed/ast_scu.h b/arch/arm/include/asm/arch-aspeed/ast_scu.h
index d248416..eb5aaa2 100644
--- a/arch/arm/include/asm/arch-aspeed/ast_scu.h
+++ b/arch/arm/include/asm/arch-aspeed/ast_scu.h
@@ -38,6 +38,7 @@ extern void ast_scu_get_who_init_dram(void);
extern u32 ast_get_clk_source(void);
extern u32 ast_get_h_pll_clk(void);
extern u32 ast_get_ahbclk(void);
+extern u32 ast_get_apbclk(void);
extern u32 ast_scu_get_vga_memsize(void);
diff --git a/arch/arm/mach-aspeed/ast-scu.c b/arch/arm/mach-aspeed/ast-scu.c
index 280c421..e00dbe2 100644
--- a/arch/arm/mach-aspeed/ast-scu.c
+++ b/arch/arm/mach-aspeed/ast-scu.c
@@ -318,6 +318,17 @@ u32 ast_get_ahbclk(void)
#endif /* AST_SOC_G5 */
+u32 ast_get_apbclk(void)
+{
+ u32 h_pll = ast_get_h_pll_clk();
+ /* The formula for converting the bit pattern to divisor is
+ * (4 + 4 * DIV), according to datasheet
+ */
+ u32 apb_div = 4 + 4 * SCU_GET_PCLK_DIV(ast_scu_read(AST_SCU_CLK_SEL));
+ return h_pll / apb_div;
+}
+
+
void ast_scu_show_system_info(void)
{
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-11-03 18:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 18:15 [PATCH u-boot 1/5] aspeed/g5: Device Tree for ast2500, copied from openbmc/linux (include file), plus minimal device tree configuration for ast2500 eval board maxims
2016-11-03 18:15 ` [PATCH u-boot 2/5] aspeed: Fixed incosistency in some SCU registers naming maxims
2016-11-03 18:15 ` maxims [this message]
2016-11-03 18:15 ` [PATCH u-boot 4/5] aspeed: Added function to configure pins for I2C devices maxims
2016-11-03 18:15 ` [PATCH u-boot 5/5] aspeed: I2C driver maxims
2016-11-10 17:53 ` [PATCH u-boot 1/5] aspeed/g5: Device Tree for ast2500, copied from openbmc/linux (include file), plus minimal device tree configuration for ast2500 eval board Maxim Sloyko
-- strict thread matches above, loose matches on Subject: below --
2016-11-22 23:56 [PATCH u-boot 0/5] Aspeed I2C driver, using Driver Model maxims
2016-11-22 23:56 ` [PATCH u-boot 3/5] aspeed: Added function to calculate APB Clock frequency maxims
2016-11-23 16:13 ` [U-Boot] " Simon Glass
2016-11-23 16:24 ` Simon Glass
2016-11-23 17:59 ` Maxim Sloyko
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=1478196904-143229-3-git-send-email-maxims@google.com \
--to=maxims@google.com \
--cc=openbmc@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.