[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180131180945.18025-13-jbrunet@baylibre.com>
Date: Wed, 31 Jan 2018 19:09:38 +0100
From: Jerome Brunet <jbrunet@...libre.com>
To: Neil Armstrong <narmstrong@...libre.com>,
Kevin Hilman <khilman@...libre.com>
Cc: Jerome Brunet <jbrunet@...libre.com>,
Stephen Boyd <sboyd@...eaurora.org>,
Michael Turquette <mturquette@...libre.com>,
Carlo Caione <carlo@...one.org>,
linux-amlogic@...ts.infradead.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 12/19] clk: meson: add regmap helpers for parm
Meson clock drivers are using struct parm to describe each field of the
clock provider. Providing helpers to access these field with regmap helps
keep drivers readable
Signed-off-by: Jerome Brunet <jbrunet@...libre.com>
---
drivers/clk/meson/clkc.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h
index aa2dfa0ff89f..8edc25297422 100644
--- a/drivers/clk/meson/clkc.h
+++ b/drivers/clk/meson/clkc.h
@@ -38,6 +38,22 @@ struct parm {
u8 width;
};
+static inline unsigned int meson_parm_read(struct regmap *map, struct parm *p)
+{
+ unsigned int val;
+
+ regmap_read(map, p->reg_off, &val);
+ return PARM_GET(p->width, p->shift, val);
+}
+
+static inline void meson_parm_write(struct regmap *map, struct parm *p,
+ unsigned int val)
+{
+ regmap_update_bits(map, p->reg_off, SETPMASK(p->width, p->shift),
+ val << p->shift);
+}
+
+
struct pll_rate_table {
unsigned long rate;
u16 m;
--
2.14.3
Powered by blists - more mailing lists