All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 0/5] ARM: shmobile: Add INTC-SYS clock to device tree
@ 2015-03-18 19:15 ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:15 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi,

This RFC patch series adds the INTC-SYS clock to the device tree on SoCs
that have such a clock (r8a73a4 and r8a779x). This clock is the module
clock for the GIC, and thus must not be disabled, as that would cause a
lock-up.

Currently, the GIC driver cannot enable the module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

I'm not sure about the parent clock of INTC-SYS, as this doesn't seem to
be documented in the SoC's user manuals. However, on r8a7740 it is
documented to be the ZSA (AXI) clock, so I used the ZS clock. The actual
clock and rate don't matter much, as the parent clock can't be
disabled.

As usual when involving clocks, the DTS changes depend stricly on the
driver change. Else the clock will be disabled as assumed unused,
breaking the boot.

The DTS changes depend on the series "[PATCH 0/7] ARM: shmobile: Add
IRQC clock to device tree" I've just sent.

This was tested on r8a73a4/ape6evm and r8a7791/koelsch.

Thanks for your comments!

Geert Uytterhoeven (5):
  [RFC] clk: shmobile: mstp: Never disable INTC-SYS
  [RFC] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree

 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 arch/arm/boot/dts/r8a7790.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7791.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7794.dtsi            |  7 ++++---
 drivers/clk/shmobile/clk-mstp.c           |  6 ++++++
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 include/dt-bindings/clock/r8a7790-clock.h |  1 +
 include/dt-bindings/clock/r8a7791-clock.h |  1 +
 include/dt-bindings/clock/r8a7794-clock.h |  1 +
 9 files changed, 29 insertions(+), 13 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 0/5] ARM: shmobile: Add INTC-SYS clock to device tree
@ 2015-03-18 19:15 ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:15 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

	Hi,

This RFC patch series adds the INTC-SYS clock to the device tree on SoCs
that have such a clock (r8a73a4 and r8a779x). This clock is the module
clock for the GIC, and thus must not be disabled, as that would cause a
lock-up.

Currently, the GIC driver cannot enable the module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

I'm not sure about the parent clock of INTC-SYS, as this doesn't seem to
be documented in the SoC's user manuals. However, on r8a7740 it is
documented to be the ZSA (AXI) clock, so I used the ZS clock. The actual
clock and rate don't matter much, as the parent clock can't be
disabled.

As usual when involving clocks, the DTS changes depend stricly on the
driver change. Else the clock will be disabled as assumed unused,
breaking the boot.

The DTS changes depend on the series "[PATCH 0/7] ARM: shmobile: Add
IRQC clock to device tree" I've just sent.

This was tested on r8a73a4/ape6evm and r8a7791/koelsch.

Thanks for your comments!

Geert Uytterhoeven (5):
  [RFC] clk: shmobile: mstp: Never disable INTC-SYS
  [RFC] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree

 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 arch/arm/boot/dts/r8a7790.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7791.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7794.dtsi            |  7 ++++---
 drivers/clk/shmobile/clk-mstp.c           |  6 ++++++
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 include/dt-bindings/clock/r8a7790-clock.h |  1 +
 include/dt-bindings/clock/r8a7791-clock.h |  1 +
 include/dt-bindings/clock/r8a7794-clock.h |  1 +
 9 files changed, 29 insertions(+), 13 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 0/5] ARM: shmobile: Add INTC-SYS clock to device tree
@ 2015-03-18 19:15 ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:15 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi,

This RFC patch series adds the INTC-SYS clock to the device tree on SoCs
that have such a clock (r8a73a4 and r8a779x). This clock is the module
clock for the GIC, and thus must not be disabled, as that would cause a
lock-up.

Currently, the GIC driver cannot enable the module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

I'm not sure about the parent clock of INTC-SYS, as this doesn't seem to
be documented in the SoC's user manuals. However, on r8a7740 it is
documented to be the ZSA (AXI) clock, so I used the ZS clock. The actual
clock and rate don't matter much, as the parent clock can't be
disabled.

As usual when involving clocks, the DTS changes depend stricly on the
driver change. Else the clock will be disabled as assumed unused,
breaking the boot.

The DTS changes depend on the series "[PATCH 0/7] ARM: shmobile: Add
IRQC clock to device tree" I've just sent.

This was tested on r8a73a4/ape6evm and r8a7791/koelsch.

Thanks for your comments!

