msm: clock-local: Replace bank_masks with bank_info pointer
bank_masks are just one of the types of data that can be used for
the rcg_clk.set_rate() function. Make this field into a void
pointer to ease overloading of what the set_rate() function can
use.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 08a24cd..bc66c0b 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -2739,7 +2739,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx2d,
- .bank_masks = &bmnd_info_gfx2d0,
+ .bank_info = &bmnd_info_gfx2d0,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx2d0_clk",
@@ -2779,7 +2779,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx2d,
- .bank_masks = &bmnd_info_gfx2d1,
+ .bank_info = &bmnd_info_gfx2d1,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx2d1_clk",
@@ -2869,7 +2869,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx3d,
- .bank_masks = &bmnd_info_gfx3d,
+ .bank_info = &bmnd_info_gfx3d,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx3d_clk",
@@ -3029,7 +3029,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_mdp,
- .bank_masks = &bmnd_info_mdp,
+ .bank_info = &bmnd_info_mdp,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "mdp_clk",
@@ -3136,7 +3136,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_div_banked,
.freq_tbl = clk_tbl_rot,
- .bank_masks = &bdiv_info_rot,
+ .bank_info = &bdiv_info_rot,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "rot_clk",
@@ -3380,7 +3380,7 @@
.ns_reg = VCODEC_NS_REG,
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
- .bank_masks = &bmnd_info_vcodec,
+ .bank_info = &bmnd_info_vcodec,
.freq_tbl = clk_tbl_vcodec,
.current_freq = &rcg_dummy_freq,
.c = {
diff --git a/arch/arm/mach-msm/clock-8x60.c b/arch/arm/mach-msm/clock-8x60.c
index 3203cdf..5e19fca 100644
--- a/arch/arm/mach-msm/clock-8x60.c
+++ b/arch/arm/mach-msm/clock-8x60.c
@@ -2189,7 +2189,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx2d,
- .bank_masks = &bmnd_info_gfx2d0,
+ .bank_info = &bmnd_info_gfx2d0,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx2d0_clk",
@@ -2229,7 +2229,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx2d,
- .bank_masks = &bmnd_info_gfx2d1,
+ .bank_info = &bmnd_info_gfx2d1,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx2d1_clk",
@@ -2298,7 +2298,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_gfx3d,
- .bank_masks = &bmnd_info_gfx3d,
+ .bank_info = &bmnd_info_gfx3d,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "gfx3d_clk",
@@ -2457,7 +2457,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_mnd_banked,
.freq_tbl = clk_tbl_mdp,
- .bank_masks = &bmnd_info_mdp,
+ .bank_info = &bmnd_info_mdp,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "mdp_clk",
@@ -2614,7 +2614,7 @@
.root_en_mask = BIT(2),
.set_rate = set_rate_div_banked,
.freq_tbl = clk_tbl_rot,
- .bank_masks = &bdiv_info_rot,
+ .bank_info = &bdiv_info_rot,
.current_freq = &rcg_dummy_freq,
.c = {
.dbg_name = "rot_clk",
diff --git a/arch/arm/mach-msm/clock-local.c b/arch/arm/mach-msm/clock-local.c
index 6914c0b..738eacc 100644
--- a/arch/arm/mach-msm/clock-local.c
+++ b/arch/arm/mach-msm/clock-local.c
@@ -115,7 +115,7 @@
void set_rate_mnd_banked(struct rcg_clk *clk, struct clk_freq_tbl *nf)
{
- struct bank_masks *banks = clk->bank_masks;
+ struct bank_masks *banks = clk->bank_info;
const struct bank_mask_info *new_bank_masks;
const struct bank_mask_info *old_bank_masks;
uint32_t ns_reg_val, ctl_reg_val;
@@ -207,7 +207,7 @@
void set_rate_div_banked(struct rcg_clk *clk, struct clk_freq_tbl *nf)
{
- struct bank_masks *banks = clk->bank_masks;
+ struct bank_masks *banks = clk->bank_info;
const struct bank_mask_info *new_bank_masks;
const struct bank_mask_info *old_bank_masks;
uint32_t ns_reg_val, bank_sel;
@@ -568,7 +568,7 @@
spin_lock(&local_clock_reg_lock);
/* Disable branch if clock isn't dual-banked with a glitch-free MUX. */
- if (clk->bank_masks == NULL) {
+ if (!clk->bank_info) {
/* Disable all branches to prevent glitches. */
list_for_each_entry(chld, &clk->c.children, siblings) {
struct branch_clk *x = to_branch_clk(chld);
@@ -595,7 +595,7 @@
clk->current_freq = nf;
/* Enable any clocks that were disabled. */
- if (clk->bank_masks == NULL) {
+ if (!clk->bank_info) {
if (clk->enabled)
__rcg_clk_enable_reg(clk);
/* Enable only branches that were ON before. */
@@ -722,12 +722,13 @@
if (!(ctl_val & clk->root_en_mask))
return;
- if (clk->bank_masks) {
+ if (clk->bank_info) {
+ const struct bank_masks *bank_masks = clk->bank_info;
const struct bank_mask_info *bank_info;
- if (!(ctl_val & clk->bank_masks->bank_sel_mask))
- bank_info = &clk->bank_masks->bank0_mask;
+ if (!(ctl_val & bank_masks->bank_sel_mask))
+ bank_info = &bank_masks->bank0_mask;
else
- bank_info = &clk->bank_masks->bank1_mask;
+ bank_info = &bank_masks->bank1_mask;
ns_mask = bank_info->ns_mask;
md_val = readl_relaxed(bank_info->md_reg);
diff --git a/arch/arm/mach-msm/clock-local.h b/arch/arm/mach-msm/clock-local.h
index 6721f2c..99cabdf 100644
--- a/arch/arm/mach-msm/clock-local.h
+++ b/arch/arm/mach-msm/clock-local.h
@@ -126,9 +126,10 @@
const uint32_t root_en_mask;
uint32_t ns_mask;
const uint32_t ctl_mask;
- struct bank_masks *const bank_masks;
+ void *bank_info;
void (*set_rate)(struct rcg_clk *, struct clk_freq_tbl *);
+
struct clk_freq_tbl *const freq_tbl;
struct clk_freq_tbl *current_freq;