From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 08/20] i.MX: clk: Port imx_clk_gate2_cgr()
Date: Mon, 3 Oct 2016 07:40:45 -0700 [thread overview]
Message-ID: <1475505657-898-9-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1475505657-898-1-git-send-email-andrew.smirnov@gmail.com>
Update clk-gate2 code to be able to accept arbitrary 'cgr' value and
introduce imx_clk_gate2_cgr() (Used by Vybrid clock tree)
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/clk-gate2.c | 12 +++++++-----
arch/arm/mach-imx/clk.h | 11 +++++++++--
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index faed631..f952f3e 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -26,6 +26,7 @@ struct clk_gate2 {
struct clk clk;
void __iomem *reg;
int shift;
+ u8 cgr_val;
const char *parent;
#define CLK_GATE_INVERTED (1 << 0)
unsigned flags;
@@ -43,7 +44,7 @@ static int clk_gate2_enable(struct clk *clk)
if (g->flags & CLK_GATE_INVERTED)
val &= ~(3 << g->shift);
else
- val |= 3 << g->shift;
+ val |= g->cgr_val << g->shift;
writel(val, g->reg);
@@ -87,12 +88,13 @@ static struct clk_ops clk_gate2_ops = {
};
struct clk *clk_gate2_alloc(const char *name, const char *parent,
- void __iomem *reg, u8 shift)
+ void __iomem *reg, u8 shift, u8 cgr_val)
{
struct clk_gate2 *g = xzalloc(sizeof(*g));
g->parent = parent;
g->reg = reg;
+ g->cgr_val = cgr_val;
g->shift = shift;
g->clk.ops = &clk_gate2_ops;
g->clk.name = name;
@@ -111,12 +113,12 @@ void clk_gate2_free(struct clk *clk)
}
struct clk *clk_gate2(const char *name, const char *parent, void __iomem *reg,
- u8 shift)
+ u8 shift, u8 cgr_val)
{
struct clk *g;
int ret;
- g = clk_gate2_alloc(name , parent, reg, shift);
+ g = clk_gate2_alloc(name , parent, reg, shift, cgr_val);
ret = clk_register(g);
if (ret) {
@@ -133,7 +135,7 @@ struct clk *clk_gate2_inverted(const char *name, const char *parent,
struct clk *clk;
struct clk_gate2 *g;
- clk = clk_gate2(name, parent, reg, shift);
+ clk = clk_gate2(name, parent, reg, shift, 0x3);
if (IS_ERR(clk))
return clk;
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index c5913e1..2aeb356 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -2,7 +2,7 @@
#define __IMX_CLK_H
struct clk *clk_gate2(const char *name, const char *parent, void __iomem *reg,
- u8 shift);
+ u8 shift, u8 cgr_val);
static inline struct clk *imx_clk_divider(const char *name, const char *parent,
void __iomem *reg, u8 shift, u8 width)
@@ -51,9 +51,16 @@ static inline struct clk *imx_clk_gate(const char *name, const char *parent,
static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
void __iomem *reg, u8 shift)
{
- return clk_gate2(name, parent, reg, shift);
+ return clk_gate2(name, parent, reg, shift, 0x3);
}
+static inline struct clk *imx_clk_gate2_cgr(const char *name, const char *parent,
+ void __iomem *reg, u8 shift, u8 cgr_val)
+{
+ return clk_gate2(name, parent, reg, shift, cgr_val);
+}
+
+
struct clk *imx_clk_pllv1(const char *name, const char *parent,
void __iomem *base);
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-10-03 14:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 14:40 [PATCH 00/20] Vybrid support in Barebox Andrey Smirnov
2016-10-03 14:40 ` [PATCH 01/20] i.MX: Add primitive functions for VF610 family Andrey Smirnov
2016-10-03 14:40 ` [PATCH 02/20] i.MX: Add DEBUG_LL hooks for VF610 Andrey Smirnov
2016-10-04 6:24 ` Sascha Hauer
2016-10-04 13:27 ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 03/20] i.MX: scripts: Add "vf610" soc to imx-image Andrey Smirnov
2016-10-03 14:40 ` [PATCH 04/20] i.MX: Add support for VF610 Tower board Andrey Smirnov
2016-10-04 6:32 ` Sascha Hauer
2016-10-04 13:34 ` Andrey Smirnov
2016-10-07 7:56 ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 05/20] i.MX: Add pinctrl driver for VF610 Andrey Smirnov
2016-10-03 14:40 ` [PATCH 06/20] clk: Port clock dependency resolution code Andrey Smirnov
2016-10-03 14:40 ` [PATCH 07/20] clk: Port of_clk_set_defautls() Andrey Smirnov
2016-10-04 6:38 ` Sascha Hauer
2016-10-04 13:36 ` Andrey Smirnov
2016-10-03 14:40 ` Andrey Smirnov [this message]
2016-10-03 14:40 ` [PATCH 09/20] i.MX: clk: Add IMX_PLLV3_USB_VF610 support Andrey Smirnov
2016-10-03 14:40 ` [PATCH 10/20] i.MX: clk: Port imx_check_clocks() and imx_obtain_fixed_clock() Andrey Smirnov
2016-10-04 6:49 ` Sascha Hauer
2016-10-04 13:43 ` Andrey Smirnov
2016-10-04 19:28 ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 11/20] i.MX: Add VF610 clock tree initialization code Andrey Smirnov
2016-10-04 6:58 ` Sascha Hauer
2016-10-04 13:44 ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 12/20] vf610: Give enet_osc explicit "enet_ext" name Andrey Smirnov
2016-10-03 14:40 ` [PATCH 13/20] i.MX: Add 'lpuart' serial driver Andrey Smirnov
2016-10-04 7:13 ` Sascha Hauer
2016-10-04 13:56 ` Andrey Smirnov
2016-10-04 19:25 ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 14/20] i.MX: i2c-imx: Add Vybrid support Andrey Smirnov
2016-10-04 7:20 ` Sascha Hauer
2016-10-04 13:57 ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 15/20] i.MX: esdhc: Do not rely on CPU type for quirks Andrey Smirnov
2016-10-03 14:40 ` [PATCH 16/20] i.MX: Kconfig: Enable OCOTP on Vybrid Andrey Smirnov
2016-10-03 14:40 ` [PATCH 17/20] i.MX: ocotp: Remove unused #define Andrey Smirnov
2016-10-03 14:40 ` [PATCH 18/20] i.MX: ocotp: Account for shadow memory gaps Andrey Smirnov
2016-10-03 14:40 ` [PATCH 19/20] i.MX: ocotp: Add Vybrid support Andrey Smirnov
2016-10-03 14:40 ` [PATCH 20/20] imx-esdhc: Request "per" clock explicitly Andrey Smirnov
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=1475505657-898-9-git-send-email-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--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