Geert Uytterhoeven (5):
  [RFC] clk: shmobile: mstp: Never disable INTC-SYS
  [RFC] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
  [RFC] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree

 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 arch/arm/boot/dts/r8a7790.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7791.dtsi            |  7 ++++---
 arch/arm/boot/dts/r8a7794.dtsi            |  7 ++++---
 drivers/clk/shmobile/clk-mstp.c           |  6 ++++++
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 include/dt-bindings/clock/r8a7790-clock.h |  1 +
 include/dt-bindings/clock/r8a7791-clock.h |  1 +
 include/dt-bindings/clock/r8a7794-clock.h |  1 +
 9 files changed, 29 insertions(+), 13 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-18 19:15 ` Geert Uytterhoeven
  (?)
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
disabled causes:

    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

Currently, the GIC driver cannot enable its module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/shmobile/clk-mstp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index 2d2fe773ac8168f9..742af84735a07450 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
 	unsigned int i;
 	u32 value;
 
+	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
+	if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
+		pr_debug("MSTP %pC skipping disable\n", hw->clk);
+		return 0;
+	}
+
 	spin_lock_irqsave(&group->lock, flags);
 
 	value = clk_readl(group->smstpcr);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
disabled causes:

    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

Currently, the GIC driver cannot enable its module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/shmobile/clk-mstp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index 2d2fe773ac8168f9..742af84735a07450 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
 	unsigned int i;
 	u32 value;
 
+	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
+	if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
+		pr_debug("MSTP %pC skipping disable\n", hw->clk);
+		return 0;
+	}
+
 	spin_lock_irqsave(&group->lock, flags);
 
 	value = clk_readl(group->smstpcr);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
disabled causes:

    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

Currently, the GIC driver cannot enable its module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    explicitly enable the clock,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a quirk to the MSTP
clock driver to make sure the module clock is never disabled.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/shmobile/clk-mstp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index 2d2fe773ac8168f9..742af84735a07450 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
 	unsigned int i;
 	u32 value;
 
+	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
+	if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
+		pr_debug("MSTP %pC skipping disable\n", hw->clk);
+		return 0;
+	}
+
 	spin_lock_irqsave(&group->lock, flags);
 
 	value = clk_readl(group->smstpcr);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 2/5] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
  2015-03-18 19:15 ` Geert Uytterhoeven
  (?)
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 7ee22a41c6c97488..76618a911b9a4e7a 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -443,6 +443,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A73A4_CLK_INTC_SYS>;
 	};
 
 	bsc: bus@fec10000 {
@@ -726,16 +727,18 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&main_div2_clk>, <&main_div2_clk>,
+			clocks = <&main_div2_clk>, <&cpg_clocks R8A73A4_CLK_ZS>,
+				 <&main_div2_clk>,
 				 <&cpg_clocks R8A73A4_CLK_HP>,
 				 <&cpg_clocks R8A73A4_CLK_HP>;
 			#clock-cells = <1>;
 			clock-indices = <
-				R8A73A4_CLK_IRQC R8A73A4_CLK_IIC5
-				R8A73A4_CLK_IIC4 R8A73A4_CLK_IIC3
+				R8A73A4_CLK_IRQC R8A73A4_CLK_INTC_SYS
+				R8A73A4_CLK_IIC5 R8A73A4_CLK_IIC4
+				R8A73A4_CLK_IIC3
 			>;
 			clock-output-names -				"irqc", "iic5", "iic4", "iic3";
+				"irqc", "intc-sys", "iic5", "iic4", "iic3";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a73a4-clock.h b/include/dt-bindings/clock/r8a73a4-clock.h
index dd11ecdf837e8e65..4b36681572570c15 100644
--- a/include/dt-bindings/clock/r8a73a4-clock.h
+++ b/include/dt-bindings/clock/r8a73a4-clock.h
@@ -54,6 +54,7 @@
 #define R8A73A4_CLK_IIC3	11
 #define R8A73A4_CLK_IIC4	10
 #define R8A73A4_CLK_IIC5	9
+#define R8A73A4_CLK_INTC_SYS	8
 #define R8A73A4_CLK_IRQC	7
 
 /* MSTP5 */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 2/5] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 7ee22a41c6c97488..76618a911b9a4e7a 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -443,6 +443,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A73A4_CLK_INTC_SYS>;
 	};
 
 	bsc: bus@fec10000 {
@@ -726,16 +727,18 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&main_div2_clk>, <&main_div2_clk>,
+			clocks = <&main_div2_clk>, <&cpg_clocks R8A73A4_CLK_ZS>,
+				 <&main_div2_clk>,
 				 <&cpg_clocks R8A73A4_CLK_HP>,
 				 <&cpg_clocks R8A73A4_CLK_HP>;
 			#clock-cells = <1>;
 			clock-indices = <
-				R8A73A4_CLK_IRQC R8A73A4_CLK_IIC5
-				R8A73A4_CLK_IIC4 R8A73A4_CLK_IIC3
+				R8A73A4_CLK_IRQC R8A73A4_CLK_INTC_SYS
+				R8A73A4_CLK_IIC5 R8A73A4_CLK_IIC4
+				R8A73A4_CLK_IIC3
 			>;
 			clock-output-names =
-				"irqc", "iic5", "iic4", "iic3";
+				"irqc", "intc-sys", "iic5", "iic4", "iic3";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a73a4-clock.h b/include/dt-bindings/clock/r8a73a4-clock.h
index dd11ecdf837e8e65..4b36681572570c15 100644
--- a/include/dt-bindings/clock/r8a73a4-clock.h
+++ b/include/dt-bindings/clock/r8a73a4-clock.h
@@ -54,6 +54,7 @@
 #define R8A73A4_CLK_IIC3	11
 #define R8A73A4_CLK_IIC4	10
 #define R8A73A4_CLK_IIC5	9
+#define R8A73A4_CLK_INTC_SYS	8
 #define R8A73A4_CLK_IRQC	7
 
 /* MSTP5 */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 2/5] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a73a4.dtsi            | 11 +++++++----
 include/dt-bindings/clock/r8a73a4-clock.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 7ee22a41c6c97488..76618a911b9a4e7a 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -443,6 +443,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A73A4_CLK_INTC_SYS>;
 	};
 
 	bsc: bus at fec10000 {
@@ -726,16 +727,18 @@
 		mstp4_clks: mstp4_clks at e6150140 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&main_div2_clk>, <&main_div2_clk>,
+			clocks = <&main_div2_clk>, <&cpg_clocks R8A73A4_CLK_ZS>,
+				 <&main_div2_clk>,
 				 <&cpg_clocks R8A73A4_CLK_HP>,
 				 <&cpg_clocks R8A73A4_CLK_HP>;
 			#clock-cells = <1>;
 			clock-indices = <
-				R8A73A4_CLK_IRQC R8A73A4_CLK_IIC5
-				R8A73A4_CLK_IIC4 R8A73A4_CLK_IIC3
+				R8A73A4_CLK_IRQC R8A73A4_CLK_INTC_SYS
+				R8A73A4_CLK_IIC5 R8A73A4_CLK_IIC4
+				R8A73A4_CLK_IIC3
 			>;
 			clock-output-names =
-				"irqc", "iic5", "iic4", "iic3";
+				"irqc", "intc-sys", "iic5", "iic4", "iic3";
 		};
 		mstp5_clks: mstp5_clks at e6150144 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a73a4-clock.h b/include/dt-bindings/clock/r8a73a4-clock.h
index dd11ecdf837e8e65..4b36681572570c15 100644
--- a/include/dt-bindings/clock/r8a73a4-clock.h
+++ b/include/dt-bindings/clock/r8a73a4-clock.h
@@ -54,6 +54,7 @@
 #define R8A73A4_CLK_IIC3	11
 #define R8A73A4_CLK_IIC4	10
 #define R8A73A4_CLK_IIC5	9
+#define R8A73A4_CLK_INTC_SYS	8
 #define R8A73A4_CLK_IRQC	7
 
 /* MSTP5 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 3/5] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
  2015-03-18 19:15 ` Geert Uytterhoeven
  (?)
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7790.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7790-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index a81cfda0872fc30a..d4210f5b692a42b5 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -122,6 +122,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7790_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio@e6050000 {
@@ -1162,10 +1163,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7790_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7790_CLK_IRQC R8A7790_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index ff7ca3584e169589..49419ee93aed825e 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -81,6 +81,7 @@
 
 /* MSTP4 */
 #define R8A7790_CLK_IRQC		7
