aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThara Gopinath <thara@ti.com>2010-08-18 02:53:12 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-12-22 17:31:50 -0500
commitb35cecf978e33bf8f4be0f36ffe00fe10f381c4a (patch)
treee64d7071a277931f9481761c1fa788994faab418 /arch
parentfb200cfb2330b959eabc94e2f2c15717ce8466af (diff)
OMAP4: Smartreflex framework extensions
This patch extends the smartreflex framework to support OMAP4. The changes are minor like compiling smartreflex Kconfig option for OMAP4 also, and a couple of OMAP4 checks in the smartreflex framework. The change in sr_device.c where new logic has to be introduced for reading the efuse registers is due to the fact that in OMAP4 the efuse registers are 24 bit aligned. A __raw_readl will fail for non-32 bit aligned address and hence the 8-bit read and shift. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/smartreflex.c8
-rw-r--r--arch/arm/mach-omap2/sr_device.c17
-rw-r--r--arch/arm/plat-omap/Kconfig2
3 files changed, 23 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 52a05b336c08..77ecebf3fae2 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -153,7 +153,11 @@ static void sr_set_clk_length(struct omap_sr *sr)
153 struct clk *sys_ck; 153 struct clk *sys_ck;
154 u32 sys_clk_speed; 154 u32 sys_clk_speed;
155 155
156 sys_ck = clk_get(NULL, "sys_ck"); 156 if (cpu_is_omap34xx())
157 sys_ck = clk_get(NULL, "sys_ck");
158 else
159 sys_ck = clk_get(NULL, "sys_clkin_ck");
160
157 if (IS_ERR(sys_ck)) { 161 if (IS_ERR(sys_ck)) {
158 dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n", 162 dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n",
159 __func__); 163 __func__);
@@ -193,7 +197,7 @@ static void sr_set_regfields(struct omap_sr *sr)
193 * file or pmic specific data structure. In that case these structure 197 * file or pmic specific data structure. In that case these structure
194 * fields will have to be populated using the pdata or pmic structure. 198 * fields will have to be populated using the pdata or pmic structure.
195 */ 199 */
196 if (cpu_is_omap34xx()) { 200 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
197 sr->err_weight = OMAP3430_SR_ERRWEIGHT; 201 sr->err_weight = OMAP3430_SR_ERRWEIGHT;
198 sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT; 202 sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
199 sr->accum_data = OMAP3430_SR_ACCUMDATA; 203 sr->accum_data = OMAP3430_SR_ACCUMDATA;
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 9a3538fb633a..786d685c09a9 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/io.h>
23 24
24#include <plat/omap_device.h> 25#include <plat/omap_device.h>
25#include <plat/smartreflex.h> 26#include <plat/smartreflex.h>
@@ -51,7 +52,21 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
51 GFP_KERNEL); 52 GFP_KERNEL);
52 53
53 for (i = 0; i < count; i++) { 54 for (i = 0; i < count; i++) {
54 u32 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs); 55 u32 v;
56 /*
57 * In OMAP4 the efuse registers are 24 bit aligned.
58 * A __raw_readl will fail for non-32 bit aligned address
59 * and hence the 8-bit read and shift.
60 */
61 if (cpu_is_omap44xx()) {
62 u16 offset = volt_data[i].sr_efuse_offs;
63
64 v = omap_ctrl_readb(offset) |
65 omap_ctrl_readb(offset + 1) << 8 |
66 omap_ctrl_readb(offset + 2) << 16;
67 } else {
68 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
69 }
55 70
56 nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs; 71 nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs;
57 nvalue_table[i].nvalue = v; 72 nvalue_table[i].nvalue = v;
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index f4e05134aafa..11bf9f991509 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -37,7 +37,7 @@ config OMAP_DEBUG_LEDS
37 37
38config OMAP_SMARTREFLEX 38config OMAP_SMARTREFLEX
39 bool "SmartReflex support" 39 bool "SmartReflex support"
40 depends on ARCH_OMAP3 && PM 40 depends on (ARCH_OMAP3 || ARCH_OMAP4) && PM
41 help 41 help
42 Say Y if you want to enable SmartReflex. 42 Say Y if you want to enable SmartReflex.
43 43