]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: 8569/1: pl2x0: Add OF control of cache power management
authorBrad Mouring <brad.mouring@ni.com>
Thu, 28 Apr 2016 16:00:52 +0000 (17:00 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 5 May 2016 18:02:10 +0000 (19:02 +0100)
Add ability to override power management bits of 310 controllers
(dynamic clock gating and standby mode) through OF entries. As the
saved register is only applied when working on a supported controller,
it is safe to save the settings.

In order to maintain existing behavior, if the settings are not found
in the DT, the corresponding feature will be enabled.

Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/cache-l2x0.c

index 9f9d54271aada77708a954622269eec73000dc92..c61996c256cc4fa8c84609f5d4c5944b0ce337ce 100644 (file)
@@ -647,11 +647,6 @@ static void __init l2c310_enable(void __iomem *base, unsigned num_lock)
                aux &= ~(L310_AUX_CTRL_FULL_LINE_ZERO | L310_AUX_CTRL_EARLY_BRESP);
        }
 
-       /* r3p0 or later has power control register */
-       if (rev >= L310_CACHE_ID_RTL_R3P0)
-               l2x0_saved_regs.pwr_ctrl = L310_DYNAMIC_CLK_GATING_EN |
-                                               L310_STNDBY_MODE_EN;
-
        /*
         * Always enable non-secure access to the lockdown registers -
         * we write to them as part of the L2C enable sequence so they
@@ -1141,6 +1136,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
        u32 filter[2] = { 0, 0 };
        u32 assoc;
        u32 prefetch;
+       u32 power;
        u32 val;
        int ret;
 
@@ -1271,6 +1267,26 @@ static void __init l2c310_of_parse(const struct device_node *np,
        }
 
        l2x0_saved_regs.prefetch_ctrl = prefetch;
+
+       power = l2x0_saved_regs.pwr_ctrl |
+               L310_DYNAMIC_CLK_GATING_EN | L310_STNDBY_MODE_EN;
+
+       ret = of_property_read_u32(np, "arm,dynamic-clock-gating", &val);
+       if (!ret) {
+               if (!val)
+                       power &= ~L310_DYNAMIC_CLK_GATING_EN;
+       } else if (ret != -EINVAL) {
+               pr_err("L2C-310 OF dynamic-clock-gating property value is missing or invalid\n");
+       }
+       ret = of_property_read_u32(np, "arm,standby-mode", &val);
+       if (!ret) {
+               if (!val)
+                       power &= ~L310_STNDBY_MODE_EN;
+       } else if (ret != -EINVAL) {
+               pr_err("L2C-310 OF standby-mode property value is missing or invalid\n");
+       }
+
+       l2x0_saved_regs.pwr_ctrl = power;
 }
 
 static const struct l2c_init_data of_l2c310_data __initconst = {