+#define R8A7790_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7790_CLK_AUDIO_DMAC1		1
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 3/5] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7790.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7790-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index a81cfda0872fc30a..d4210f5b692a42b5 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -122,6 +122,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7790_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio@e6050000 {
@@ -1162,10 +1163,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7790_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7790_CLK_IRQC R8A7790_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index ff7ca3584e169589..49419ee93aed825e 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -81,6 +81,7 @@
 
 /* MSTP4 */
 #define R8A7790_CLK_IRQC		7
+#define R8A7790_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7790_CLK_AUDIO_DMAC1		1
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 3/5] ARM: shmobile: r8a7790: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7790.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7790-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index a81cfda0872fc30a..d4210f5b692a42b5 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -122,6 +122,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7790_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio at e6050000 {
@@ -1162,10 +1163,10 @@
 		mstp4_clks: mstp4_clks at e6150140 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7790_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7790_CLK_IRQC R8A7790_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks at e6150144 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index ff7ca3584e169589..49419ee93aed825e 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -81,6 +81,7 @@
 
 /* MSTP4 */
 #define R8A7790_CLK_IRQC		7
+#define R8A7790_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7790_CLK_AUDIO_DMAC1		1
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 4/5] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
  2015-03-18 19:15 ` Geert Uytterhoeven
  (?)
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7791.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7791-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 20ab7668088493b9..9191acce98a6eeb2 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -79,6 +79,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7791_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio@e6050000 {
@@ -1164,10 +1165,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7791_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7791_CLK_IRQC R8A7791_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 402268384b99093c..102b47a797116dce 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -72,6 +72,7 @@
 
 /* MSTP4 */
 #define R8A7791_CLK_IRQC		7
+#define R8A7791_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7791_CLK_AUDIO_DMAC1		1
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 4/5] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7791.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7791-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 20ab7668088493b9..9191acce98a6eeb2 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -79,6 +79,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7791_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio@e6050000 {
@@ -1164,10 +1165,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7791_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7791_CLK_IRQC R8A7791_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 402268384b99093c..102b47a797116dce 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -72,6 +72,7 @@
 
 /* MSTP4 */
 #define R8A7791_CLK_IRQC		7
+#define R8A7791_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7791_CLK_AUDIO_DMAC1		1
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 4/5] ARM: shmobile: r8a7791: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7791.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7791-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 20ab7668088493b9..9191acce98a6eeb2 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -79,6 +79,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7791_CLK_INTC_SYS>;
 	};
 
 	gpio0: gpio at e6050000 {
@@ -1164,10 +1165,10 @@
 		mstp4_clks: mstp4_clks at e6150140 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7791_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7791_CLK_IRQC R8A7791_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp5_clks: mstp5_clks at e6150144 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 402268384b99093c..102b47a797116dce 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -72,6 +72,7 @@
 
 /* MSTP4 */
 #define R8A7791_CLK_IRQC		7
+#define R8A7791_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7791_CLK_AUDIO_DMAC1		1
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 5/5] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree
  2015-03-18 19:15 ` Geert Uytterhoeven
  (?)
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7794.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7794-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 01cf54f70501e8c2..5667d284a3f0af92 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -48,6 +48,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7794_CLK_INTC_SYS>;
 	};
 
 	cmt0: timer@ffca0000 {
@@ -629,10 +630,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7794_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7794_CLK_IRQC R8A7794_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp7_clks: mstp7_clks@e615014c {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
index 09da38a58776b403..3ea8cea7d3e79d87 100644
--- a/include/dt-bindings/clock/r8a7794-clock.h
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -62,6 +62,7 @@
 
 /* MSTP4 */
 #define R8A7794_CLK_IRQC		7
+#define R8A7794_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7794_CLK_THERMAL		22
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 5/5] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7794.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7794-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 01cf54f70501e8c2..5667d284a3f0af92 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -48,6 +48,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7794_CLK_INTC_SYS>;
 	};
 
 	cmt0: timer@ffca0000 {
@@ -629,10 +630,10 @@
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7794_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7794_CLK_IRQC R8A7794_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp7_clks: mstp7_clks@e615014c {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
index 09da38a58776b403..3ea8cea7d3e79d87 100644
--- a/include/dt-bindings/clock/r8a7794-clock.h
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -62,6 +62,7 @@
 
 /* MSTP4 */
 #define R8A7794_CLK_IRQC		7
+#define R8A7794_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7794_CLK_THERMAL		22
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH/RFC 5/5] ARM: shmobile: r8a7794: Add INTC-SYS clock to device tree
@ 2015-03-18 19:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-18 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Link the ARM GIC to the INTC-SYS module clock, so it can be power
managed using that clock in the future.

Note that currently the GIC driver doesn't support module clocks nor
Runtime PM.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/boot/dts/r8a7794.dtsi            | 7 ++++---
 include/dt-bindings/clock/r8a7794-clock.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 01cf54f70501e8c2..5667d284a3f0af92 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -48,6 +48,7 @@
 			<0 0xf1004000 0 0x2000>,
 			<0 0xf1006000 0 0x2000>;
 		interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		clocks = <&mstp4_clks R8A7794_CLK_INTC_SYS>;
 	};
 
 	cmt0: timer at ffca0000 {
@@ -629,10 +630,10 @@
 		mstp4_clks: mstp4_clks at e6150140 {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&cp_clk>;
+			clocks = <&cp_clk>, <&zs_clk>;
 			#clock-cells = <1>;
-			clock-indices = <R8A7794_CLK_IRQC>;
-			clock-output-names = "irqc";
+			clock-indices = <R8A7794_CLK_IRQC R8A7794_CLK_INTC_SYS>;
+			clock-output-names = "irqc", "intc-sys";
 		};
 		mstp7_clks: mstp7_clks at e615014c {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
index 09da38a58776b403..3ea8cea7d3e79d87 100644
--- a/include/dt-bindings/clock/r8a7794-clock.h
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -62,6 +62,7 @@
 
 /* MSTP4 */
 #define R8A7794_CLK_IRQC		7
+#define R8A7794_CLK_INTC_SYS		8
 
 /* MSTP5 */
 #define R8A7794_CLK_THERMAL		22
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-18 19:16   ` Geert Uytterhoeven
  (?)
@ 2015-03-24 23:25     ` Michael Turquette
  -1 siblings, 0 replies; 33+ messages in thread
From: Michael Turquette @ 2015-03-24 23:25 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
> disabled causes:
> 
>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
> 
> Currently, the GIC driver cannot enable its module clock for several
> reasons:
>   - It does not use a platform device, so Runtime PM is not an option,
>   - gic_of_init() runs before any clocks are registered, so it cannot
>     explicitly enable the clock,
>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>     doesn't support deferred probing.
> 
> Hence we have to keep on relying on the boot loader for enabling the
> module clock.
> 
> To prevent the module clock from being disabled when the CCF core thinks
> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-24 23:25     ` Michael Turquette
  0 siblings, 0 replies; 33+ messages in thread
From: Michael Turquette @ 2015-03-24 23:25 UTC (permalink / raw)
  To: Stephen Boyd, Simon Horman, Magnus Damm, Marc Zyngier
  Cc: linux-arm-kernel, linux-sh, linux-pm, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
> disabled causes:
> 
>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
> 
> Currently, the GIC driver cannot enable its module clock for several
> reasons:
>   - It does not use a platform device, so Runtime PM is not an option,
>   - gic_of_init() runs before any clocks are registered, so it cannot
>     explicitly enable the clock,
>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>     doesn't support deferred probing.
> 
> Hence we have to keep on relying on the boot loader for enabling the
> module clock.
> 
> To prevent the module clock from being disabled when the CCF core thinks
> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-24 23:25     ` Michael Turquette
  0 siblings, 0 replies; 33+ messages in thread
From: Michael Turquette @ 2015-03-24 23:25 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
> disabled causes:
> 
>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
> 
> Currently, the GIC driver cannot enable its module clock for several
> reasons:
>   - It does not use a platform device, so Runtime PM is not an option,
>   - gic_of_init() runs before any clocks are registered, so it cannot
>     explicitly enable the clock,
>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>     doesn't support deferred probing.
> 
> Hence we have to keep on relying on the boot loader for enabling the
> module clock.
> 
> To prevent the module clock from being disabled when the CCF core thinks
> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-24 23:25     ` Michael Turquette
  (?)
@ 2015-03-25  4:17       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25  4:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mike,

On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
<mturquette@linaro.org> wrote:
> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>> disabled causes:
>>
>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>
>> Currently, the GIC driver cannot enable its module clock for several
>> reasons:
>>   - It does not use a platform device, so Runtime PM is not an option,
>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>     explicitly enable the clock,
>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>     doesn't support deferred probing.
>>
>> Hence we have to keep on relying on the boot loader for enabling the
>> module clock.
>>
>> To prevent the module clock from being disabled when the CCF core thinks
>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>> clock driver to make sure the module clock is never disabled.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>> index 2d2fe773ac8168f9..742af84735a07450 100644
>> --- a/drivers/clk/shmobile/clk-mstp.c
>> +++ b/drivers/clk/shmobile/clk-mstp.c
>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>         unsigned int i;
>>         u32 value;
>>
>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>> +               return 0;
>> +       }
>
> Hello Geert,
>
> This is a bit ugly for three reasons:
>
> 1) we hit this code for every MSTP clock {en,dis}able call
> 2) __clk_get_name is kind of gross

Sure, this is ugly. That's why this was an RFC.
I was mainly trying to trigger a reply from the GIC maintainers ;-)

> 3) the enable_count will not be correct. It will be zero but the clock
> will actually be enabled

That's indeed something I didn't take into account. Will change to just enabling
the clock from the clock driver.

> Have you considered Lee's series to express these always-on clocks in
> DT? See,
>
> https://lkml.org/lkml/2015/2/24/495

That solution doesn't apply here, as we do have a correct description
of the hardware
in DT (after the other patches in the series, like e.g. (courtesy for
Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25  4:17       ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25  4:17 UTC (permalink / raw)
  To: Michael Turquette
  Cc: Geert Uytterhoeven, Stephen Boyd, Simon Horman, Magnus Damm,
	Marc Zyngier, linux-arm-kernel, Linux-sh list, Linux PM list,
	Lee Jones

Hi Mike,

On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
<mturquette@linaro.org> wrote:
> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>> disabled causes:
>>
>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>
>> Currently, the GIC driver cannot enable its module clock for several
>> reasons:
>>   - It does not use a platform device, so Runtime PM is not an option,
>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>     explicitly enable the clock,
>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>     doesn't support deferred probing.
>>
>> Hence we have to keep on relying on the boot loader for enabling the
>> module clock.
>>
>> To prevent the module clock from being disabled when the CCF core thinks
>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>> clock driver to make sure the module clock is never disabled.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>> index 2d2fe773ac8168f9..742af84735a07450 100644
>> --- a/drivers/clk/shmobile/clk-mstp.c
>> +++ b/drivers/clk/shmobile/clk-mstp.c
>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>         unsigned int i;
>>         u32 value;
>>
>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>> +               return 0;
>> +       }
>
> Hello Geert,
>
> This is a bit ugly for three reasons:
>
> 1) we hit this code for every MSTP clock {en,dis}able call
> 2) __clk_get_name is kind of gross

Sure, this is ugly. That's why this was an RFC.
I was mainly trying to trigger a reply from the GIC maintainers ;-)

> 3) the enable_count will not be correct. It will be zero but the clock
> will actually be enabled

That's indeed something I didn't take into account. Will change to just enabling
the clock from the clock driver.

> Have you considered Lee's series to express these always-on clocks in
> DT? See,
>
> https://lkml.org/lkml/2015/2/24/495

That solution doesn't apply here, as we do have a correct description
of the hardware
in DT (after the other patches in the series, like e.g. (courtesy for
Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25  4:17       ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25  4:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mike,

On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
<mturquette@linaro.org> wrote:
> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>> disabled causes:
>>
>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>
>> Currently, the GIC driver cannot enable its module clock for several
>> reasons:
>>   - It does not use a platform device, so Runtime PM is not an option,
>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>     explicitly enable the clock,
>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>     doesn't support deferred probing.
>>
>> Hence we have to keep on relying on the boot loader for enabling the
>> module clock.
>>
>> To prevent the module clock from being disabled when the CCF core thinks
>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>> clock driver to make sure the module clock is never disabled.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>> index 2d2fe773ac8168f9..742af84735a07450 100644
>> --- a/drivers/clk/shmobile/clk-mstp.c
>> +++ b/drivers/clk/shmobile/clk-mstp.c
>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>         unsigned int i;
>>         u32 value;
>>
>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>> +               return 0;
>> +       }
>
> Hello Geert,
>
> This is a bit ugly for three reasons:
>
> 1) we hit this code for every MSTP clock {en,dis}able call
> 2) __clk_get_name is kind of gross

Sure, this is ugly. That's why this was an RFC.
I was mainly trying to trigger a reply from the GIC maintainers ;-)

> 3) the enable_count will not be correct. It will be zero but the clock
> will actually be enabled

That's indeed something I didn't take into account. Will change to just enabling
the clock from the clock driver.

> Have you considered Lee's series to express these always-on clocks in
> DT? See,
>
> https://lkml.org/lkml/2015/2/24/495

That solution doesn't apply here, as we do have a correct description
of the hardware
in DT (after the other patches in the series, like e.g. (courtesy for
Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-25  4:17       ` Geert Uytterhoeven
  (?)
@ 2015-03-25  9:21         ` Marc Zyngier
  -1 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-25  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 25/03/15 04:17, Geert Uytterhoeven wrote:
> Hi Mike,
> 
> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
> <mturquette@linaro.org> wrote:
>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>> disabled causes:
>>>
>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>
>>> Currently, the GIC driver cannot enable its module clock for several
>>> reasons:
>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>     explicitly enable the clock,
>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>     doesn't support deferred probing.
>>>
>>> Hence we have to keep on relying on the boot loader for enabling the
>>> module clock.
>>>
>>> To prevent the module clock from being disabled when the CCF core thinks
>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>> clock driver to make sure the module clock is never disabled.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>         unsigned int i;
>>>         u32 value;
>>>
>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>> +               return 0;
>>> +       }
>>
>> Hello Geert,
>>
>> This is a bit ugly for three reasons:
>>
>> 1) we hit this code for every MSTP clock {en,dis}able call
>> 2) __clk_get_name is kind of gross
> 
> Sure, this is ugly. That's why this was an RFC.
> I was mainly trying to trigger a reply from the GIC maintainers ;-)

Given that I'm the only GIC-related person on the cc list, I suppose
this is puts me on the spot.

This doesn't touch the GIC code at all, so I don't feel completely
adverse to it. My only gripe is with the undocumented clock property in
the binding, and that leads to two questions:

- the GIC architecture doesn't mention a clock at all, so that's a
Renesas special. Do we want to have a vendor-specific property for this?
Or does it belong elsewhere?
- alternatively, do we want the core GIC code to deal with this? In
which case, how do we express the policy?

Thanks,

	M.

>> 3) the enable_count will not be correct. It will be zero but the clock
>> will actually be enabled
> 
> That's indeed something I didn't take into account. Will change to just enabling
> the clock from the clock driver.
> 
>> Have you considered Lee's series to express these always-on clocks in
>> DT? See,
>>
>> https://lkml.org/lkml/2015/2/24/495
> 
> That solution doesn't apply here, as we do have a correct description
> of the hardware
> in DT (after the other patches in the series, like e.g. (courtesy for
> Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25  9:21         ` Marc Zyngier
  0 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-25  9:21 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette
  Cc: Geert Uytterhoeven, Stephen Boyd, Simon Horman, Magnus Damm,
	linux-arm-kernel, Linux-sh list, Linux PM list, Lee Jones,
	Mark Rutland

On 25/03/15 04:17, Geert Uytterhoeven wrote:
> Hi Mike,
> 
> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
> <mturquette@linaro.org> wrote:
>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>> disabled causes:
>>>
>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>
>>> Currently, the GIC driver cannot enable its module clock for several
>>> reasons:
>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>     explicitly enable the clock,
>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>     doesn't support deferred probing.
>>>
>>> Hence we have to keep on relying on the boot loader for enabling the
>>> module clock.
>>>
>>> To prevent the module clock from being disabled when the CCF core thinks
>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>> clock driver to make sure the module clock is never disabled.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>         unsigned int i;
>>>         u32 value;
>>>
>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>> +               return 0;
>>> +       }
>>
>> Hello Geert,
>>
>> This is a bit ugly for three reasons:
>>
>> 1) we hit this code for every MSTP clock {en,dis}able call
>> 2) __clk_get_name is kind of gross
> 
> Sure, this is ugly. That's why this was an RFC.
> I was mainly trying to trigger a reply from the GIC maintainers ;-)

