Commit f510c32a authored by Jerome Brunet's avatar Jerome Brunet Committed by Neil Armstrong

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 fields with regmap
helps to keep drivers readable
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
parent 2513a28c
...@@ -38,6 +38,22 @@ struct parm { ...@@ -38,6 +38,22 @@ struct parm {
u8 width; 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 { struct pll_rate_table {
unsigned long rate; unsigned long rate;
u16 m; u16 m;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment