From: Maxim Sloyko <maxims@google.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/17] aspeed: Make SCU lock/unlock functions part of SCU API
Date: Thu, 16 Mar 2017 14:36:11 -0700 [thread overview]
Message-ID: <20170316213624.140344-5-maxims@google.com> (raw)
In-Reply-To: <20170316213624.140344-1-maxims@google.com>
Make functions for locking and unlocking SCU part of SCU API.
Many drivers need to modify settings in SCU and thus need to unlock it
first. This change makes it possible.
Signed-off-by: Maxim Sloyko <maxims@google.com>
---
arch/arm/include/asm/arch-aspeed/scu_ast2500.h | 14 ++++++++++++++
arch/arm/mach-aspeed/ast2500/clk_ast2500.c | 15 +++++++++++++++
drivers/clk/aspeed/clk_ast2500.c | 18 ++----------------
3 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
index fc0c01ae33..0fa3ecb9b9 100644
--- a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
+++ b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
@@ -120,6 +120,20 @@ int ast_get_clk(struct udevice **devp);
*/
void *ast_get_scu(void);
+/**
+ * ast_scu_unlock() - unlock protected registers
+ *
+ * @scu, pointer to ast2500_scu
+ */
+void ast_scu_unlock(struct ast2500_scu *scu);
+
+/**
+ * ast_scu_lock() - lock protected registers
+ *
+ * @scu, pointer to ast2500_scu
+ */
+void ast_scu_lock(struct ast2500_scu *scu);
+
#endif /* __ASSEMBLY__ */
#endif /* _ASM_ARCH_SCU_AST2500_H */
diff --git a/arch/arm/mach-aspeed/ast2500/clk_ast2500.c b/arch/arm/mach-aspeed/ast2500/clk_ast2500.c
index 079909fa64..30cfac1af0 100644
--- a/arch/arm/mach-aspeed/ast2500/clk_ast2500.c
+++ b/arch/arm/mach-aspeed/ast2500/clk_ast2500.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
+#include <asm/io.h>
#include <asm/arch/scu_ast2500.h>
int ast_get_clk(struct udevice **devp)
@@ -28,3 +29,17 @@ void *ast_get_scu(void)
return priv->scu;
}
+
+void ast_scu_unlock(struct ast2500_scu *scu)
+{
+ writel(SCU_UNLOCK_VALUE, &scu->protection_key);
+ while (!readl(&scu->protection_key))
+ ;
+}
+
+void ast_scu_lock(struct ast2500_scu *scu)
+{
+ writel(~SCU_UNLOCK_VALUE, &scu->protection_key);
+ while (readl(&scu->protection_key))
+ ;
+}
diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c
index 26a5e58221..504731271c 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -132,20 +132,6 @@ static ulong ast2500_clk_get_rate(struct clk *clk)
return rate;
}
-static void ast2500_scu_unlock(struct ast2500_scu *scu)
-{
- writel(SCU_UNLOCK_VALUE, &scu->protection_key);
- while (!readl(&scu->protection_key))
- ;
-}
-
-static void ast2500_scu_lock(struct ast2500_scu *scu)
-{
- writel(~SCU_UNLOCK_VALUE, &scu->protection_key);
- while (readl(&scu->protection_key))
- ;
-}
-
static ulong ast2500_configure_ddr(struct ast2500_scu *scu, ulong rate)
{
ulong clkin = ast2500_get_clkin(scu);
@@ -197,9 +183,9 @@ static ulong ast2500_configure_ddr(struct ast2500_scu *scu, ulong rate)
| (best_num << SCU_MPLL_NUM_SHIFT)
| (best_denum << SCU_MPLL_DENUM_SHIFT);
- ast2500_scu_unlock(scu);
+ ast_scu_unlock(scu);
writel(mpll_reg, &scu->m_pll_param);
- ast2500_scu_lock(scu);
+ ast_scu_lock(scu);
return ast2500_get_mpll_rate(clkin, mpll_reg);
}
--
2.12.0.367.g23dc2f6d3c-goog
next prev parent reply other threads:[~2017-03-16 21:36 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 21:36 [U-Boot] [PATCH 00/17] Expand Aspeed AST2500 Support Maxim Sloyko
2017-03-16 21:36 ` [U-Boot] [PATCH 01/17] aspeed: Update ast2500 Device Tree Maxim Sloyko
2017-03-21 23:21 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 02/17] dm: Simple Watchdog uclass Maxim Sloyko
2017-03-17 8:41 ` Lukasz Majewski
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 03/17] aspeed: Watchdog Timer Driver Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` Maxim Sloyko [this message]
2017-03-21 23:22 ` [U-Boot] [PATCH 04/17] aspeed: Make SCU lock/unlock functions part of SCU API Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 05/17] aspeed: Reset Driver Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-24 0:50 ` Maxim Sloyko
2017-03-16 21:36 ` [U-Boot] [PATCH 06/17] aspeed: Device Tree configuration for " Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 07/17] aspeed: Refactor AST2500 RAM Driver and Sysreset Driver Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 08/17] aspeed: AST2500 Pinctrl Driver Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 09/17] aspeed: Enable Pinctrl Driver in AST2500 EVB Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 10/17] aspeed: Add P-Bus clock in ast2500 clock driver Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 11/17] aspeed: Add I2C Driver Maxim Sloyko
2017-03-20 6:35 ` Heiko Schocher
2017-03-22 13:05 ` Simon Glass
2017-03-27 10:40 ` Benjamin Herrenschmidt
2017-03-27 10:41 ` Benjamin Herrenschmidt
2017-03-16 21:36 ` [U-Boot] [PATCH 12/17] aspeed: Enable I2C in EVB defconfig Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 13/17] aspeed: Add support for Clocks needed by MACs Maxim Sloyko
2017-03-19 16:42 ` Tom Rini
2017-03-20 17:24 ` Maxim Sloyko
2017-03-20 17:30 ` Tom Rini
2017-03-20 17:52 ` Maxim Sloyko
2017-03-20 19:48 ` Tom Rini
2017-03-20 22:36 ` Maxim Sloyko
2017-03-20 20:43 ` Rick Altherr
2017-03-21 1:18 ` Joel Stanley
2017-03-16 21:36 ` [U-Boot] [PATCH 14/17] aspeed: Refactor SCU to use consistent mask & shift Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
2017-03-16 21:36 ` [U-Boot] [PATCH 15/17] aspeed: Cleanup ast2500-u-boot.dtsi Device Tree Maxim Sloyko
2017-03-16 21:36 ` [U-Boot] [PATCH 16/17] aspeed: Add AST2500/AST2400 compatible NIC Driver Maxim Sloyko
2017-03-21 19:32 ` Joe Hershberger
2017-03-21 23:44 ` Maxim Sloyko
2017-03-22 13:06 ` Simon Glass
2017-03-24 0:42 ` Maxim Sloyko
2017-03-16 21:36 ` [U-Boot] [PATCH 17/17] aspeed: Network Driver configuration for EVB Maxim Sloyko
2017-03-21 23:22 ` Simon Glass
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=20170316213624.140344-5-maxims@google.com \
--to=maxims@google.com \
--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