Kevin Hilman had written, on 10/09/2009 04:37 PM, the following:
Nishanth Menon <[email protected]> writes:

Refactor the smart reflex implementation.

One other request for this refactor.

Can you remove the usage of OMAP2_IO_ADDRESS (now gone from l-o master)
in favor of ioremap().

Here's a totally untested first pass and converting the version
currently in PM branch.  Could probably use some better error
detection though, and I didn't look up exactly what size
should be ioremap'd.

Kevin


diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index 1407783..bf57b21 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -48,6 +48,7 @@ struct omap_sr {
        u32             opp1_nvalue, opp2_nvalue, opp3_nvalue, opp4_nvalue;
        u32             opp5_nvalue;
        u32             senp_mod, senn_mod;
+       u32             srbase_phys;
        void __iomem    *srbase_addr;
        void __iomem    *vpbase_addr;
 };
@@ -105,7 +106,7 @@ static struct omap_sr sr1 = {
        .is_sr_reset            = 1,
        .is_autocomp_active     = 0,
        .clk_length             = 0,
-       .srbase_addr            = OMAP2_IO_ADDRESS(OMAP34XX_SR1_BASE),
+       .srbase_phys            = OMAP34XX_SR1_BASE,
 };
static struct omap_sr sr2 = {
@@ -113,7 +114,7 @@ static struct omap_sr sr2 = {
        .is_sr_reset            = 1,
        .is_autocomp_active     = 0,
        .clk_length             = 0,
-       .srbase_addr            = OMAP2_IO_ADDRESS(OMAP34XX_SR2_BASE),
+       .srbase_phys            = OMAP34XX_SR2_BASE,
 };
static void cal_reciprocal(u32 sensor, u32 *sengain, u32 *rnsen)
@@ -987,6 +988,11 @@ static int __init omap3_sr_init(void)
                return -ENODEV;
         }
+ sr1.srbase_addr = ioremap(sr1.srbase_phys, SZ_4K);
+       sr2.srbase_addr = ioremap(sr2.srbase_phys, SZ_4K);
4K is more than sufficient.
+       if (WARN_ON(!sr1.srbase_addr) || WARN_ON(!sr2.srbase_addr))
+               return;
should'nt we return with -ENOMEM?
+
        /* Enable SR on T2 */
        ret = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &RdReg,
                                        R_DCDC_GLOBAL_CFG);


I can do the corresponding changes for SR v2 and post a v3 patch out.

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to