Given that I'm the only GIC-related person on the cc list, I suppose
this is puts me on the spot.

This doesn't touch the GIC code at all, so I don't feel completely
adverse to it. My only gripe is with the undocumented clock property in
the binding, and that leads to two questions:

- the GIC architecture doesn't mention a clock at all, so that's a
Renesas special. Do we want to have a vendor-specific property for this?
Or does it belong elsewhere?
- alternatively, do we want the core GIC code to deal with this? In
which case, how do we express the policy?

Thanks,

	M.

>> 3) the enable_count will not be correct. It will be zero but the clock
>> will actually be enabled
> 
> That's indeed something I didn't take into account. Will change to just enabling
> the clock from the clock driver.
> 
>> Have you considered Lee's series to express these always-on clocks in
>> DT? See,
>>
>> https://lkml.org/lkml/2015/2/24/495
> 
> That solution doesn't apply here, as we do have a correct description
> of the hardware
> in DT (after the other patches in the series, like e.g. (courtesy for
> Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25  9:21         ` Marc Zyngier
  0 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-25  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 25/03/15 04:17, Geert Uytterhoeven wrote:
> Hi Mike,
> 
> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
> <mturquette@linaro.org> wrote:
>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>> disabled causes:
>>>
>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>
>>> Currently, the GIC driver cannot enable its module clock for several
>>> reasons:
>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>     explicitly enable the clock,
>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>     doesn't support deferred probing.
>>>
>>> Hence we have to keep on relying on the boot loader for enabling the
>>> module clock.
>>>
>>> To prevent the module clock from being disabled when the CCF core thinks
>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>> clock driver to make sure the module clock is never disabled.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>         unsigned int i;
>>>         u32 value;
>>>
>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>> +               return 0;
>>> +       }
>>
>> Hello Geert,
>>
>> This is a bit ugly for three reasons:
>>
>> 1) we hit this code for every MSTP clock {en,dis}able call
>> 2) __clk_get_name is kind of gross
> 
> Sure, this is ugly. That's why this was an RFC.
> I was mainly trying to trigger a reply from the GIC maintainers ;-)

Given that I'm the only GIC-related person on the cc list, I suppose
this is puts me on the spot.

This doesn't touch the GIC code at all, so I don't feel completely
adverse to it. My only gripe is with the undocumented clock property in
the binding, and that leads to two questions:

- the GIC architecture doesn't mention a clock at all, so that's a
Renesas special. Do we want to have a vendor-specific property for this?
Or does it belong elsewhere?
- alternatively, do we want the core GIC code to deal with this? In
which case, how do we express the policy?

Thanks,

	M.

>> 3) the enable_count will not be correct. It will be zero but the clock
>> will actually be enabled
> 
> That's indeed something I didn't take into account. Will change to just enabling
> the clock from the clock driver.
> 
>> Have you considered Lee's series to express these always-on clocks in
>> DT? See,
>>
>> https://lkml.org/lkml/2015/2/24/495
> 
> That solution doesn't apply here, as we do have a correct description
> of the hardware
> in DT (after the other patches in the series, like e.g. (courtesy for
> Lee) http://permalink.gmane.org/gmane.linux.power-management.general/58123).
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-25  9:21         ` Marc Zyngier
  (?)
@ 2015-03-25 21:19           ` Geert Uytterhoeven
  -1 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25 21:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

On Wed, Mar 25, 2015 at 10:21 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On 25/03/15 04:17, Geert Uytterhoeven wrote:
>> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
>> <mturquette@linaro.org> wrote:
>>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>>> disabled causes:
>>>>
>>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>>
>>>> Currently, the GIC driver cannot enable its module clock for several
>>>> reasons:
>>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>>     explicitly enable the clock,
>>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>>     doesn't support deferred probing.
>>>>
>>>> Hence we have to keep on relying on the boot loader for enabling the
>>>> module clock.
>>>>
>>>> To prevent the module clock from being disabled when the CCF core thinks
>>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>>> clock driver to make sure the module clock is never disabled.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>> ---
>>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>>         unsigned int i;
>>>>         u32 value;
>>>>
>>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>>> +               return 0;
>>>> +       }
>>>
>>> Hello Geert,
>>>
>>> This is a bit ugly for three reasons:
>>>
>>> 1) we hit this code for every MSTP clock {en,dis}able call
>>> 2) __clk_get_name is kind of gross
>>
>> Sure, this is ugly. That's why this was an RFC.
>> I was mainly trying to trigger a reply from the GIC maintainers ;-)
>
> Given that I'm the only GIC-related person on the cc list, I suppose
> this is puts me on the spot.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> This doesn't touch the GIC code at all, so I don't feel completely

The reason no GIC code is touched (for now), is that it's non-trivial to
fix the GIC driver to handle this.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> - the GIC architecture doesn't mention a clock at all, so that's a
> Renesas special. Do we want to have a vendor-specific property for this?
> Or does it belong elsewhere?

Apart from being implemented using synchronous logic and thus using a
clock signal internally, the GIC and its driver don't care about this clock.

When an existing IP module that doesn't care about clocks becomes reused
on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
Domain or Clock Domain, or both), this "PM Domain" is a feature of the
platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
GIC falls in the same category as the Thermal Module example).
Hence I don't think it's necessary to mention this in the ARM GIC binding.

> - alternatively, do we want the core GIC code to deal with this? In
> which case, how do we express the policy?

The proper way to handle this automatically is to add Runtime PM support
to the driver. However, this requires using a platform device.

I would like to add the clock and GIC dependency on the clock in the DTS now,
for reasons of DTS stability. But that means I need a temporary workaround
to avoid the clock from being disabled, until the GIC driver handles this.

I don't expect a fix for the GIC code to just show up magically. I just wanted
you to be aware of the problem. GIC is not the only problematic module here,
there are others, cfr. the last slide of [2].

Thanks!

References:
Presentations at ELC2015:
  [1] "Last one out, turn off the lights", by Geert Uytterhoeven
(http://events.linuxfoundation.org/sites/events/files/slides/Last_One_Out_Turn_Off_The_Lights_Handouts.pdf)
  [2] "Introduction to Kernel Power Managemen", by Kevin Hilman (still
to appear at http://events.linuxfoundation.org/events/embedded-linux-conference/program/slides)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25 21:19           ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25 21:19 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Michael Turquette, Geert Uytterhoeven, Stephen Boyd,
	Simon Horman, Magnus Damm, linux-arm-kernel, Linux-sh list,
	Linux PM list, Lee Jones, Mark Rutland

Hi Marc,

On Wed, Mar 25, 2015 at 10:21 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On 25/03/15 04:17, Geert Uytterhoeven wrote:
>> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
>> <mturquette@linaro.org> wrote:
>>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>>> disabled causes:
>>>>
>>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>>
>>>> Currently, the GIC driver cannot enable its module clock for several
>>>> reasons:
>>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>>     explicitly enable the clock,
>>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>>     doesn't support deferred probing.
>>>>
>>>> Hence we have to keep on relying on the boot loader for enabling the
>>>> module clock.
>>>>
>>>> To prevent the module clock from being disabled when the CCF core thinks
>>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>>> clock driver to make sure the module clock is never disabled.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>> ---
>>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>>         unsigned int i;
>>>>         u32 value;
>>>>
>>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>>> +               return 0;
>>>> +       }
>>>
>>> Hello Geert,
>>>
>>> This is a bit ugly for three reasons:
>>>
>>> 1) we hit this code for every MSTP clock {en,dis}able call
>>> 2) __clk_get_name is kind of gross
>>
>> Sure, this is ugly. That's why this was an RFC.
>> I was mainly trying to trigger a reply from the GIC maintainers ;-)
>
> Given that I'm the only GIC-related person on the cc list, I suppose
> this is puts me on the spot.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> This doesn't touch the GIC code at all, so I don't feel completely

The reason no GIC code is touched (for now), is that it's non-trivial to
fix the GIC driver to handle this.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> - the GIC architecture doesn't mention a clock at all, so that's a
> Renesas special. Do we want to have a vendor-specific property for this?
> Or does it belong elsewhere?

Apart from being implemented using synchronous logic and thus using a
clock signal internally, the GIC and its driver don't care about this clock.

When an existing IP module that doesn't care about clocks becomes reused
on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
Domain or Clock Domain, or both), this "PM Domain" is a feature of the
platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
GIC falls in the same category as the Thermal Module example).
Hence I don't think it's necessary to mention this in the ARM GIC binding.

> - alternatively, do we want the core GIC code to deal with this? In
> which case, how do we express the policy?

The proper way to handle this automatically is to add Runtime PM support
to the driver. However, this requires using a platform device.

I would like to add the clock and GIC dependency on the clock in the DTS now,
for reasons of DTS stability. But that means I need a temporary workaround
to avoid the clock from being disabled, until the GIC driver handles this.

I don't expect a fix for the GIC code to just show up magically. I just wanted
you to be aware of the problem. GIC is not the only problematic module here,
there are others, cfr. the last slide of [2].

Thanks!

References:
Presentations at ELC2015:
  [1] "Last one out, turn off the lights", by Geert Uytterhoeven
(http://events.linuxfoundation.org/sites/events/files/slides/Last_One_Out_Turn_Off_The_Lights_Handouts.pdf)
  [2] "Introduction to Kernel Power Managemen", by Kevin Hilman (still
to appear at http://events.linuxfoundation.org/events/embedded-linux-conference/program/slides)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-25 21:19           ` Geert Uytterhoeven
  0 siblings, 0 replies; 33+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25 21:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

On Wed, Mar 25, 2015 at 10:21 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On 25/03/15 04:17, Geert Uytterhoeven wrote:
>> On Wed, Mar 25, 2015 at 12:25 AM, Michael Turquette
>> <mturquette@linaro.org> wrote:
>>> Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
>>>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>>>> disabled causes:
>>>>
>>>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>>>
>>>> Currently, the GIC driver cannot enable its module clock for several
>>>> reasons:
>>>>   - It does not use a platform device, so Runtime PM is not an option,
>>>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>>>     explicitly enable the clock,
>>>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>>>     doesn't support deferred probing.
>>>>
>>>> Hence we have to keep on relying on the boot loader for enabling the
>>>> module clock.
>>>>
>>>> To prevent the module clock from being disabled when the CCF core thinks
>>>> it is unused, and thus causing a system lock-up, add a quirk to the MSTP
>>>> clock driver to make sure the module clock is never disabled.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>> ---
>>>>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
>>>> index 2d2fe773ac8168f9..742af84735a07450 100644
>>>> --- a/drivers/clk/shmobile/clk-mstp.c
>>>> +++ b/drivers/clk/shmobile/clk-mstp.c
>>>> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>>>>         unsigned int i;
>>>>         u32 value;
>>>>
>>>> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
>>>> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
>>>> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
>>>> +               return 0;
>>>> +       }
>>>
>>> Hello Geert,
>>>
>>> This is a bit ugly for three reasons:
>>>
>>> 1) we hit this code for every MSTP clock {en,dis}able call
>>> 2) __clk_get_name is kind of gross
>>
>> Sure, this is ugly. That's why this was an RFC.
>> I was mainly trying to trigger a reply from the GIC maintainers ;-)
>
> Given that I'm the only GIC-related person on the cc list, I suppose
> this is puts me on the spot.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> This doesn't touch the GIC code at all, so I don't feel completely

