ARM: cache-l2x0: add device tree support for power control
Subsystems (2)
PATCH 1/1 ARM: cache-l2x0: add device tree support for power control
After version r3p0, cache pl310 has the power control register. Adding the device tree support for power control.
So it can parse the power control register settings.
--- Documentation/devicetree/bindings/arm/l2cc.txt | 6 ++++++ arch/arm/mm/cache-l2x0.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/arm/l2cc.txt +6 -0
@@ -34,6 +34,10 @@ Optional properties: - arm,filter-ranges : <start length> Starting address and length of window to filter. Addresses in the filter window are directed to the M1 port. Other addresses will go to the M0 port. +- arm,pwr-dynamic-clk-gating: If it is defined. The dynamic clock gating for + better power is enabled. Only availabe after r3p0. +- arm,pwr-standby-mode: If it is defined, standby mode is enabled. On available + after r3p0. - interrupts : 1 combined interrupt. - cache-id-part: cache id part number to be used if it is not present on hardware
@@ -47,6 +51,8 @@ L2: cache-controller { arm,data-latency = <1 1 1>; arm,tag-latency = <2 2 2>; arm,filter-ranges = <0x80000000 0x8000000>; + arm,pwr-dynamic-clk-gating; + arm,pwr-standby-mode; cache-unified; cache-level = <2>; interrupts = <45>;
arch/arm/mm/cache-l2x0.c +16 -0
@@ -564,6 +564,9 @@ static void __init pl310_of_setup(const struct device_node *np,u32 data[3 ] = {0 ,0 ,0 };u32 tag[3 ] = {0 ,0 ,0 };u32 filter[2 ] = {0 ,0 }; +u32 l2x0_revision; +u32 power; +const unsigned char *prop;of_property_read_u32_array (np,"arm,tag-latency" , tag,ARRAY_SIZE (tag));if (tag[0 ] && tag[1 ] && tag[2 ])
@@ -590,6 +593,19 @@ static void __init pl310_of_setup(const struct device_node *np,writel_relaxed ((filter[0 ] & ~(SZ_1M -1 )) |L2X0_ADDR_FILTER_EN , l2x0_base +L2X0_ADDR_FILTER_START ); } + + l2x0_revision =readl_relaxed (l2x0_base +L2X0_CACHE_ID ) & +L2X0_CACHE_ID_RTL_MASK ; +if (l2x0_revision >=L2X0_CACHE_ID_RTL_R3P0 ) { + power =0 ; + prop =of_get_property (np,"arm,pwr-dynamic-clk-gating" ,NULL ); +if (prop) + power |=L2X0_DYNAMIC_CLK_GATING_EN ; + prop =of_get_property (np,"arm,pwr-standby-mode" ,NULL ); +if (prop) + power |=L2X0_STNDBY_MODE_EN ; +writel_relaxed (power, l2x0_base +L2X0_POWER_CTRL ); + } }static void __init pl310_save (void )
Signature · 1 line
1.7.4.1
PATCH 1/1 ARM: cache-l2x0: add device tree support for power control
2013/2/27 Chao Xie <[email protected]>:
Quoted 72 lines
After version r3p0, cache pl310 has the power control register. Adding the device tree support for power control.
So it can parse the power control register settings.Signed-off-by Chao Xie <[email protected]>--- Documentation/devicetree/bindings/arm/l2cc.txt | 6 ++++++ arch/arm/mm/cache-l2x0.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)Documentation/devicetree/bindings/arm/l2cc.txt +6
-0@@ -34,6 +34,10 @@ Optional properties: - arm,filter-ranges : <start length> Starting address and length of window to filter. Addresses in the filter window are directed to the M1 port. Other addresses will go to the M0 port. +- arm,pwr-dynamic-clk-gating: If it is defined. The dynamic clock gating for + better power is enabled. Only availabe after r3p0. +- arm,pwr-standby-mode: If it is defined, standby mode is enabled. On available + after r3p0. - interrupts : 1 combined interrupt. - cache-id-part: cache id part number to be used if it is not present on hardware@@ -47,6 +51,8 @@ L2: cache-controller { arm,data-latency = <1 1 1>; arm,tag-latency = <2 2 2>; arm,filter-ranges = <0x80000000 0x8000000>; + arm,pwr-dynamic-clk-gating; + arm,pwr-standby-mode; cache-unified; cache-level = <2>; interrupts = <45>;arch/arm/mm/cache-l2x0.c +16
-1@@ -564,6 +564,9 @@ static void __init pl310_of_setup(const struct device_node *np,u32 data[3 ] = {0 ,0 ,0 };u32 tag[3 ] = {0 ,0 ,0 };u32 filter[2 ] = {0 ,0 }; +u32 l2x0_revision; +u32 power; +const unsigned char *prop;of_property_read_u32_array (np,"arm,tag-latency" , tag,ARRAY_SIZE (tag));if (tag[0 ] && tag[1 ] && tag[2 ])@@ -590,6 +593,19 @@ static void __init pl310_of_setup(const struct device_node *np,writel_relaxed ((filter[0 ] & ~(SZ_1M -1 )) |L2X0_ADDR_FILTER_EN , l2x0_base +L2X0_ADDR_FILTER_START ); } + + l2x0_revision =readl_relaxed (l2x0_base +L2X0_CACHE_ID ) & +L2X0_CACHE_ID_RTL_MASK ; +if (l2x0_revision >=L2X0_CACHE_ID_RTL_R3P0 ) { + power =0 ; + prop =of_get_property (np,"arm,pwr-dynamic-clk-gating" ,NULL ); +if (prop) + power |=L2X0_DYNAMIC_CLK_GATING_EN ; + prop =of_get_property (np,"arm,pwr-standby-mode" ,NULL ); +if (prop) + power |=L2X0_STNDBY_MODE_EN ; +writel_relaxed (power, l2x0_base +L2X0_POWER_CTRL ); + } }static void __init pl310_save (void ) --1.7.4.1
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/1 ARM: cache-l2x0: add device tree support for power control
In reply to Chao XieHi,
Quoted 15 lines · Chao Xie
After version r3p0, cache pl310 has the power control register. Adding the device tree support for power control.
So it can parse the power control register settings.Signed-off-by Chao Xie <[email protected]>--- Documentation/devicetree/bindings/arm/l2cc.txt | 6 ++++++ arch/arm/mm/cache-l2x0.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)Documentation/devicetree/bindings/arm/l2cc.txt +0
-0
Documentation/devicetree/bindings/arm/l2cc.txt Optional properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/arm/l2cc.txt +2
-0@@ -34,6 +34,10 @@ Optional properties: - arm,filter-ranges : <start length> Starting address and length of window to filter. Addresses in the filter window are directed to the M1 port. Other addresses will go to the M0 port. +- arm,pwr-dynamic-clk-gating: If it is defined. The dynamic clock gating for + better power is enabled. Only availabe after r3p0.
This appears to be a configuration option rather than a description of the hardware.
If we're able to know that this feature is present by reading the id register, we shouldn't need to describe it in the dt. We should simply work out if and when we want it enabled within the kernel.
Documentation/devicetree/bindings/arm/l2cc.txt Optional properties: · line 40
Quoted 2 lines
Documentation/devicetree/bindings/arm/l2cc.txt +2
-0+- arm,pwr-standby-mode: If it is defined, standby mode is enabled. On available + after r3p0.
This looks like it depends on an additional signal being wired up, so it may be worth describing.
Quoted 31 lines
Documentation/devicetree/bindings/arm/l2cc.txt +2
-0- interrupts : 1 combined interrupt. - cache-id-part: cache id part number to be used if it is not present on hardware@@ -47,6 +51,8 @@ L2: cache-controller { arm,data-latency = <1 1 1>; arm,tag-latency = <2 2 2>; arm,filter-ranges = <0x80000000 0x8000000>; + arm,pwr-dynamic-clk-gating; + arm,pwr-standby-mode; cache-unified; cache-level = <2>; interrupts = <45>;arch/arm/mm/cache-l2x0.c +4
-0@@ -564,6 +564,9 @@ static void __init pl310_of_setup(const struct device_node *np,u32 data[3 ] = {0 ,0 ,0 };u32 tag[3 ] = {0 ,0 ,0 };u32 filter[2 ] = {0 ,0 }; +u32 l2x0_revision; +u32 power; +const unsigned char *prop;of_property_read_u32_array (np,"arm,tag-latency" , tag,ARRAY_SIZE (tag));if (tag[0 ] && tag[1 ] && tag[2 ])@@ -590,6 +593,19 @@ static void __init pl310_of_setup(const struct device_node *np,writel_relaxed ((filter[0 ] & ~(SZ_1M -1 )) |L2X0_ADDR_FILTER_EN , l2x0_base +L2X0_ADDR_FILTER_START ); } +
arch/arm/mm/cache-l2x0.c static void __init pl310_of_setup(const struct device_node *np, · line 606
Quoted 10 lines
arch/arm/mm/cache-l2x0.c +10
-0+ l2x0_revision =readl_relaxed (l2x0_base +L2X0_CACHE_ID ) & +L2X0_CACHE_ID_RTL_MASK ; +if (l2x0_revision >=L2X0_CACHE_ID_RTL_R3P0 ) { + power =0 ; + prop =of_get_property (np,"arm,pwr-dynamic-clk-gating" ,NULL ); +if (prop) + power |=L2X0_DYNAMIC_CLK_GATING_EN ; + prop =of_get_property (np,"arm,pwr-standby-mode" ,NULL ); +if (prop) + power |=L2X0_STNDBY_MODE_EN ;
You can use of_property_read_bool for both of the above cases (and you won't need prop any more):
if (of_property_read_bool(np, "arm,pwr-standby-mode"))
power |= L2X0_STNDBY_MODE_EN;
If dt info isn't needed, this can probably be moved into l2x0_init.
Mark.
PATCH 1/1 ARM: cache-l2x0: add device tree support for power control
Quoted 27 lines
Hi,
On Wed, Feb 27, 2013 at 03:20:37AM +0000, Chao Xie wrote:
After version r3p0, cache pl310 has the power control register. Adding the device tree support for power control.
So it can parse the power control register settings.Signed-off-by Chao Xie <[email protected]>--- Documentation/devicetree/bindings/arm/l2cc.txt | 6 ++++++ arch/arm/mm/cache-l2x0.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)Documentation/devicetree/bindings/arm/l2cc.txt +2
-0@@ -34,6 +34,10 @@ Optional properties: - arm,filter-ranges : <start length> Starting address and length of window to filter. Addresses in the filter window are directed to the M1 port. Other addresses will go to the M0 port. +- arm,pwr-dynamic-clk-gating: If it is defined. The dynamic clock gating for + better power is enabled. Only availabe after r3p0.This appears to be a configuration option rather than a description of the hardware.
Quoted 3 lines
If we're able to know that this feature is present by reading the id register, we shouldn't need to describe it in the dt. We should simply work out if and when we want it enabled within the kernel.
So do you mean that I need directly enable these features and do not need provide the choice at DT?
Quoted 5 lines
+- arm,pwr-standby-mode: If it is defined, standby mode is enabled. On available + after r3p0.This looks like it depends on an additional signal being wired up, so it may be worth describing.
In fact I do know the details. I can only see PL310 spec that it added these features since r3p0.
Quoted 45 lines
- interrupts : 1 combined interrupt.
- cache-id-part: cache id part number to be used if it is not present on hardwareDocumentation/devicetree/bindings/arm/l2cc.txt +2
-0@@ -47,6 +51,8 @@ L2: cache-controller { arm,data-latency = <1 1 1>; arm,tag-latency = <2 2 2>; arm,filter-ranges = <0x80000000 0x8000000>; + arm,pwr-dynamic-clk-gating; + arm,pwr-standby-mode; cache-unified; cache-level = <2>; interrupts = <45>;arch/arm/mm/cache-l2x0.c +14
-0@@ -564,6 +564,9 @@ static void __init pl310_of_setup(const struct device_node *np,u32 data[3 ] = {0 ,0 ,0 };u32 tag[3 ] = {0 ,0 ,0 };u32 filter[2 ] = {0 ,0 }; +u32 l2x0_revision; +u32 power; +const unsigned char *prop;of_property_read_u32_array (np,"arm,tag-latency" , tag,ARRAY_SIZE (tag));if (tag[0 ] && tag[1 ] && tag[2 ])@@ -590,6 +593,19 @@ static void __init pl310_of_setup(const struct device_node *np,writel_relaxed ((filter[0 ] & ~(SZ_1M -1 )) |L2X0_ADDR_FILTER_EN , l2x0_base +L2X0_ADDR_FILTER_START ); } + + l2x0_revision =readl_relaxed (l2x0_base +L2X0_CACHE_ID ) & +L2X0_CACHE_ID_RTL_MASK ; +if (l2x0_revision >=L2X0_CACHE_ID_RTL_R3P0 ) { + power =0 ; + prop =of_get_property (np,"arm,pwr-dynamic-clk-gating" ,NULL ); +if (prop) + power |=L2X0_DYNAMIC_CLK_GATING_EN ; + prop =of_get_property (np,"arm,pwr-standby-mode" ,NULL ); +if (prop) + power |=L2X0_STNDBY_MODE_EN ;You can use
of_property_read_boolfor both of the above cases (and you won't need prop any more):
Quoted 4 lines
if (
of_property_read_bool(np, "arm,pwr-standby-mode"))power |= L2X0_STNDBY_MODE_EN;If dt info isn't needed, this can probably be moved into
l2x0_init.
Sure. If everyone want the power feature enabled, it can be moved to l2x0_init.
Quoted 1 line
Mark.