Skip to content

Commit a02cb23

Browse files
committed
sh: clkfwk: Add a followparent_recalc() helper.
This adds a followparent_recalc() helper for clocks that just follow the parent's rate. Switch over the few CPUs that use this scheme for some of their clocks. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent b68d820 commit a02cb23

6 files changed

Lines changed: 11 additions & 25 deletions

File tree

‎arch/sh/include/asm/clock.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int __init arch_clk_init(void);
4444

4545
/* arch/sh/kernel/cpu/clock.c */
4646
int clk_init(void);
47-
47+
unsigned long followparent_recalc(struct clk *clk);
4848
void clk_recalc_rate(struct clk *);
4949

5050
int clk_register(struct clk *);

‎arch/sh/kernel/cpu/clock.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ static void propagate_rate(struct clk *clk)
9090
}
9191
}
9292

93+
/* Used for clocks that always have same value as the parent clock */
94+
unsigned long followparent_recalc(struct clk *clk)
95+
{
96+
return clk->parent->rate;
97+
}
98+
9399
static void __clk_init(struct clk *clk)
94100
{
95101
/*

‎arch/sh/kernel/cpu/sh2/clock-sh7619.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,8 @@ static struct clk_ops sh7619_bus_clk_ops = {
5757
.recalc = bus_clk_recalc,
5858
};
5959

60-
static unsigned long cpu_clk_recalc(struct clk *clk)
61-
{
62-
return clk->parent->rate;
63-
}
64-
6560
static struct clk_ops sh7619_cpu_clk_ops = {
66-
.recalc = cpu_clk_recalc,
61+
.recalc = followparent_recalc,
6762
};
6863

6964
static struct clk_ops *sh7619_clk_ops[] = {

‎arch/sh/kernel/cpu/sh2a/clock-sh7203.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,8 @@ static struct clk_ops sh7203_bus_clk_ops = {
6666
.recalc = bus_clk_recalc,
6767
};
6868

69-
static unsigned long cpu_clk_recalc(struct clk *clk)
70-
{
71-
return clk->parent->rate;
72-
}
73-
7469
static struct clk_ops sh7203_cpu_clk_ops = {
75-
.recalc = cpu_clk_recalc,
70+
.recalc = followparent_recalc,
7671
};
7772

7873
static struct clk_ops *sh7203_clk_ops[] = {

‎arch/sh/kernel/cpu/sh4a/clock-sh7722.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,15 +646,10 @@ static void sh7722_mstpcr_disable(struct clk *clk)
646646
sh7722_mstpcr_start_stop(clk, 0);
647647
}
648648

649-
static unsigned long sh7722_mstpcr_recalc(struct clk *clk)
650-
{
651-
return clk->parent->rate;
652-
}
653-
654649
static struct clk_ops sh7722_mstpcr_clk_ops = {
655650
.enable = sh7722_mstpcr_enable,
656651
.disable = sh7722_mstpcr_disable,
657-
.recalc = sh7722_mstpcr_recalc,
652+
.recalc = followparent_recalc,
658653
};
659654

660655
#define MSTPCR(_name, _parent, regnr, bitnr) \

‎arch/sh/kernel/cpu/sh4a/clock-sh7763.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,8 @@ static struct clk_ops sh7763_bus_clk_ops = {
4949
.recalc = bus_clk_recalc,
5050
};
5151

52-
static unsigned long cpu_clk_recalc(struct clk *clk)
53-
{
54-
return clk->parent->rate;
55-
}
56-
5752
static struct clk_ops sh7763_cpu_clk_ops = {
58-
.recalc = cpu_clk_recalc,
53+
.recalc = followparent_recalc,
5954
};
6055

6156
static struct clk_ops *sh7763_clk_ops[] = {

0 commit comments

Comments
 (0)