The reason no GIC code is touched (for now), is that it's non-trivial to
fix the GIC driver to handle this.

> adverse to it. My only gripe is with the undocumented clock property in
> the binding, and that leads to two questions:
> - the GIC architecture doesn't mention a clock at all, so that's a
> Renesas special. Do we want to have a vendor-specific property for this?
> Or does it belong elsewhere?

Apart from being implemented using synchronous logic and thus using a
clock signal internally, the GIC and its driver don't care about this clock.

When an existing IP module that doesn't care about clocks becomes reused
on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
Domain or Clock Domain, or both), this "PM Domain" is a feature of the
platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
GIC falls in the same category as the Thermal Module example).
Hence I don't think it's necessary to mention this in the ARM GIC binding.

> - alternatively, do we want the core GIC code to deal with this? In
> which case, how do we express the policy?

The proper way to handle this automatically is to add Runtime PM support
to the driver. However, this requires using a platform device.

I would like to add the clock and GIC dependency on the clock in the DTS now,
for reasons of DTS stability. But that means I need a temporary workaround
to avoid the clock from being disabled, until the GIC driver handles this.

I don't expect a fix for the GIC code to just show up magically. I just wanted
you to be aware of the problem. GIC is not the only problematic module here,
there are others, cfr. the last slide of [2].

