OMAP4: Smartreflex framework extensions
authorThara Gopinath <thara@ti.com>
Wed, 18 Aug 2010 06:53:12 +0000 (12:23 +0530)
committerKevin Hilman <khilman@deeprootsystems.com>
Wed, 22 Dec 2010 22:31:50 +0000 (14:31 -0800)
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>
arch/arm/mach-omap2/smartreflex.c
arch/arm/mach-omap2/sr_device.c
arch/arm/plat-omap/Kconfig

index 52a05b336c0827ef544a4451b75b86be3abe0834..77ecebf3fae2013feb786029b83c2f36d2db9cf9 100644 (file)
@@ -153,7 +153,11 @@ static void sr_set_clk_length(struct omap_sr *sr)
        struct clk *sys_ck;
        u32 sys_clk_speed;
 
-       sys_ck = clk_get(NULL, "sys_ck");
+       if (cpu_is_omap34xx())
+               sys_ck = clk_get(NULL, "sys_ck");
+       else
+               sys_ck = clk_get(NULL, "sys_clkin_ck");
+
        if (IS_ERR(sys_ck)) {
                dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n",
                        __func__);
@@ -193,7 +197,7 @@ static void sr_set_regfields(struct omap_sr *sr)
         * file or pmic specific data structure. In that case these structure
         * fields will have to be populated using the pdata or pmic structure.
         */
-       if (cpu_is_omap34xx()) {
+       if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
                sr->err_weight = OMAP3430_SR_ERRWEIGHT;
                sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
                sr->accum_data = OMAP3430_SR_ACCUMDATA;
index 9a3538fb633a1b055cb56e6865eb7c83df1c94f6..786d685c09a92a7f91a5cd51669e2de71ce782bc 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/io.h>
 
 #include <plat/omap_device.h>
 #include <plat/smartreflex.h>
@@ -51,7 +52,21 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
                        GFP_KERNEL);
 
        for (i = 0; i < count; i++) {
-               u32 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
+               u32 v;
+               /*
+                * 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.
+                */
+               if (cpu_is_omap44xx()) {
+                       u16 offset = volt_data[i].sr_efuse_offs;
+
+                       v = omap_ctrl_readb(offset) |
+                               omap_ctrl_readb(offset + 1) << 8 |
+                               omap_ctrl_readb(offset + 2) << 16;
+               } else {
+                        v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
+               }
 
                nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs;
                nvalue_table[i].nvalue = v;
index f4e05134aafac42125a844a9dffd481470f1a17b..11bf9f991509ed97a72b8027dbb2f33982716cce 100644 (file)
@@ -37,7 +37,7 @@ config OMAP_DEBUG_LEDS
 
 config OMAP_SMARTREFLEX
        bool "SmartReflex support"
-       depends on ARCH_OMAP3 && PM
+       depends on (ARCH_OMAP3 || ARCH_OMAP4) && PM
        help
          Say Y if you want to enable SmartReflex.