SPEAr CPU freq: Adding support for CPU Freq framework
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH RESEND v5 39/63 SPEAr CPU freq: Adding support for CPU Freq framework
From: Deepak Sikri <[email protected]>
--- arch/arm/Kconfig | 1 + arch/arm/mach-spear13xx/clock.c | 7 +- arch/arm/mach-spear3xx/clock.c | 5 +- arch/arm/mach-spear6xx/clock.c | 5 +- arch/arm/plat-spear/Makefile | 2 +- arch/arm/plat-spear/cpufreq.c | 164 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 176 insertions(+), 8 deletions(-) create mode 100644 arch/arm/plat-spear/cpufreq.c
arch/arm/Kconfig +1 -0
@@ -872,6 +872,7 @@ config PLAT_SPEAR select CLKDEV_LOOKUP select GENERIC_CLOCKEVENTS select HAVE_CLK + select ARCH_HAS_CPUFREQ help Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx).
arch/arm/mach-spear13xx/clock.c +4 -3
@@ -91,6 +91,7 @@ static struct pll_clk_config pll1_config = {/* pll rate configuration table, in ascending order of rates */ struct pll_rate_tbl pll_rtbl[] = {/* PCLK 24MHz */ + {.mode =0 , .m =0x64 , .n =0x03 , .p =0x2 },/* 400 MHz */ {.mode =0 , .m =0x7D , .n =0x03 , .p =0x2 },/* 500 MHz */ {.mode =0 , .m =0xA6 , .n =0x03 , .p =0x2 },/* 664 MHz */ {.mode =0 , .m =0xC8 , .n =0x03 , .p =0x2 },/* 800 MHz */
@@ -107,7 +108,7 @@ static struct clk pll1_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 3}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 4}, .private_data = &pll1_config, };
@@ -144,7 +145,7 @@ static struct clk pll2_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 3}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 4}, .private_data = &pll2_config, };
@@ -165,7 +166,7 @@ static struct clk pll3_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 3}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 4}, .private_data = &pll3_config, };
arch/arm/mach-spear3xx/clock.c +3 -2
@@ -55,6 +55,7 @@ static struct pll_clk_masks pll_masks = {/* pll rate configuration table, in ascending order of rates */ struct pll_rate_tbl pll_rtbl[] = { + {.mode =0 , .m =0x53 , .n =0x0C , .p =0x1 },/* 166 MHz */ {.mode =0 , .m =0x85 , .n =0x0C , .p =0x1 },/* 266 MHz */ {.mode =0 , .m =0xA6 , .n =0x0C , .p =0x1 },/* 332 MHz */ };
@@ -75,7 +76,7 @@ static struct clk pll1_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 2}, .private_data = &pll1_config, };
@@ -95,7 +96,7 @@ static struct clk pll2_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 2}, .private_data = &pll2_config, };
arch/arm/mach-spear6xx/clock.c +3 -2
@@ -55,6 +55,7 @@ static struct pll_clk_masks pll_masks = {/* pll rate configuration table, in ascending order of rates */ struct pll_rate_tbl pll_rtbl[] = { + {.mode =0 , .m =0x53 , .n =0x0C , .p =0x1 },/* 166 MHz */ {.mode =0 , .m =0x85 , .n =0x0C , .p =0x1 },/* 266 MHz */ {.mode =0 , .m =0xA6 , .n =0x0C , .p =0x1 },/* 332 MHz */ };
@@ -75,7 +76,7 @@ static struct clk pll1_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 2}, .private_data = &pll1_config, };
@@ -95,7 +96,7 @@ static struct clk pll2_clk = { .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, .set_rate = &pll_clk_set_rate, - .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1}, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 2}, .private_data = &pll2_config, };
arch/arm/plat-spear/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-y := clcd.o clock.o pll_clk.o time.o obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o - +obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_MACH_SPEAR310) += plgpio.o obj-$(CONFIG_MACH_SPEAR320) += plgpio.o obj-$(CONFIG_SPEAR_PWM) += pwm.o
arch/arm/plat-spear/cpufreq.c new file +164 -0
164 lines not on this page · raw message
Signature · 1 line
1.7.2.2
PATCH RESEND v5 39/63 SPEAr CPU freq: Adding support for CPU Freq framework
Quoted 6 lines · Viresh Kumar
From: Deepak Sikri <[email protected]>
Signed-off-by Deepak Sikri <[email protected]>Signed-off-by Rajeev Kumar <[email protected]>Signed-off-by shiraz hashim <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Looks nice to me!
Jamie
PATCH RESEND v5 39/63 SPEAr CPU freq: Adding support for CPU Freq framework
In reply to Viresh Kumararch/arm/plat-spear/cpufreq.c line 89
Quoted 10 lines · Viresh Kumar
From: Deepak Sikri <[email protected]>
<snip>
arch/arm/plat-spear/cpufreq.c new file +6
-0+ + newfreq =clk_round_rate (cpu_clk, spear_cpu_freq[index] *1000 ); +if (newfreq <0 ) { +pr_err ("CPU Freq: clk_round_rate failed: %ld\n" , newfreq); +return newfreq; + }
clk_round_rate will call round_rate_index();
--------------------------
static intround_rate_index(struct clk *clk, unsigned long drate, unsigned long *rate)
{
unsigned long tmp = 0, prev_rate = 0;
int index;
if (!clk->calc_rate)
return -EFAULT;------------------------------------------
The cpu_clk don't have calc_rate, clk_round_rate always return fault.
Stanley.
PATCH RESEND v5 39/63 SPEAr CPU freq: Adding support for CPU Freq framework
Quoted 23 lines · stanley.miao
Quoted 10 lines · Viresh Kumar
arch/arm/plat-spear/cpufreq.c line 89
Quoted 10 lines
From: Deepak Sikri <[email protected]>
<snip>
arch/arm/plat-spear/cpufreq.c new file +6
-0+ + newfreq =clk_round_rate (cpu_clk, spear_cpu_freq[index] *1000 ); +if (newfreq <0 ) { +pr_err ("CPU Freq: clk_round_rate failed: %ld\n" , newfreq); +return newfreq; + }
clk_round_ratewill callround_rate_index();
--------------------------static int
round_rate_index(struct clk *clk, unsigned long drate, unsigned long *rate){ unsigned long tmp = 0, prev_rate = 0; int index; if (!clk->calc_rate) return -EFAULT;
Quoted 3 lines
------------------------------------------
The
cpu_clkdon't havecalc_rate,clk_round_ratealways return fault.
I will resend this patch with this issue resolved.
Signature · 1 line
viresh