Thanks!

References:
Presentations at ELC2015:
  [1] "Last one out, turn off the lights", by Geert Uytterhoeven
(http://events.linuxfoundation.org/sites/events/files/slides/Last_One_Out_Turn_Off_The_Lights_Handouts.pdf)
  [2] "Introduction to Kernel Power Managemen", by Kevin Hilman (still
to appear at http://events.linuxfoundation.org/events/embedded-linux-conference/program/slides)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
  2015-03-25 21:19           ` Geert Uytterhoeven
  (?)
@ 2015-03-26 10:39             ` Marc Zyngier
  -1 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-26 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Geert,

On 25/03/15 21:19, Geert Uytterhoeven wrote:

[...]

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> This doesn't touch the GIC code at all, so I don't feel completely
> 
> The reason no GIC code is touched (for now), is that it's non-trivial to
> fix the GIC driver to handle this.

Indeed.  The interrupt controller is basically the first device to be
activated in the life of the system, and I can see a nasty chicken and
egg problem creeping up if you're trying to do clock management in a
generic way at that level.

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> - the GIC architecture doesn't mention a clock at all, so that's a
>> Renesas special. Do we want to have a vendor-specific property for this?
>> Or does it belong elsewhere?
> 
> Apart from being implemented using synchronous logic and thus using a
> clock signal internally, the GIC and its driver don't care about this clock.
> 
> When an existing IP module that doesn't care about clocks becomes reused
> on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
> Domain or Clock Domain, or both), this "PM Domain" is a feature of the
> platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
> GIC falls in the same category as the Thermal Module example).
> Hence I don't think it's necessary to mention this in the ARM GIC binding.
> 
>> - alternatively, do we want the core GIC code to deal with this? In
>> which case, how do we express the policy?
> 
> The proper way to handle this automatically is to add Runtime PM support
> to the driver. However, this requires using a platform device.
> 
> I would like to add the clock and GIC dependency on the clock in the DTS now,
> for reasons of DTS stability. But that means I need a temporary workaround
> to avoid the clock from being disabled, until the GIC driver handles this.
> 
> I don't expect a fix for the GIC code to just show up magically. I just wanted
> you to be aware of the problem. GIC is not the only problematic module here,
> there are others, cfr. the last slide of [2].

As long as there is an agreement from the DT people on the presence of
that extra property in the GIC node, I'm happy with that. I'd like it to
be documented though.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-26 10:39             ` Marc Zyngier
  0 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-26 10:39 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Geert Uytterhoeven, Stephen Boyd,
	Simon Horman, Magnus Damm, linux-arm-kernel, Linux-sh list,
	Linux PM list, Lee Jones, Mark Rutland

Hi Geert,

On 25/03/15 21:19, Geert Uytterhoeven wrote:

[...]

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> This doesn't touch the GIC code at all, so I don't feel completely
> 
> The reason no GIC code is touched (for now), is that it's non-trivial to
> fix the GIC driver to handle this.

Indeed.  The interrupt controller is basically the first device to be
activated in the life of the system, and I can see a nasty chicken and
egg problem creeping up if you're trying to do clock management in a
generic way at that level.

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> - the GIC architecture doesn't mention a clock at all, so that's a
>> Renesas special. Do we want to have a vendor-specific property for this?
>> Or does it belong elsewhere?
> 
> Apart from being implemented using synchronous logic and thus using a
> clock signal internally, the GIC and its driver don't care about this clock.
> 
> When an existing IP module that doesn't care about clocks becomes reused
> on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
> Domain or Clock Domain, or both), this "PM Domain" is a feature of the
> platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
> GIC falls in the same category as the Thermal Module example).
> Hence I don't think it's necessary to mention this in the ARM GIC binding.
> 
>> - alternatively, do we want the core GIC code to deal with this? In
>> which case, how do we express the policy?
> 
> The proper way to handle this automatically is to add Runtime PM support
> to the driver. However, this requires using a platform device.
> 
> I would like to add the clock and GIC dependency on the clock in the DTS now,
> for reasons of DTS stability. But that means I need a temporary workaround
> to avoid the clock from being disabled, until the GIC driver handles this.
> 
> I don't expect a fix for the GIC code to just show up magically. I just wanted
> you to be aware of the problem. GIC is not the only problematic module here,
> there are others, cfr. the last slide of [2].

As long as there is an agreement from the DT people on the presence of
that extra property in the GIC node, I'm happy with that. I'd like it to
be documented though.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
@ 2015-03-26 10:39             ` Marc Zyngier
  0 siblings, 0 replies; 33+ messages in thread
From: Marc Zyngier @ 2015-03-26 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Geert,

On 25/03/15 21:19, Geert Uytterhoeven wrote:

[...]

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> This doesn't touch the GIC code at all, so I don't feel completely
> 
> The reason no GIC code is touched (for now), is that it's non-trivial to
> fix the GIC driver to handle this.

Indeed.  The interrupt controller is basically the first device to be
activated in the life of the system, and I can see a nasty chicken and
egg problem creeping up if you're trying to do clock management in a
generic way at that level.

>> adverse to it. My only gripe is with the undocumented clock property in
>> the binding, and that leads to two questions:
>> - the GIC architecture doesn't mention a clock at all, so that's a
>> Renesas special. Do we want to have a vendor-specific property for this?
>> Or does it belong elsewhere?
> 
> Apart from being implemented using synchronous logic and thus using a
> clock signal internally, the GIC and its driver don't care about this clock.
> 
> When an existing IP module that doesn't care about clocks becomes reused
> on a new SoC, and it now ends up being part of a "PM Domain" (e.g. a Power
> Domain or Clock Domain, or both), this "PM Domain" is a feature of the
> platform, not of the IP module itself (cfr. "(Existing) Device Driver" in [1];
> GIC falls in the same category as the Thermal Module example).
> Hence I don't think it's necessary to mention this in the ARM GIC binding.
> 
>> - alternatively, do we want the core GIC code to deal with this? In
>> which case, how do we express the policy?
> 
> The proper way to handle this automatically is to add Runtime PM support
> to the driver. However, this requires using a platform device.
> 
> I would like to add the clock and GIC dependency on the clock in the DTS now,
> for reasons of DTS stability. But that means I need a temporary workaround
> to avoid the clock from being disabled, until the GIC driver handles this.
> 
> I don't expect a fix for the GIC code to just show up magically. I just wanted
> you to be aware of the problem. GIC is not the only problematic module here,
> there are others, cfr. the last slide of [2].

As long as there is an agreement from the DT people on the presence of
that extra property in the GIC node, I'm happy with that. I'd like it to
be documented though.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2015-03-26 10:39 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 19:15 [PATCH/RFC 0/5] ARM: shmobile: Add INTC-SYS clock to device tree Geert Uytterhoeven
2015-03-18 19:15 ` Geert Uytterhoeven
2015-03-18 19:15 ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-24 23:25   ` Michael Turquette
2015-03-24 23:25     ` Michael Turquette
2015-03-24 23:25     ` Michael Turquette
2015-03-25  4:17     ` Geert Uytterhoeven
2015-03-25  4:17       ` Geert Uytterhoeven
2015-03-25  4:17       ` Geert Uytterhoeven
2015-03-25  9:21       ` Marc Zyngier
2015-03-25  9:21         ` Marc Zyngier
2015-03-25  9:21         ` Marc Zyngier
2015-03-25 21:19         ` Geert Uytterhoeven
2015-03-25 21:19           ` Geert Uytterhoeven
2015-03-25 21:19           ` Geert Uytterhoeven
2015-03-26 10:39           ` Marc Zyngier
2015-03-26 10:39             ` Marc Zyngier
2015-03-26 10:39             ` Marc Zyngier
2015-03-18 19:16 ` [PATCH/RFC 2/5] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 3/5] ARM: shmobile: r8a7790: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 4/5] ARM: shmobile: r8a7791: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 5/5] ARM: shmobile: r8a7794: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.