All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-07-13  9:32 ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

This series add GPT timer support for mt8173. This is based on v4.2-rc1
and Matthias' next branch (for dts parts).

The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
series [1]. I decide to move these 2 patches to this series, since it
is more relevent here. They are changed based on Matthias' and Daniel's
comments.

[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

Daniel Kurtz (1):
  arm64: dts: mt8173: add timer node

Yingjoe Chen (4):
  clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  clocksource: mediatek: Use GPT as sched clock source
  arm64: mediatek: enable MTK_TIMER
  clk: mediatek: add 13mhz clock for MT8173

 arch/arm64/Kconfig                       |  1 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
 drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
 drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
 include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
 5 files changed, 37 insertions(+), 7 deletions(-)


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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-07-13  9:32 ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

This series add GPT timer support for mt8173. This is based on v4.2-rc1
and Matthias' next branch (for dts parts).

The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
series [1]. I decide to move these 2 patches to this series, since it
is more relevent here. They are changed based on Matthias' and Daniel's
comments.

[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

Daniel Kurtz (1):
  arm64: dts: mt8173: add timer node

Yingjoe Chen (4):
  clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  clocksource: mediatek: Use GPT as sched clock source
  arm64: mediatek: enable MTK_TIMER
  clk: mediatek: add 13mhz clock for MT8173

 arch/arm64/Kconfig                       |  1 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
 drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
 drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
 include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
 5 files changed, 37 insertions(+), 7 deletions(-)

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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-07-13  9:32 ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

This series add GPT timer support for mt8173. This is based on v4.2-rc1
and Matthias' next branch (for dts parts).

The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
series [1]. I decide to move these 2 patches to this series, since it
is more relevent here. They are changed based on Matthias' and Daniel's
comments.

[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

Daniel Kurtz (1):
  arm64: dts: mt8173: add timer node

Yingjoe Chen (4):
  clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  clocksource: mediatek: Use GPT as sched clock source
  arm64: mediatek: enable MTK_TIMER
  clk: mediatek: add 13mhz clock for MT8173

 arch/arm64/Kconfig                       |  1 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
 drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
 drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
 include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
 5 files changed, 37 insertions(+), 7 deletions(-)

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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-07-13  9:32 ` Yingjoe Chen
  (?)
@ 2015-07-13  9:32   ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..237c20b 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
+			    u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty


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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..237c20b 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
+			    u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty

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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..237c20b 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
+			    u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty

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

* [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

When cpu is in deep idle, arch timer will stop counting. Setup GPT as
sched clock source so it can keep counting in idle.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 237c20b..ae95b29 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -24,6 +24,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/sched_clock.h>
 #include <linux/slab.h>
 
 #define GPT_IRQ_EN_REG		0x00
@@ -59,6 +60,13 @@ struct mtk_clock_event_device {
 	struct clock_event_device dev;
 };
 
+static void __iomem *gpt_sched_reg __read_mostly;
+
+static u64 notrace mtk_read_sched_clock(void)
+{
+	return readl_relaxed(gpt_sched_reg);
+}
+
 static inline struct mtk_clock_event_device *to_mtk_clk(
 				struct clock_event_device *c)
 {
@@ -242,6 +250,8 @@ static void __init mtk_timer_init(struct device_node *node)
 	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
+	gpt_sched_reg = evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC);
+	sched_clock_register(mtk_read_sched_clock, 32, rate);
 
 	/* Configure clock event */
 	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
-- 
1.8.1.1.dirty


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

* [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, Yingjoe Chen,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

When cpu is in deep idle, arch timer will stop counting. Setup GPT as
sched clock source so it can keep counting in idle.

Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
 drivers/clocksource/mtk_timer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 237c20b..ae95b29 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -24,6 +24,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/sched_clock.h>
 #include <linux/slab.h>
 
 #define GPT_IRQ_EN_REG		0x00
@@ -59,6 +60,13 @@ struct mtk_clock_event_device {
 	struct clock_event_device dev;
 };
 
+static void __iomem *gpt_sched_reg __read_mostly;
+
+static u64 notrace mtk_read_sched_clock(void)
+{
+	return readl_relaxed(gpt_sched_reg);
+}
+
 static inline struct mtk_clock_event_device *to_mtk_clk(
 				struct clock_event_device *c)
 {
@@ -242,6 +250,8 @@ static void __init mtk_timer_init(struct device_node *node)
 	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
+	gpt_sched_reg = evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC);
+	sched_clock_register(mtk_read_sched_clock, 32, rate);
 
 	/* Configure clock event */
 	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
-- 
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

When cpu is in deep idle, arch timer will stop counting. Setup GPT as
sched clock source so it can keep counting in idle.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 237c20b..ae95b29 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -24,6 +24,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/sched_clock.h>
 #include <linux/slab.h>
 
 #define GPT_IRQ_EN_REG		0x00
@@ -59,6 +60,13 @@ struct mtk_clock_event_device {
 	struct clock_event_device dev;
 };
 
+static void __iomem *gpt_sched_reg __read_mostly;
+
+static u64 notrace mtk_read_sched_clock(void)
+{
+	return readl_relaxed(gpt_sched_reg);
+}
+
 static inline struct mtk_clock_event_device *to_mtk_clk(
 				struct clock_event_device *c)
 {
@@ -242,6 +250,8 @@ static void __init mtk_timer_init(struct device_node *node)
 	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
+	gpt_sched_reg = evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC);
+	sched_clock_register(mtk_read_sched_clock, 32, rate);
 
 	/* Configure clock event */
 	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
-- 
1.8.1.1.dirty

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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
  2015-07-13  9:32 ` Yingjoe Chen
  (?)
@ 2015-07-13  9:32   ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Enable MTK_TIMER for MediaTek plaform, which will be used as
schedule clock.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm64/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 0f6edb1..5934f51 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -193,6 +193,7 @@ config ARCH_MEDIATEK
 	bool "Mediatek MT65xx & MT81xx ARMv8 SoC"
 	select ARM_GIC
 	select PINCTRL
+	select MTK_TIMER
 	help
 	  Support for Mediatek MT65xx & MT81xx ARMv8 SoCs
 
-- 
1.8.1.1.dirty


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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Enable MTK_TIMER for MediaTek plaform, which will be used as
schedule clock.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm64/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 0f6edb1..5934f51 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -193,6 +193,7 @@ config ARCH_MEDIATEK
 	bool "Mediatek MT65xx & MT81xx ARMv8 SoC"
 	select ARM_GIC
 	select PINCTRL
+	select MTK_TIMER
 	help
 	  Support for Mediatek MT65xx & MT81xx ARMv8 SoCs
 
-- 
1.8.1.1.dirty

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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

Enable MTK_TIMER for MediaTek plaform, which will be used as
schedule clock.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm64/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 0f6edb1..5934f51 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -193,6 +193,7 @@ config ARCH_MEDIATEK
 	bool "Mediatek MT65xx & MT81xx ARMv8 SoC"
 	select ARM_GIC
 	select PINCTRL
+	select MTK_TIMER
 	help
 	  Support for Mediatek MT65xx & MT81xx ARMv8 SoCs
 
-- 
1.8.1.1.dirty

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

* [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
  2015-07-13  9:32 ` Yingjoe Chen
  (?)
@ 2015-07-13  9:32   ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Add 13mhz clock used by GPT timer in infracfg.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
 include/dt-bindings/clock/mt8173-clk.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
index 4b9e04c..540c5c3 100644
--- a/drivers/clk/mediatek/clk-mt8173.c
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
 	GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
 };
 
+static const struct mtk_fixed_factor infra_divs[] __initconst = {
+	FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
+};
+
 static const struct mtk_gate_regs peri0_cg_regs = {
 	.set_ofs = 0x0008,
 	.clr_ofs = 0x0010,
@@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
 
 	mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
 						clk_data);
+	mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
 
 	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
 	if (r)
diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
index 4ad76ed..fa2a2bb 100644
--- a/include/dt-bindings/clock/mt8173-clk.h
+++ b/include/dt-bindings/clock/mt8173-clk.h
@@ -187,7 +187,8 @@
 #define CLK_INFRA_CEC			9
 #define CLK_INFRA_PMICSPI		10
 #define CLK_INFRA_PMICWRAP		11
-#define CLK_INFRA_NR_CLK		12
+#define CLK_INFRA_CLK_13M		12
+#define CLK_INFRA_NR_CLK		13
 
 /* PERI_SYS */
 
-- 
1.8.1.1.dirty


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

* [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

Add 13mhz clock used by GPT timer in infracfg.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
 include/dt-bindings/clock/mt8173-clk.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
index 4b9e04c..540c5c3 100644
--- a/drivers/clk/mediatek/clk-mt8173.c
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
 	GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
 };
 
+static const struct mtk_fixed_factor infra_divs[] __initconst = {
+	FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
+};
+
 static const struct mtk_gate_regs peri0_cg_regs = {
 	.set_ofs = 0x0008,
 	.clr_ofs = 0x0010,
@@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
 
 	mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
 						clk_data);
+	mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
 
 	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
 	if (r)
diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
index 4ad76ed..fa2a2bb 100644
--- a/include/dt-bindings/clock/mt8173-clk.h
+++ b/include/dt-bindings/clock/mt8173-clk.h
@@ -187,7 +187,8 @@
 #define CLK_INFRA_CEC			9
 #define CLK_INFRA_PMICSPI		10
 #define CLK_INFRA_PMICWRAP		11
-#define CLK_INFRA_NR_CLK		12
+#define CLK_INFRA_CLK_13M		12
+#define CLK_INFRA_NR_CLK		13
 
 /* PERI_SYS */
 
-- 
1.8.1.1.dirty

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

* [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

Add 13mhz clock used by GPT timer in infracfg.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
 include/dt-bindings/clock/mt8173-clk.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
index 4b9e04c..540c5c3 100644
--- a/drivers/clk/mediatek/clk-mt8173.c
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
 	GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
 };
 
+static const struct mtk_fixed_factor infra_divs[] __initconst = {
+	FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
+};
+
 static const struct mtk_gate_regs peri0_cg_regs = {
 	.set_ofs = 0x0008,
 	.clr_ofs = 0x0010,
@@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
 
 	mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
 						clk_data);
+	mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
 
 	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
 	if (r)
diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
index 4ad76ed..fa2a2bb 100644
--- a/include/dt-bindings/clock/mt8173-clk.h
+++ b/include/dt-bindings/clock/mt8173-clk.h
@@ -187,7 +187,8 @@
 #define CLK_INFRA_CEC			9
 #define CLK_INFRA_PMICSPI		10
 #define CLK_INFRA_PMICWRAP		11
-#define CLK_INFRA_NR_CLK		12
+#define CLK_INFRA_CLK_13M		12
+#define CLK_INFRA_NR_CLK		13
 
 /* PERI_SYS */
 
-- 
1.8.1.1.dirty

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

* [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, Yingjoe Chen, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk, Eddie Huang

From: Daniel Kurtz <djkurtz@chromium.org>

Add device node to enable GPT timer. This timer will be
used as sched clock source.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 0696f8f..04bdd8f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -219,6 +219,15 @@
 			reg = <0 0x10007000 0 0x100>;
 		};
 
+		timer: timer@10008000 {
+			compatible = "mediatek,mt8173-timer",
+				     "mediatek,mt6577-timer";
+			reg = <0 0x10008000 0 0x1000>;
+			interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&infracfg CLK_INFRA_CLK_13M>,
+				 <&topckgen CLK_TOP_RTC_SEL>;
+		};
+
 		pwrap: pwrap@1000d000 {
 			compatible = "mediatek,mt8173-pwrap";
 			reg = <0 0x1000d000 0 0x1000>;
-- 
1.8.1.1.dirty


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

* [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, Yingjoe Chen,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA, Eddie Huang

From: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Add device node to enable GPT timer. This timer will be
used as sched clock source.

Signed-off-by: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Signed-off-by: Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 0696f8f..04bdd8f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -219,6 +219,15 @@
 			reg = <0 0x10007000 0 0x100>;
 		};
 
+		timer: timer@10008000 {
+			compatible = "mediatek,mt8173-timer",
+				     "mediatek,mt6577-timer";
+			reg = <0 0x10008000 0 0x1000>;
+			interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&infracfg CLK_INFRA_CLK_13M>,
+				 <&topckgen CLK_TOP_RTC_SEL>;
+		};
+
 		pwrap: pwrap@1000d000 {
 			compatible = "mediatek,mt8173-pwrap";
 			reg = <0 0x1000d000 0 0x1000>;
-- 
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-13  9:32   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-13  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

From: Daniel Kurtz <djkurtz@chromium.org>

Add device node to enable GPT timer. This timer will be
used as sched clock source.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 0696f8f..04bdd8f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -219,6 +219,15 @@
 			reg = <0 0x10007000 0 0x100>;
 		};
 
+		timer: timer at 10008000 {
+			compatible = "mediatek,mt8173-timer",
+				     "mediatek,mt6577-timer";
+			reg = <0 0x10008000 0 0x1000>;
+			interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&infracfg CLK_INFRA_CLK_13M>,
+				 <&topckgen CLK_TOP_RTC_SEL>;
+		};
+
 		pwrap: pwrap at 1000d000 {
 			compatible = "mediatek,mt8173-pwrap";
 			reg = <0 0x1000d000 0 0x1000>;
-- 
1.8.1.1.dirty

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

* Re: [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On 07/13, Yingjoe Chen wrote:
> Add 13mhz clock used by GPT timer in infracfg.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On 07/13, Yingjoe Chen wrote:
> Add 13mhz clock used by GPT timer in infracfg.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---

Acked-by: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/13, Yingjoe Chen wrote:
> Add 13mhz clock used by GPT timer in infracfg.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On 07/13, Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On 07/13, Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---

Acked-by: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-14  0:40     ` Stephen Boyd
  0 siblings, 0 replies; 131+ messages in thread
From: Stephen Boyd @ 2015-07-14  0:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/13, Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 5/5] arm64: dts: mt8173: add timer node
  2015-07-13  9:32   ` Yingjoe Chen
  (?)
@ 2015-07-14  4:26     ` Daniel Kurtz
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:26 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk, Eddie Huang

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> Add device node to enable GPT timer. This timer will be
> used as sched clock source.
>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

This binding needs documentation.

> ---
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 0696f8f..04bdd8f 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -219,6 +219,15 @@
>                         reg = <0 0x10007000 0 0x100>;
>                 };
>
> +               timer: timer@10008000 {
> +                       compatible = "mediatek,mt8173-timer",
> +                                    "mediatek,mt6577-timer";
> +                       reg = <0 0x10008000 0 0x1000>;
> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
> +                                <&topckgen CLK_TOP_RTC_SEL>;

Why two clocks?  The driver only uses one.
Please use a clock-names property.

Thanks,
-Dan

> +               };
> +
>                 pwrap: pwrap@1000d000 {
>                         compatible = "mediatek,mt8173-pwrap";
>                         reg = <0 0x1000d000 0 0x1000>;
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:26     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:26 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk, Eddie Huang

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> Add device node to enable GPT timer. This timer will be
> used as sched clock source.
>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

This binding needs documentation.

> ---
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 0696f8f..04bdd8f 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -219,6 +219,15 @@
>                         reg = <0 0x10007000 0 0x100>;
>                 };
>
> +               timer: timer@10008000 {
> +                       compatible = "mediatek,mt8173-timer",
> +                                    "mediatek,mt6577-timer";
> +                       reg = <0 0x10008000 0 0x1000>;
> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
> +                                <&topckgen CLK_TOP_RTC_SEL>;

Why two clocks?  The driver only uses one.
Please use a clock-names property.

Thanks,
-Dan

> +               };
> +
>                 pwrap: pwrap@1000d000 {
>                         compatible = "mediatek,mt8173-pwrap";
>                         reg = <0 0x1000d000 0 0x1000>;
> --
> 1.8.1.1.dirty
>

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

* [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:26     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> Add device node to enable GPT timer. This timer will be
> used as sched clock source.
>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

This binding needs documentation.

> ---
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 0696f8f..04bdd8f 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -219,6 +219,15 @@
>                         reg = <0 0x10007000 0 0x100>;
>                 };
>
> +               timer: timer at 10008000 {
> +                       compatible = "mediatek,mt8173-timer",
> +                                    "mediatek,mt6577-timer";
> +                       reg = <0 0x10008000 0 0x1000>;
> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
> +                                <&topckgen CLK_TOP_RTC_SEL>;

Why two clocks?  The driver only uses one.
Please use a clock-names property.

Thanks,
-Dan

> +               };
> +
>                 pwrap: pwrap at 1000d000 {
>                         compatible = "mediatek,mt8173-pwrap";
>                         reg = <0 0x1000d000 0 0x1000>;
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:27       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:27 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk, Eddie Huang

On Tue, Jul 14, 2015 at 12:26 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> From: Daniel Kurtz <djkurtz@chromium.org>
>>
>> Add device node to enable GPT timer. This timer will be
>> used as sched clock source.
>>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>
> This binding needs documentation.

Whoops.  I just found it at:
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt

>
>> ---
>>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> index 0696f8f..04bdd8f 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> @@ -219,6 +219,15 @@
>>                         reg = <0 0x10007000 0 0x100>;
>>                 };
>>
>> +               timer: timer@10008000 {
>> +                       compatible = "mediatek,mt8173-timer",
>> +                                    "mediatek,mt6577-timer";
>> +                       reg = <0 0x10008000 0 0x1000>;
>> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
>> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
>> +                                <&topckgen CLK_TOP_RTC_SEL>;
>
> Why two clocks?  The driver only uses one.
> Please use a clock-names property.
>
> Thanks,
> -Dan
>
>> +               };
>> +
>>                 pwrap: pwrap@1000d000 {
>>                         compatible = "mediatek,mt8173-pwrap";
>>                         reg = <0 0x1000d000 0 0x1000>;
>> --
>> 1.8.1.1.dirty
>>

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

* Re: [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:27       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:27 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-clk-u79uwXL29TY76Z2rM5mHXA, Eddie Huang

On Tue, Jul 14, 2015 at 12:26 PM, Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
>> From: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
>>
>> Add device node to enable GPT timer. This timer will be
>> used as sched clock source.
>>
>> Signed-off-by: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
>> Signed-off-by: Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>
> This binding needs documentation.

Whoops.  I just found it at:
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt

>
>> ---
>>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> index 0696f8f..04bdd8f 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> @@ -219,6 +219,15 @@
>>                         reg = <0 0x10007000 0 0x100>;
>>                 };
>>
>> +               timer: timer@10008000 {
>> +                       compatible = "mediatek,mt8173-timer",
>> +                                    "mediatek,mt6577-timer";
>> +                       reg = <0 0x10008000 0 0x1000>;
>> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
>> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
>> +                                <&topckgen CLK_TOP_RTC_SEL>;
>
> Why two clocks?  The driver only uses one.
> Please use a clock-names property.
>
> Thanks,
> -Dan
>
>> +               };
>> +
>>                 pwrap: pwrap@1000d000 {
>>                         compatible = "mediatek,mt8173-pwrap";
>>                         reg = <0 0x1000d000 0 0x1000>;
>> --
>> 1.8.1.1.dirty
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:27       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:27 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk, Eddie Huang

On Tue, Jul 14, 2015 at 12:26 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> From: Daniel Kurtz <djkurtz@chromium.org>
>>
>> Add device node to enable GPT timer. This timer will be
>> used as sched clock source.
>>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>
> This binding needs documentation.

Whoops.  I just found it at:
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt

>
>> ---
>>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> index 0696f8f..04bdd8f 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> @@ -219,6 +219,15 @@
>>                         reg = <0 0x10007000 0 0x100>;
>>                 };
>>
>> +               timer: timer@10008000 {
>> +                       compatible = "mediatek,mt8173-timer",
>> +                                    "mediatek,mt6577-timer";
>> +                       reg = <0 0x10008000 0 0x1000>;
>> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
>> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
>> +                                <&topckgen CLK_TOP_RTC_SEL>;
>
> Why two clocks?  The driver only uses one.
> Please use a clock-names property.
>
> Thanks,
> -Dan
>
>> +               };
>> +
>>                 pwrap: pwrap@1000d000 {
>>                         compatible = "mediatek,mt8173-pwrap";
>>                         reg = <0 0x1000d000 0 0x1000>;
>> --
>> 1.8.1.1.dirty
>>

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

* [PATCH 5/5] arm64: dts: mt8173: add timer node
@ 2015-07-14  4:27       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  4:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 14, 2015 at 12:26 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> From: Daniel Kurtz <djkurtz@chromium.org>
>>
>> Add device node to enable GPT timer. This timer will be
>> used as sched clock source.
>>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>
> This binding needs documentation.

Whoops.  I just found it at:
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt

>
>> ---
>>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> index 0696f8f..04bdd8f 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> @@ -219,6 +219,15 @@
>>                         reg = <0 0x10007000 0 0x100>;
>>                 };
>>
>> +               timer: timer at 10008000 {
>> +                       compatible = "mediatek,mt8173-timer",
>> +                                    "mediatek,mt6577-timer";
>> +                       reg = <0 0x10008000 0 0x1000>;
>> +                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>;
>> +                       clocks = <&infracfg CLK_INFRA_CLK_13M>,
>> +                                <&topckgen CLK_TOP_RTC_SEL>;
>
> Why two clocks?  The driver only uses one.
> Please use a clock-names property.
>
> Thanks,
> -Dan
>
>> +               };
>> +
>>                 pwrap: pwrap at 1000d000 {
>>                         compatible = "mediatek,mt8173-pwrap";
>>                         reg = <0 0x1000d000 0 0x1000>;
>> --
>> 1.8.1.1.dirty
>>

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

* Re: [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  7:34     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:34 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Add 13mhz clock used by GPT timer in infracfg.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
>  include/dt-bindings/clock/mt8173-clk.h | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
> index 4b9e04c..540c5c3 100644
> --- a/drivers/clk/mediatek/clk-mt8173.c
> +++ b/drivers/clk/mediatek/clk-mt8173.c
> @@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
>         GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
>  };
>
> +static const struct mtk_fixed_factor infra_divs[] __initconst = {
> +       FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
> +};
> +
>  static const struct mtk_gate_regs peri0_cg_regs = {
>         .set_ofs = 0x0008,
>         .clr_ofs = 0x0010,
> @@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
>
>         mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
>                                                 clk_data);
> +       mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
>
>         r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
>         if (r)
> diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
> index 4ad76ed..fa2a2bb 100644
> --- a/include/dt-bindings/clock/mt8173-clk.h
> +++ b/include/dt-bindings/clock/mt8173-clk.h
> @@ -187,7 +187,8 @@
>  #define CLK_INFRA_CEC                  9
>  #define CLK_INFRA_PMICSPI              10
>  #define CLK_INFRA_PMICWRAP             11
> -#define CLK_INFRA_NR_CLK               12
> +#define CLK_INFRA_CLK_13M              12
> +#define CLK_INFRA_NR_CLK               13

Note: this one conflicts slightly with pi-cheng's patch that adds CPU
mux clocks for cpufreq driver, since they both add more INFRA clocks:
https://patchwork.kernel.org/patch/6721511/

>
>  /* PERI_SYS */
>
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  7:34     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:34 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> Add 13mhz clock used by GPT timer in infracfg.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
>  include/dt-bindings/clock/mt8173-clk.h | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
> index 4b9e04c..540c5c3 100644
> --- a/drivers/clk/mediatek/clk-mt8173.c
> +++ b/drivers/clk/mediatek/clk-mt8173.c
> @@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
>         GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
>  };
>
> +static const struct mtk_fixed_factor infra_divs[] __initconst = {
> +       FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
> +};
> +
>  static const struct mtk_gate_regs peri0_cg_regs = {
>         .set_ofs = 0x0008,
>         .clr_ofs = 0x0010,
> @@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
>
>         mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
>                                                 clk_data);
> +       mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
>
>         r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
>         if (r)
> diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
> index 4ad76ed..fa2a2bb 100644
> --- a/include/dt-bindings/clock/mt8173-clk.h
> +++ b/include/dt-bindings/clock/mt8173-clk.h
> @@ -187,7 +187,8 @@
>  #define CLK_INFRA_CEC                  9
>  #define CLK_INFRA_PMICSPI              10
>  #define CLK_INFRA_PMICWRAP             11
> -#define CLK_INFRA_NR_CLK               12
> +#define CLK_INFRA_CLK_13M              12
> +#define CLK_INFRA_NR_CLK               13

Note: this one conflicts slightly with pi-cheng's patch that adds CPU
mux clocks for cpufreq driver, since they both add more INFRA clocks:
https://patchwork.kernel.org/patch/6721511/

>
>  /* PERI_SYS */
>
> --
> 1.8.1.1.dirty
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  7:34     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:34 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Add 13mhz clock used by GPT timer in infracfg.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
>  include/dt-bindings/clock/mt8173-clk.h | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
> index 4b9e04c..540c5c3 100644
> --- a/drivers/clk/mediatek/clk-mt8173.c
> +++ b/drivers/clk/mediatek/clk-mt8173.c
> @@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
>         GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
>  };
>
> +static const struct mtk_fixed_factor infra_divs[] __initconst = {
> +       FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
> +};
> +
>  static const struct mtk_gate_regs peri0_cg_regs = {
>         .set_ofs = 0x0008,
>         .clr_ofs = 0x0010,
> @@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
>
>         mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
>                                                 clk_data);
> +       mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
>
>         r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
>         if (r)
> diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
> index 4ad76ed..fa2a2bb 100644
> --- a/include/dt-bindings/clock/mt8173-clk.h
> +++ b/include/dt-bindings/clock/mt8173-clk.h
> @@ -187,7 +187,8 @@
>  #define CLK_INFRA_CEC                  9
>  #define CLK_INFRA_PMICSPI              10
>  #define CLK_INFRA_PMICWRAP             11
> -#define CLK_INFRA_NR_CLK               12
> +#define CLK_INFRA_CLK_13M              12
> +#define CLK_INFRA_NR_CLK               13

Note: this one conflicts slightly with pi-cheng's patch that adds CPU
mux clocks for cpufreq driver, since they both add more INFRA clocks:
https://patchwork.kernel.org/patch/6721511/

>
>  /* PERI_SYS */
>
> --
> 1.8.1.1.dirty
>

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

* [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173
@ 2015-07-14  7:34     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Add 13mhz clock used by GPT timer in infracfg.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clk/mediatek/clk-mt8173.c      | 5 +++++
>  include/dt-bindings/clock/mt8173-clk.h | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
> index 4b9e04c..540c5c3 100644
> --- a/drivers/clk/mediatek/clk-mt8173.c
> +++ b/drivers/clk/mediatek/clk-mt8173.c
> @@ -618,6 +618,10 @@ static const struct mtk_gate infra_clks[] __initconst = {
>         GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
>  };
>
> +static const struct mtk_fixed_factor infra_divs[] __initconst = {
> +       FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
> +};
> +
>  static const struct mtk_gate_regs peri0_cg_regs = {
>         .set_ofs = 0x0008,
>         .clr_ofs = 0x0010,
> @@ -737,6 +741,7 @@ static void __init mtk_infrasys_init(struct device_node *node)
>
>         mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
>                                                 clk_data);
> +       mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
>
>         r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
>         if (r)
> diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
> index 4ad76ed..fa2a2bb 100644
> --- a/include/dt-bindings/clock/mt8173-clk.h
> +++ b/include/dt-bindings/clock/mt8173-clk.h
> @@ -187,7 +187,8 @@
>  #define CLK_INFRA_CEC                  9
>  #define CLK_INFRA_PMICSPI              10
>  #define CLK_INFRA_PMICWRAP             11
> -#define CLK_INFRA_NR_CLK               12
> +#define CLK_INFRA_CLK_13M              12
> +#define CLK_INFRA_NR_CLK               13

Note: this one conflicts slightly with pi-cheng's patch that adds CPU
mux clocks for cpufreq driver, since they both add more INFRA clocks:
https://patchwork.kernel.org/patch/6721511/

>
>  /* PERI_SYS */
>
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-07-13  9:32   ` Yingjoe Chen
  (?)
@ 2015-07-14  7:39     ` Daniel Kurtz
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:39 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

Hi Yingjoe,

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..237c20b 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>  }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> +                           u8 option, bool enable)

This function can be: __init

Other than this tiny nit, and the small potential conflict in patch 4,
this whole series is:

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

(I do think it is a bit strange that the mediatek,mt6577-timer binding
does not use "clock-names", but that is independent of this patch
set).

Thanks!


>  {
> +       u32 val;
> +
>         writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>                 evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>         writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -       writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -                       evt->gpt_base + TIMER_CTRL_REG(timer));
> +       val = TIMER_CTRL_OP(option);
> +       if (enable)
> +               val |= TIMER_CTRL_ENABLE;
> +       writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>  }
>
>  static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>         evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>         /* Configure clock source */
> -       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>         clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>                         node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>         /* Configure clock event */
> -       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>         clockevents_config_and_register(&evt->dev, rate, 0x3,
>                                         0xffffffff);
>
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-14  7:39     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:39 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

Hi Yingjoe,

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..237c20b 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>  }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> +                           u8 option, bool enable)

This function can be: __init

Other than this tiny nit, and the small potential conflict in patch 4,
this whole series is:

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

(I do think it is a bit strange that the mediatek,mt6577-timer binding
does not use "clock-names", but that is independent of this patch
set).

Thanks!


>  {
> +       u32 val;
> +
>         writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>                 evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>         writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -       writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -                       evt->gpt_base + TIMER_CTRL_REG(timer));
> +       val = TIMER_CTRL_OP(option);
> +       if (enable)
> +               val |= TIMER_CTRL_ENABLE;
> +       writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>  }
>
>  static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>         evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>         /* Configure clock source */
> -       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>         clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>                         node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>         /* Configure clock event */
> -       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>         clockevents_config_and_register(&evt->dev, rate, 0x3,
>                                         0xffffffff);
>
> --
> 1.8.1.1.dirty
>

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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-14  7:39     ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-07-14  7:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Yingjoe,

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..237c20b 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>  }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> +                           u8 option, bool enable)

This function can be: __init

Other than this tiny nit, and the small potential conflict in patch 4,
this whole series is:

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

(I do think it is a bit strange that the mediatek,mt6577-timer binding
does not use "clock-names", but that is independent of this patch
set).

Thanks!


>  {
> +       u32 val;
> +
>         writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>                 evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>         writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -       writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -                       evt->gpt_base + TIMER_CTRL_REG(timer));
> +       val = TIMER_CTRL_OP(option);
> +       if (enable)
> +               val |= TIMER_CTRL_ENABLE;
> +       writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>  }
>
>  static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>         evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>         /* Configure clock source */
> -       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +       mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>         clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>                         node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>         /* Configure clock event */
> -       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +       mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>         clockevents_config_and_register(&evt->dev, rate, 0x3,
>                                         0xffffffff);
>
> --
> 1.8.1.1.dirty
>

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

* Re: [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-17 21:49     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:49 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Thomas Gleixner, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On Monday, July 13, 2015 05:32:46 PM Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

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

* Re: [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-17 21:49     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:49 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Thomas Gleixner, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Monday, July 13, 2015 05:32:46 PM Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---

Acked-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source
@ 2015-07-17 21:49     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, July 13, 2015 05:32:46 PM Yingjoe Chen wrote:
> When cpu is in deep idle, arch timer will stop counting. Setup GPT as
> sched clock source so it can keep counting in idle.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

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

* Re: [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
  2015-07-13  9:32   ` Yingjoe Chen
@ 2015-07-17 21:54     ` Matthias Brugger
  -1 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:54 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Thomas Gleixner, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> Enable MTK_TIMER for MediaTek plaform, which will be used as
> schedule clock.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Applied, thanks.

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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-17 21:54     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> Enable MTK_TIMER for MediaTek plaform, which will be used as
> schedule clock.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Applied, thanks.

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-17 21:56     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:56 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Thomas Gleixner, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On Monday, July 13, 2015 05:32:45 PM Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-17 21:56     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:56 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Thomas Gleixner, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Monday, July 13, 2015 05:32:45 PM Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---

Acked-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-17 21:56     ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-17 21:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, July 13, 2015 05:32:45 PM Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

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

* Re: [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
  2015-07-17 21:54     ` Matthias Brugger
  (?)
@ 2015-07-18  7:31       ` Thomas Gleixner
  -1 siblings, 0 replies; 131+ messages in thread
From: Thomas Gleixner @ 2015-07-18  7:31 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Yingjoe Chen, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On Fri, 17 Jul 2015, Matthias Brugger wrote:

> On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > schedule clock.
> > 
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> 
> Applied, thanks.

So you enable the current code w/o the modifications required for this
to work?

Thanks,

	tglx


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

* Re: [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-18  7:31       ` Thomas Gleixner
  0 siblings, 0 replies; 131+ messages in thread
From: Thomas Gleixner @ 2015-07-18  7:31 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Yingjoe Chen, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Fri, 17 Jul 2015, Matthias Brugger wrote:

> On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > schedule clock.
> > 
> > Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > ---
> 
> Applied, thanks.

So you enable the current code w/o the modifications required for this
to work?

Thanks,

	tglx

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-18  7:31       ` Thomas Gleixner
  0 siblings, 0 replies; 131+ messages in thread
From: Thomas Gleixner @ 2015-07-18  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 17 Jul 2015, Matthias Brugger wrote:

> On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > schedule clock.
> > 
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> 
> Applied, thanks.

So you enable the current code w/o the modifications required for this
to work?

Thanks,

	tglx

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

* Re: [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
  2015-07-18  7:31       ` Thomas Gleixner
  (?)
@ 2015-07-21  7:52         ` Matthias Brugger
  -1 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-21  7:52 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Yingjoe Chen, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	Daniel Lezcano, linux-kernel, Rob Herring, linux-mediatek,
	Sascha Hauer, Olof Johansson, srv_heupstream, linux-arm-kernel,
	Daniel Kurtz, linux-clk

On Saturday, July 18, 2015 09:31:53 AM Thomas Gleixner wrote:
> On Fri, 17 Jul 2015, Matthias Brugger wrote:
> > On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > > schedule clock.
> > > 
> > > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > > ---
> > 
> > Applied, thanks.
> 
> So you enable the current code w/o the modifications required for this
> to work?
> 

Well as the timer is not defined in dts it should not break the board...
But yes you are right, I will drop this commit for now.

Thanks,
Matthias

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

* Re: [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-21  7:52         ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-21  7:52 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Yingjoe Chen, Stephen Boyd, Michael Turquette, James Liao,
	Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, Daniel Lezcano,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Olof Johansson, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Saturday, July 18, 2015 09:31:53 AM Thomas Gleixner wrote:
> On Fri, 17 Jul 2015, Matthias Brugger wrote:
> > On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > > schedule clock.
> > > 
> > > Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > > ---
> > 
> > Applied, thanks.
> 
> So you enable the current code w/o the modifications required for this
> to work?
> 

Well as the timer is not defined in dts it should not break the board...
But yes you are right, I will drop this commit for now.

Thanks,
Matthias
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/5] arm64: mediatek: enable MTK_TIMER
@ 2015-07-21  7:52         ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-07-21  7:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday, July 18, 2015 09:31:53 AM Thomas Gleixner wrote:
> On Fri, 17 Jul 2015, Matthias Brugger wrote:
> > On Monday, July 13, 2015 05:32:47 PM Yingjoe Chen wrote:
> > > Enable MTK_TIMER for MediaTek plaform, which will be used as
> > > schedule clock.
> > > 
> > > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > > ---
> > 
> > Applied, thanks.
> 
> So you enable the current code w/o the modifications required for this
> to work?
> 

Well as the timer is not defined in dts it should not break the board...
But yes you are right, I will drop this commit for now.

Thanks,
Matthias

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-07-14  7:39     ` Daniel Kurtz
  (?)
  (?)
@ 2015-07-22  8:14       ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:14 UTC (permalink / raw)
  To: Daniel Kurtz, Stephen Boyd, Thomas Gleixner
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano,
	 linux-kernel@vger.kernel.org, Olof Johansson, Rob Herring,
	linux-mediatek, Sascha Hauer, Matthias Brugger, linux-clk,
	 linux-arm-kernel@lists.infradead.org, Yingjoe Chen

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---

Update to my patch [1], added __init as Daniel suggest. This is the
only patch that need to change in that series, so I only sent this one.

http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html

 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..2ba5b66 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
+				   u8 timer, u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty


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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:14       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:14 UTC (permalink / raw)
  To: Daniel Kurtz, Stephen Boyd, Thomas Gleixner
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano,
	 linux-kernel@vger.kernel.org, Olof Johansson, Rob Herring,
	linux-mediatek, Sascha Hauer, Matthias Brugger, linux-clk,
	 linux-arm-kernel@lists.infradead.org, Yingjoe Chen

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---

Update to my patch [1], added __init as Daniel suggest. This is the
only patch that need to change in that series, so I only sent this one.

http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html

 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..2ba5b66 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
+				   u8 timer, u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:14       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:14 UTC (permalink / raw)
  To: Daniel Kurtz, Stephen Boyd, Thomas Gleixner
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano,
	 linux-kernel@vger.kernel.org, Olof Johansson, Rob Herring,
	linux-mediatek, Sascha Hauer, Matthias Brugger, linux-clk,
	 linux-arm-kernel@lists.infradead.org, Yingjoe Chen

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---

Update to my patch [1], added __init as Daniel suggest. This is the
only patch that need to change in that series, so I only sent this one.

http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html

 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..2ba5b66 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
+				   u8 timer, u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:14       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:14 UTC (permalink / raw)
  To: linux-arm-kernel

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---

Update to my patch [1], added __init as Daniel suggest. This is the
only patch that need to change in that series, so I only sent this one.

http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html

 drivers/clocksource/mtk_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..2ba5b66 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
 	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
 }
 
-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
+				   u8 timer, u8 option, bool enable)
 {
+	u32 val;
+
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
 
@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 
 	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
 
-	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-			evt->gpt_base + TIMER_CTRL_REG(timer));
+	val = TIMER_CTRL_OP(option);
+	if (enable)
+		val |= TIMER_CTRL_ENABLE;
+	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
 }
 
 static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
 	/* Configure clock source */
-	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
 	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
 			node->name, rate, 300, 32, clocksource_mmio_readl_up);
 
 	/* Configure clock event */
-	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
 	clockevents_config_and_register(&evt->dev, rate, 0x3,
 					0xffffffff);
 
-- 
1.8.1.1.dirty

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:24       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:24 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano, Stephen Boyd,
	linux-kernel, Olof Johansson, Rob Herring, linux-mediatek,
	Sascha Hauer, Matthias Brugger, Thomas Gleixner, linux-clk,
	linux-arm-kernel

On Tue, 2015-07-14 at 15:39 +0800, Daniel Kurtz wrote:
> Hi Yingjoe,
> 
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..237c20b 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >  }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> > +                           u8 option, bool enable)
> 
> This function can be: __init
> 
> Other than this tiny nit, and the small potential conflict in patch 4,
> this whole series is:
> 
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> 
> (I do think it is a bit strange that the mediatek,mt6577-timer binding
> does not use "clock-names", but that is independent of this patch
> set).
> 


Hi Daniel,

Thanks for your review.

I added __init as you suggested, and Pi-Cheng already sent an updated
version of his patch to resolve the conflict[1].

Joe.C

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001592.html




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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:24       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:24 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano, Stephen Boyd,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Olof Johansson, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Matthias Brugger, Thomas Gleixner,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, 2015-07-14 at 15:39 +0800, Daniel Kurtz wrote:
> Hi Yingjoe,
> 
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > ---
> >  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..237c20b 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >  }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> > +                           u8 option, bool enable)
> 
> This function can be: __init
> 
> Other than this tiny nit, and the small potential conflict in patch 4,
> this whole series is:
> 
> Reviewed-by: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> 
> (I do think it is a bit strange that the mediatek,mt6577-timer binding
> does not use "clock-names", but that is independent of this patch
> set).
> 


Hi Daniel,

Thanks for your review.

I added __init as you suggested, and Pi-Cheng already sent an updated
version of his patch to resolve the conflict[1].

Joe.C

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001592.html



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:24       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:24 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Daniel Lezcano, Stephen Boyd,
	linux-kernel, Olof Johansson, Rob Herring, linux-mediatek,
	Sascha Hauer, Matthias Brugger, Thomas Gleixner, linux-clk,
	linux-arm-kernel

On Tue, 2015-07-14 at 15:39 +0800, Daniel Kurtz wrote:
> Hi Yingjoe,
> 
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..237c20b 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >  }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> > +                           u8 option, bool enable)
> 
> This function can be: __init
> 
> Other than this tiny nit, and the small potential conflict in patch 4,
> this whole series is:
> 
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> 
> (I do think it is a bit strange that the mediatek,mt6577-timer binding
> does not use "clock-names", but that is independent of this patch
> set).
> 


Hi Daniel,

Thanks for your review.

I added __init as you suggested, and Pi-Cheng already sent an updated
version of his patch to resolve the conflict[1].

Joe.C

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001592.html




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

* [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-22  8:24       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-22  8:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2015-07-14 at 15:39 +0800, Daniel Kurtz wrote:
> Hi Yingjoe,
> 
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >  drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..237c20b 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >         writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >  }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer,
> > +                           u8 option, bool enable)
> 
> This function can be: __init
> 
> Other than this tiny nit, and the small potential conflict in patch 4,
> this whole series is:
> 
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> 
> (I do think it is a bit strange that the mediatek,mt6577-timer binding
> does not use "clock-names", but that is independent of this patch
> set).
> 


Hi Daniel,

Thanks for your review.

I added __init as you suggested, and Pi-Cheng already sent an updated
version of his patch to resolve the conflict[1].

Joe.C

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001592.html

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-31  3:14         ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-31  3:14 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner
  Cc: Stephen Boyd, James Liao, Russell King, srv_heupstream,
	Arnd Bergmann, open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel,
	Matthias Brugger, Rob Herring, linux-mediatek, Sascha Hauer,
	Olof Johansson, linux-clk, linux-arm-kernel, Daniel Kurtz

On Wed, 2015-07-22 at 16:14 +0800, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html


Hi Daniel, Thomas,

Any suggestions for mtk_timer fixes in this series?
Should I resend and add tags from the reviewers?

Joe.C



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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-31  3:14         ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-31  3:14 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner
  Cc: Stephen Boyd, James Liao, Russell King, srv_heupstream,
	Arnd Bergmann, open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Matthias Brugger,
	Rob Herring, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Sascha Hauer, Olof Johansson, linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz

On Wed, 2015-07-22 at 16:14 +0800, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Acked-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Reviewed-by: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html


Hi Daniel, Thomas,

Any suggestions for mtk_timer fixes in this series?
Should I resend and add tags from the reviewers?

Joe.C


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-31  3:14         ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-31  3:14 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner
  Cc: Stephen Boyd, James Liao, Russell King, srv_heupstream,
	Arnd Bergmann, open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel,
	Matthias Brugger, Rob Herring, linux-mediatek, Sascha Hauer,
	Olof Johansson, linux-clk, linux-arm-kernel, Daniel Kurtz

On Wed, 2015-07-22 at 16:14 +0800, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html


Hi Daniel, Thomas,

Any suggestions for mtk_timer fixes in this series?
Should I resend and add tags from the reviewers?

Joe.C



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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-07-31  3:14         ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-07-31  3:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-07-22 at 16:14 +0800, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> 
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html


Hi Daniel, Thomas,

Any suggestions for mtk_timer fixes in this series?
Should I resend and add tags from the reviewers?

Joe.C

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
  2015-07-13  9:32 ` Yingjoe Chen
  (?)
@ 2015-08-11 15:54   ` Daniel Kurtz
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-11 15:54 UTC (permalink / raw)
  To: Yingjoe Chen, Stephen Boyd, Matthias Brugger
  Cc: James Liao, Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> This series add GPT timer support for mt8173. This is based on v4.2-rc1
> and Matthias' next branch (for dts parts).
>
> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> series [1]. I decide to move these 2 patches to this series, since it
> is more relevent here. They are changed based on Matthias' and Daniel's
> comments.
>
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> Daniel Kurtz (1):
>   arm64: dts: mt8173: add timer node
>
> Yingjoe Chen (4):
>   clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>   clocksource: mediatek: Use GPT as sched clock source
>   arm64: mediatek: enable MTK_TIMER
>   clk: mediatek: add 13mhz clock for MT8173

Was this mediatek clocksource patch set get forgotten again?
All 5 patches have have been reviewed, and I think the ones that need
it have been Ack'ed by Matthias and/or Stephen.
What is the plan for merging them?

Thanks,
-Dan

>
>  arch/arm64/Kconfig                       |  1 +
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
>  drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
>  drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
>  include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
>  5 files changed, 37 insertions(+), 7 deletions(-)
>

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-11 15:54   ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-11 15:54 UTC (permalink / raw)
  To: Yingjoe Chen, Stephen Boyd, Matthias Brugger
  Cc: James Liao, Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, Daniel Lezcano, linux-kernel,
	Rob Herring, linux-mediatek, Sascha Hauer, Olof Johansson,
	srv_heupstream, linux-arm-kernel, linux-clk

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> This series add GPT timer support for mt8173. This is based on v4.2-rc1
> and Matthias' next branch (for dts parts).
>
> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> series [1]. I decide to move these 2 patches to this series, since it
> is more relevent here. They are changed based on Matthias' and Daniel's
> comments.
>
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> Daniel Kurtz (1):
>   arm64: dts: mt8173: add timer node
>
> Yingjoe Chen (4):
>   clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>   clocksource: mediatek: Use GPT as sched clock source
>   arm64: mediatek: enable MTK_TIMER
>   clk: mediatek: add 13mhz clock for MT8173

Was this mediatek clocksource patch set get forgotten again?
All 5 patches have have been reviewed, and I think the ones that need
it have been Ack'ed by Matthias and/or Stephen.
What is the plan for merging them?

Thanks,
-Dan

>
>  arch/arm64/Kconfig                       |  1 +
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
>  drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
>  drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
>  include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
>  5 files changed, 37 insertions(+), 7 deletions(-)
>

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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-11 15:54   ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-11 15:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> This series add GPT timer support for mt8173. This is based on v4.2-rc1
> and Matthias' next branch (for dts parts).
>
> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> series [1]. I decide to move these 2 patches to this series, since it
> is more relevent here. They are changed based on Matthias' and Daniel's
> comments.
>
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> Daniel Kurtz (1):
>   arm64: dts: mt8173: add timer node
>
> Yingjoe Chen (4):
>   clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>   clocksource: mediatek: Use GPT as sched clock source
>   arm64: mediatek: enable MTK_TIMER
>   clk: mediatek: add 13mhz clock for MT8173

Was this mediatek clocksource patch set get forgotten again?
All 5 patches have have been reviewed, and I think the ones that need
it have been Ack'ed by Matthias and/or Stephen.
What is the plan for merging them?

Thanks,
-Dan

>
>  arch/arm64/Kconfig                       |  1 +
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
>  drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
>  drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
>  include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
>  5 files changed, 37 insertions(+), 7 deletions(-)
>

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
  2015-08-11 15:54   ` Daniel Kurtz
  (?)
@ 2015-08-12 12:32     ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-12 12:32 UTC (permalink / raw)
  To: Daniel Kurtz, Yingjoe Chen, Stephen Boyd, Matthias Brugger
  Cc: James Liao, Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, linux-kernel, Rob Herring,
	linux-mediatek, Sascha Hauer, Olof Johansson, srv_heupstream,
	linux-arm-kernel, linux-clk

On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>> and Matthias' next branch (for dts parts).
>>
>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>> series [1]. I decide to move these 2 patches to this series, since it
>> is more relevent here. They are changed based on Matthias' and Daniel's
>> comments.
>>
>> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>
>> Daniel Kurtz (1):
>>    arm64: dts: mt8173: add timer node
>>
>> Yingjoe Chen (4):
>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>    clocksource: mediatek: Use GPT as sched clock source
>>    arm64: mediatek: enable MTK_TIMER
>>    clk: mediatek: add 13mhz clock for MT8173
>
> Was this mediatek clocksource patch set get forgotten again?

Yep. Sounds like it felt at the wrong moment.

> All 5 patches have have been reviewed, and I think the ones that need
> it have been Ack'ed by Matthias and/or Stephen.
> What is the plan for merging them?

So if I am not wrong we have two patches I can take in my tree as a 
couple of fixes (1 and 2), right ?




-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-12 12:32     ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-12 12:32 UTC (permalink / raw)
  To: Daniel Kurtz, Yingjoe Chen, Stephen Boyd, Matthias Brugger
  Cc: James Liao, Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, linux-kernel, Rob Herring,
	linux-mediatek, Sascha Hauer, Olof Johansson, srv_heupstream,
	linux-arm-kernel, linux-clk

On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>> and Matthias' next branch (for dts parts).
>>
>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>> series [1]. I decide to move these 2 patches to this series, since it
>> is more relevent here. They are changed based on Matthias' and Daniel's
>> comments.
>>
>> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>
>> Daniel Kurtz (1):
>>    arm64: dts: mt8173: add timer node
>>
>> Yingjoe Chen (4):
>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>    clocksource: mediatek: Use GPT as sched clock source
>>    arm64: mediatek: enable MTK_TIMER
>>    clk: mediatek: add 13mhz clock for MT8173
>
> Was this mediatek clocksource patch set get forgotten again?

Yep. Sounds like it felt at the wrong moment.

> All 5 patches have have been reviewed, and I think the ones that need
> it have been Ack'ed by Matthias and/or Stephen.
> What is the plan for merging them?

So if I am not wrong we have two patches I can take in my tree as a 
couple of fixes (1 and 2), right ?




-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-12 12:32     ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-12 12:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>> and Matthias' next branch (for dts parts).
>>
>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>> series [1]. I decide to move these 2 patches to this series, since it
>> is more relevent here. They are changed based on Matthias' and Daniel's
>> comments.
>>
>> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>
>> Daniel Kurtz (1):
>>    arm64: dts: mt8173: add timer node
>>
>> Yingjoe Chen (4):
>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>    clocksource: mediatek: Use GPT as sched clock source
>>    arm64: mediatek: enable MTK_TIMER
>>    clk: mediatek: add 13mhz clock for MT8173
>
> Was this mediatek clocksource patch set get forgotten again?

Yep. Sounds like it felt at the wrong moment.

> All 5 patches have have been reviewed, and I think the ones that need
> it have been Ack'ed by Matthias and/or Stephen.
> What is the plan for merging them?

So if I am not wrong we have two patches I can take in my tree as a 
couple of fixes (1 and 2), right ?




-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-13  4:49       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-13  4:49 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Yingjoe Chen, Stephen Boyd, Matthias Brugger, James Liao,
	Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, linux-kernel, Rob Herring,
	linux-mediatek, Sascha Hauer, Olof Johansson, srv_heupstream,
	linux-arm-kernel, linux-clk

On Wed, Aug 12, 2015 at 8:32 PM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
>>
>> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com>
>> wrote:
>>>
>>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>>> and Matthias' next branch (for dts parts).
>>>
>>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>>> series [1]. I decide to move these 2 patches to this series, since it
>>> is more relevent here. They are changed based on Matthias' and Daniel's
>>> comments.
>>>
>>> [1]
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>>
>>> Daniel Kurtz (1):
>>>    arm64: dts: mt8173: add timer node
>>>
>>> Yingjoe Chen (4):
>>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>>    clocksource: mediatek: Use GPT as sched clock source
>>>    arm64: mediatek: enable MTK_TIMER
>>>    clk: mediatek: add 13mhz clock for MT8173
>>
>>
>> Was this mediatek clocksource patch set get forgotten again?
>
>
> Yep. Sounds like it felt at the wrong moment.
>
>> All 5 patches have have been reviewed, and I think the ones that need
>> it have been Ack'ed by Matthias and/or Stephen.
>> What is the plan for merging them?
>
>
> So if I am not wrong we have two patches I can take in my tree as a couple
> of fixes (1 and 2), right ?

Yes.
Patches 3 & 5 are for Matthias, and patch 4 is Ack'ed by Stephen Boyd,
so I assume Matthias can pick that one up too.

Matthias, is that correct?
Or does Patch 4 need to go in via a clock maintainer's tree?

-Dan

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-13  4:49       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-13  4:49 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Stephen Boyd,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Olof Johansson, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Matthias Brugger, Yingjoe Chen, Thomas Gleixner,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Aug 12, 2015 at 8:32 PM, Daniel Lezcano
<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
>>
>> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>> wrote:
>>>
>>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>>> and Matthias' next branch (for dts parts).
>>>
>>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>>> series [1]. I decide to move these 2 patches to this series, since it
>>> is more relevent here. They are changed based on Matthias' and Daniel's
>>> comments.
>>>
>>> [1]
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>>
>>> Daniel Kurtz (1):
>>>    arm64: dts: mt8173: add timer node
>>>
>>> Yingjoe Chen (4):
>>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>>    clocksource: mediatek: Use GPT as sched clock source
>>>    arm64: mediatek: enable MTK_TIMER
>>>    clk: mediatek: add 13mhz clock for MT8173
>>
>>
>> Was this mediatek clocksource patch set get forgotten again?
>
>
> Yep. Sounds like it felt at the wrong moment.
>
>> All 5 patches have have been reviewed, and I think the ones that need
>> it have been Ack'ed by Matthias and/or Stephen.
>> What is the plan for merging them?
>
>
> So if I am not wrong we have two patches I can take in my tree as a couple
> of fixes (1 and 2), right ?

Yes.
Patches 3 & 5 are for Matthias, and patch 4 is Ack'ed by Stephen Boyd,
so I assume Matthias can pick that one up too.

Matthias, is that correct?
Or does Patch 4 need to go in via a clock maintainer's tree?

-Dan

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-13  4:49       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-13  4:49 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Yingjoe Chen, Stephen Boyd, Matthias Brugger, James Liao,
	Michael Turquette, Thomas Gleixner, Russell King,
	open list:OPEN FIRMWARE AND...,
	Arnd Bergmann, Catalin Marinas, linux-kernel, Rob Herring,
	linux-mediatek, Sascha Hauer, Olof Johansson, srv_heupstream,
	linux-arm-kernel, linux-clk

On Wed, Aug 12, 2015 at 8:32 PM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
>>
>> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com>
>> wrote:
>>>
>>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>>> and Matthias' next branch (for dts parts).
>>>
>>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>>> series [1]. I decide to move these 2 patches to this series, since it
>>> is more relevent here. They are changed based on Matthias' and Daniel's
>>> comments.
>>>
>>> [1]
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>>
>>> Daniel Kurtz (1):
>>>    arm64: dts: mt8173: add timer node
>>>
>>> Yingjoe Chen (4):
>>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>>    clocksource: mediatek: Use GPT as sched clock source
>>>    arm64: mediatek: enable MTK_TIMER
>>>    clk: mediatek: add 13mhz clock for MT8173
>>
>>
>> Was this mediatek clocksource patch set get forgotten again?
>
>
> Yep. Sounds like it felt at the wrong moment.
>
>> All 5 patches have have been reviewed, and I think the ones that need
>> it have been Ack'ed by Matthias and/or Stephen.
>> What is the plan for merging them?
>
>
> So if I am not wrong we have two patches I can take in my tree as a couple
> of fixes (1 and 2), right ?

Yes.
Patches 3 & 5 are for Matthias, and patch 4 is Ack'ed by Stephen Boyd,
so I assume Matthias can pick that one up too.

Matthias, is that correct?
Or does Patch 4 need to go in via a clock maintainer's tree?

-Dan

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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-13  4:49       ` Daniel Kurtz
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Kurtz @ 2015-08-13  4:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 12, 2015 at 8:32 PM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> On 08/11/2015 05:54 PM, Daniel Kurtz wrote:
>>
>> On Mon, Jul 13, 2015 at 5:32 PM, Yingjoe Chen <yingjoe.chen@mediatek.com>
>> wrote:
>>>
>>> This series add GPT timer support for mt8173. This is based on v4.2-rc1
>>> and Matthias' next branch (for dts parts).
>>>
>>> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
>>> series [1]. I decide to move these 2 patches to this series, since it
>>> is more relevent here. They are changed based on Matthias' and Daniel's
>>> comments.
>>>
>>> [1]
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>>>
>>> Daniel Kurtz (1):
>>>    arm64: dts: mt8173: add timer node
>>>
>>> Yingjoe Chen (4):
>>>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>>>    clocksource: mediatek: Use GPT as sched clock source
>>>    arm64: mediatek: enable MTK_TIMER
>>>    clk: mediatek: add 13mhz clock for MT8173
>>
>>
>> Was this mediatek clocksource patch set get forgotten again?
>
>
> Yep. Sounds like it felt at the wrong moment.
>
>> All 5 patches have have been reviewed, and I think the ones that need
>> it have been Ack'ed by Matthias and/or Stephen.
>> What is the plan for merging them?
>
>
> So if I am not wrong we have two patches I can take in my tree as a couple
> of fixes (1 and 2), right ?

Yes.
Patches 3 & 5 are for Matthias, and patch 4 is Ack'ed by Stephen Boyd,
so I assume Matthias can pick that one up too.

Matthias, is that correct?
Or does Patch 4 need to go in via a clock maintainer's tree?

-Dan

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-07-22  8:14       ` Yingjoe Chen
  (?)
@ 2015-08-13  8:35         ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-13  8:35 UTC (permalink / raw)
  To: Yingjoe Chen, Daniel Kurtz, Stephen Boyd, Thomas Gleixner
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>
>   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..2ba5b66 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>   }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> +				   u8 timer, u8 option, bool enable)
>   {
> +	u32 val;
> +
>   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>   		evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> +	val = TIMER_CTRL_OP(option);
> +	if (enable)
> +		val |= TIMER_CTRL_ENABLE;
> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));

Instead of the 'enable' new option, I prefer a test with 'timer' with a 
comment:

	/*
	 * the timer hw is broken in that way ... bla bla, so we only
	 * enable the clocksource ...
	 */
	if (timer == GPT_CLK_SRC)
		val |= TIMER_CTRL_ENABLE;

That said, can you have a look at commit 1096be08 ?
"clockevents: sun5i: Fix setup_irq init sequence"

first and check if moving the interrupt request after the 
clockevents_config_and_register could fix your issue.

>   }
>
>   static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>   	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>   	/* Configure clock source */
> -	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>   	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>   			node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>   	/* Configure clock event */
> -	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>   	clockevents_config_and_register(&evt->dev, rate, 0x3,
>   					0xffffffff);




-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-13  8:35         ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-13  8:35 UTC (permalink / raw)
  To: Yingjoe Chen, Daniel Kurtz, Stephen Boyd, Thomas Gleixner
  Cc: James Liao, Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>
>   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..2ba5b66 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>   }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> +				   u8 timer, u8 option, bool enable)
>   {
> +	u32 val;
> +
>   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>   		evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> +	val = TIMER_CTRL_OP(option);
> +	if (enable)
> +		val |= TIMER_CTRL_ENABLE;
> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));

Instead of the 'enable' new option, I prefer a test with 'timer' with a 
comment:

	/*
	 * the timer hw is broken in that way ... bla bla, so we only
	 * enable the clocksource ...
	 */
	if (timer == GPT_CLK_SRC)
		val |= TIMER_CTRL_ENABLE;

That said, can you have a look at commit 1096be08 ?
"clockevents: sun5i: Fix setup_irq init sequence"

first and check if moving the interrupt request after the 
clockevents_config_and_register could fix your issue.

>   }
>
>   static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>   	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>   	/* Configure clock source */
> -	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>   	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>   			node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>   	/* Configure clock event */
> -	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>   	clockevents_config_and_register(&evt->dev, rate, 0x3,
>   					0xffffffff);




-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-13  8:35         ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-13  8:35 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> Spurious mtk timer interrupt is noticed at boot and cause kernel
> crash. It seems if GPT is enabled, it will latch irq status even
> when its IRQ is disabled. When irq is enabled afterward, we see
> spurious interrupt.
> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
>
> Update to my patch [1], added __init as Daniel suggest. This is the
> only patch that need to change in that series, so I only sent this one.
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>
>   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 68ab423..2ba5b66 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>   }
>
> -static void
> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> +				   u8 timer, u8 option, bool enable)
>   {
> +	u32 val;
> +
>   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>   		evt->gpt_base + TIMER_CTRL_REG(timer));
>
> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>
>   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>
> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> +	val = TIMER_CTRL_OP(option);
> +	if (enable)
> +		val |= TIMER_CTRL_ENABLE;
> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));

Instead of the 'enable' new option, I prefer a test with 'timer' with a 
comment:

	/*
	 * the timer hw is broken in that way ... bla bla, so we only
	 * enable the clocksource ...
	 */
	if (timer == GPT_CLK_SRC)
		val |= TIMER_CTRL_ENABLE;

That said, can you have a look at commit 1096be08 ?
"clockevents: sun5i: Fix setup_irq init sequence"

first and check if moving the interrupt request after the 
clockevents_config_and_register could fix your issue.

>   }
>
>   static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> @@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node *node)
>   	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
>
>   	/* Configure clock source */
> -	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
> +	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
>   	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
>   			node->name, rate, 300, 32, clocksource_mmio_readl_up);
>
>   	/* Configure clock event */
> -	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
> +	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
>   	clockevents_config_and_register(&evt->dev, rate, 0x3,
>   					0xffffffff);




-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-17 14:10           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-17 14:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> > Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >
> > Update to my patch [1], added __init as Daniel suggest. This is the
> > only patch that need to change in that series, so I only sent this one.
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >
> >   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >   1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..2ba5b66 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >   }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> > +				   u8 timer, u8 option, bool enable)
> >   {
> > +	u32 val;
> > +
> >   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >   		evt->gpt_base + TIMER_CTRL_REG(timer));
> >
> > @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >
> >   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >
> > -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> > -			evt->gpt_base + TIMER_CTRL_REG(timer));
> > +	val = TIMER_CTRL_OP(option);
> > +	if (enable)
> > +		val |= TIMER_CTRL_ENABLE;
> > +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> 
> Instead of the 'enable' new option, I prefer a test with 'timer' with a 
> comment:
> 
> 	/*
> 	 * the timer hw is broken in that way ... bla bla, so we only
> 	 * enable the clocksource ...
> 	 */
> 	if (timer == GPT_CLK_SRC)
> 		val |= TIMER_CTRL_ENABLE;

Hi Daniel,

Thanks for your review.
Since this bug happens to anyone using interrupt, I'm not sure checking
timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
change to this in next version.

> That said, can you have a look at commit 1096be08 ?
> "clockevents: sun5i: Fix setup_irq init sequence"
> 
> first and check if moving the interrupt request after the 
> clockevents_config_and_register could fix your issue.

I've tested this before, see:

http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

Joe.C



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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-17 14:10           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-17 14:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: James Liao, Russell King, Arnd Bergmann, srv_heupstream,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, Stephen Boyd,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Matthias Brugger,
	Rob Herring, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Sascha Hauer, Olof Johansson, Thomas Gleixner,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Acked-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Reviewed-by: Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> > Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > ---
> >
> > Update to my patch [1], added __init as Daniel suggest. This is the
> > only patch that need to change in that series, so I only sent this one.
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >
> >   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >   1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..2ba5b66 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >   }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> > +				   u8 timer, u8 option, bool enable)
> >   {
> > +	u32 val;
> > +
> >   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >   		evt->gpt_base + TIMER_CTRL_REG(timer));
> >
> > @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >
> >   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >
> > -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> > -			evt->gpt_base + TIMER_CTRL_REG(timer));
> > +	val = TIMER_CTRL_OP(option);
> > +	if (enable)
> > +		val |= TIMER_CTRL_ENABLE;
> > +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> 
> Instead of the 'enable' new option, I prefer a test with 'timer' with a 
> comment:
> 
> 	/*
> 	 * the timer hw is broken in that way ... bla bla, so we only
> 	 * enable the clocksource ...
> 	 */
> 	if (timer == GPT_CLK_SRC)
> 		val |= TIMER_CTRL_ENABLE;

Hi Daniel,

Thanks for your review.
Since this bug happens to anyone using interrupt, I'm not sure checking
timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
change to this in next version.

> That said, can you have a look at commit 1096be08 ?
> "clockevents: sun5i: Fix setup_irq init sequence"
> 
> first and check if moving the interrupt request after the 
> clockevents_config_and_register could fix your issue.

I've tested this before, see:

http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

Joe.C

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-17 14:10           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-17 14:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> > Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >
> > Update to my patch [1], added __init as Daniel suggest. This is the
> > only patch that need to change in that series, so I only sent this one.
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >
> >   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >   1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..2ba5b66 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >   }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> > +				   u8 timer, u8 option, bool enable)
> >   {
> > +	u32 val;
> > +
> >   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >   		evt->gpt_base + TIMER_CTRL_REG(timer));
> >
> > @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >
> >   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >
> > -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> > -			evt->gpt_base + TIMER_CTRL_REG(timer));
> > +	val = TIMER_CTRL_OP(option);
> > +	if (enable)
> > +		val |= TIMER_CTRL_ENABLE;
> > +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> 
> Instead of the 'enable' new option, I prefer a test with 'timer' with a 
> comment:
> 
> 	/*
> 	 * the timer hw is broken in that way ... bla bla, so we only
> 	 * enable the clocksource ...
> 	 */
> 	if (timer == GPT_CLK_SRC)
> 		val |= TIMER_CTRL_ENABLE;

Hi Daniel,

Thanks for your review.
Since this bug happens to anyone using interrupt, I'm not sure checking
timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
change to this in next version.

> That said, can you have a look at commit 1096be08 ?
> "clockevents: sun5i: Fix setup_irq init sequence"
> 
> first and check if moving the interrupt request after the 
> clockevents_config_and_register could fix your issue.

I've tested this before, see:

http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

Joe.C



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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-17 14:10           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-17 14:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> > Spurious mtk timer interrupt is noticed at boot and cause kernel
> > crash. It seems if GPT is enabled, it will latch irq status even
> > when its IRQ is disabled. When irq is enabled afterward, we see
> > spurious interrupt.
> > Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >
> > Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> > Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> > Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> > ---
> >
> > Update to my patch [1], added __init as Daniel suggest. This is the
> > only patch that need to change in that series, so I only sent this one.
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >
> >   drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >   1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> > index 68ab423..2ba5b66 100644
> > --- a/drivers/clocksource/mtk_timer.c
> > +++ b/drivers/clocksource/mtk_timer.c
> > @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >   	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >   }
> >
> > -static void
> > -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> > +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> > +				   u8 timer, u8 option, bool enable)
> >   {
> > +	u32 val;
> > +
> >   	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >   		evt->gpt_base + TIMER_CTRL_REG(timer));
> >
> > @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >
> >   	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >
> > -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> > -			evt->gpt_base + TIMER_CTRL_REG(timer));
> > +	val = TIMER_CTRL_OP(option);
> > +	if (enable)
> > +		val |= TIMER_CTRL_ENABLE;
> > +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> 
> Instead of the 'enable' new option, I prefer a test with 'timer' with a 
> comment:
> 
> 	/*
> 	 * the timer hw is broken in that way ... bla bla, so we only
> 	 * enable the clocksource ...
> 	 */
> 	if (timer == GPT_CLK_SRC)
> 		val |= TIMER_CTRL_ENABLE;

Hi Daniel,

Thanks for your review.
Since this bug happens to anyone using interrupt, I'm not sure checking
timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
change to this in next version.

> That said, can you have a look at commit 1096be08 ?
> "clockevents: sun5i: Fix setup_irq init sequence"
> 
> first and check if moving the interrupt request after the 
> clockevents_config_and_register could fix your issue.

I've tested this before, see:

http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

Joe.C

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-08-17 14:10           ` Yingjoe Chen
  (?)
@ 2015-08-20 14:28             ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-20 14:28 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
>> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
>>> Spurious mtk timer interrupt is noticed at boot and cause kernel
>>> crash. It seems if GPT is enabled, it will latch irq status even
>>> when its IRQ is disabled.

It "seems" ?

>>> When irq is enabled afterward, we see
>>> spurious interrupt.

Doesn't have the firmware something to do with that ?

I have a mtk 8173 board I can use next week. How do you reproduce the 
issue ?

>>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>>>
>>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
>>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
>>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>>> ---
>>>
>>> Update to my patch [1], added __init as Daniel suggest. This is the
>>> only patch that need to change in that series, so I only sent this one.
>>>
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>>>
>>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>>>    1 file changed, 10 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
>>> index 68ab423..2ba5b66 100644
>>> --- a/drivers/clocksource/mtk_timer.c
>>> +++ b/drivers/clocksource/mtk_timer.c
>>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>>>    }
>>>
>>> -static void
>>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
>>> +				   u8 timer, u8 option, bool enable)
>>>    {
>>> +	u32 val;
>>> +
>>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
>>>
>>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>>
>>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>>>
>>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
>>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
>>> +	val = TIMER_CTRL_OP(option);
>>> +	if (enable)
>>> +		val |= TIMER_CTRL_ENABLE;
>>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>>
>> Instead of the 'enable' new option, I prefer a test with 'timer' with a
>> comment:
>>
>> 	/*
>> 	 * the timer hw is broken in that way ... bla bla, so we only
>> 	 * enable the clocksource ...
>> 	 */
>> 	if (timer == GPT_CLK_SRC)
>> 		val |= TIMER_CTRL_ENABLE;
>
> Hi Daniel,
>
> Thanks for your review.
> Since this bug happens to anyone using interrupt,

Can you elaborate ? I don't get the point.

> I'm not sure checking
> timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> change to this in next version.
>> That said, can you have a look at commit 1096be08 ?
>> "clockevents: sun5i: Fix setup_irq init sequence"
>>
>> first and check if moving the interrupt request after the
>> clockevents_config_and_register could fix your issue.
>
> I've tested this before, see:
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

I could take or ack this patch trusting it fixes the issue but there are 
some points that need clarifications.

  - Does the spurious interrupt occurs *every* time ? at each boot ?

The previous patches were supposed to fix the issue but they actually 
didn't. So how is tested the patch ?

Regarding the different fixes for this problem, it sounds like you are 
proceeding by trial and error.

Please give a more detailed analysis of the problem and especially check 
the timer is not altered by the firmware leaving it in a transient state 
or whatever.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-20 14:28             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-20 14:28 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
>> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
>>> Spurious mtk timer interrupt is noticed at boot and cause kernel
>>> crash. It seems if GPT is enabled, it will latch irq status even
>>> when its IRQ is disabled.

It "seems" ?

>>> When irq is enabled afterward, we see
>>> spurious interrupt.

Doesn't have the firmware something to do with that ?

I have a mtk 8173 board I can use next week. How do you reproduce the 
issue ?

>>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>>>
>>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
>>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
>>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>>> ---
>>>
>>> Update to my patch [1], added __init as Daniel suggest. This is the
>>> only patch that need to change in that series, so I only sent this one.
>>>
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>>>
>>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>>>    1 file changed, 10 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
>>> index 68ab423..2ba5b66 100644
>>> --- a/drivers/clocksource/mtk_timer.c
>>> +++ b/drivers/clocksource/mtk_timer.c
>>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>>>    }
>>>
>>> -static void
>>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
>>> +				   u8 timer, u8 option, bool enable)
>>>    {
>>> +	u32 val;
>>> +
>>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
>>>
>>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>>
>>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>>>
>>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
>>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
>>> +	val = TIMER_CTRL_OP(option);
>>> +	if (enable)
>>> +		val |= TIMER_CTRL_ENABLE;
>>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>>
>> Instead of the 'enable' new option, I prefer a test with 'timer' with a
>> comment:
>>
>> 	/*
>> 	 * the timer hw is broken in that way ... bla bla, so we only
>> 	 * enable the clocksource ...
>> 	 */
>> 	if (timer == GPT_CLK_SRC)
>> 		val |= TIMER_CTRL_ENABLE;
>
> Hi Daniel,
>
> Thanks for your review.
> Since this bug happens to anyone using interrupt,

Can you elaborate ? I don't get the point.

> I'm not sure checking
> timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> change to this in next version.
>> That said, can you have a look at commit 1096be08 ?
>> "clockevents: sun5i: Fix setup_irq init sequence"
>>
>> first and check if moving the interrupt request after the
>> clockevents_config_and_register could fix your issue.
>
> I've tested this before, see:
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

I could take or ack this patch trusting it fixes the issue but there are 
some points that need clarifications.

  - Does the spurious interrupt occurs *every* time ? at each boot ?

The previous patches were supposed to fix the issue but they actually 
didn't. So how is tested the patch ?

Regarding the different fixes for this problem, it sounds like you are 
proceeding by trial and error.

Please give a more detailed analysis of the problem and especially check 
the timer is not altered by the firmware leaving it in a transient state 
or whatever.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-20 14:28             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-20 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
>> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
>>> Spurious mtk timer interrupt is noticed at boot and cause kernel
>>> crash. It seems if GPT is enabled, it will latch irq status even
>>> when its IRQ is disabled.

It "seems" ?

>>> When irq is enabled afterward, we see
>>> spurious interrupt.

Doesn't have the firmware something to do with that ?

I have a mtk 8173 board I can use next week. How do you reproduce the 
issue ?

>>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
>>>
>>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
>>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
>>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
>>> ---
>>>
>>> Update to my patch [1], added __init as Daniel suggest. This is the
>>> only patch that need to change in that series, so I only sent this one.
>>>
>>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
>>>
>>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
>>>    1 file changed, 10 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
>>> index 68ab423..2ba5b66 100644
>>> --- a/drivers/clocksource/mtk_timer.c
>>> +++ b/drivers/clocksource/mtk_timer.c
>>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
>>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
>>>    }
>>>
>>> -static void
>>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
>>> +				   u8 timer, u8 option, bool enable)
>>>    {
>>> +	u32 val;
>>> +
>>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
>>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
>>>
>>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>>>
>>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
>>>
>>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
>>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
>>> +	val = TIMER_CTRL_OP(option);
>>> +	if (enable)
>>> +		val |= TIMER_CTRL_ENABLE;
>>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
>>
>> Instead of the 'enable' new option, I prefer a test with 'timer' with a
>> comment:
>>
>> 	/*
>> 	 * the timer hw is broken in that way ... bla bla, so we only
>> 	 * enable the clocksource ...
>> 	 */
>> 	if (timer == GPT_CLK_SRC)
>> 		val |= TIMER_CTRL_ENABLE;
>
> Hi Daniel,
>
> Thanks for your review.
> Since this bug happens to anyone using interrupt,

Can you elaborate ? I don't get the point.

> I'm not sure checking
> timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> change to this in next version.
>> That said, can you have a look at commit 1096be08 ?
>> "clockevents: sun5i: Fix setup_irq init sequence"
>>
>> first and check if moving the interrupt request after the
>> clockevents_config_and_register could fix your issue.
>
> I've tested this before, see:
>
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html

I could take or ack this patch trusting it fixes the issue but there are 
some points that need clarifications.

  - Does the spurious interrupt occurs *every* time ? at each boot ?

The previous patches were supposed to fix the issue but they actually 
didn't. So how is tested the patch ?

Regarding the different fixes for this problem, it sounds like you are 
proceeding by trial and error.

Please give a more detailed analysis of the problem and especially check 
the timer is not altered by the firmware leaving it in a transient state 
or whatever.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-08-20 14:28             ` Daniel Lezcano
  (?)
  (?)
@ 2015-08-21 14:39               ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-21 14:39 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Thu, 2015-08-20 at 16:28 +0200, Daniel Lezcano wrote:
> On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> > On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> >> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> >>> Spurious mtk timer interrupt is noticed at boot and cause kernel
> >>> crash. It seems if GPT is enabled, it will latch irq status even
> >>> when its IRQ is disabled.
> 
> It "seems" ?

Hi,

Datasheet doesn't mention detail. So I did some experiments, playing
around with registers. Based on my observation, I think this is what
happens:

For each GPT timer, it has ENABLE, IRQ_EN, IRQ status, IRQ_ACK, counter
& compare.

When mtk_timer_init calls mtk_timer_setup to setup GPT_CLK_EVT, it
enable the timer but didn't set counter or compare. Both counter &
compare is zero on reset, so GPT immediately raise IRQ status. IRQ_EN is
still disabled now, so it didn't trigger interrupt right away.

At end of mtk_timer_init, it calls mtk_timer_enable_irq to enable irq.
Since IRQ status is 1 now, GPT trigger interrupt immediately. The
interrupt is serviced by mtk_timer_interrupt. Since this is not an
expected event, evt->dev.event_handler will be NULL and system crashed
in the handler.

> >>> When irq is enabled afterward, we see
> >>> spurious interrupt.
> 
> Doesn't have the firmware something to do with that ?

We have 6 GPT on mt8173, mtk timer use 2 of them. The spurious interrupt
only happens on GPT_CLK_EVT (GPT1). Our firmware didn't touch that one,
so it is in reset default when mtk timer driver try to enable it.

> I have a mtk 8173 board I can use next week. How do you reproduce the 
> issue ?
>
> >>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >>>
> >>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> >>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> >>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> >>> ---
> >>>
> >>> Update to my patch [1], added __init as Daniel suggest. This is the
> >>> only patch that need to change in that series, so I only sent this one.
> >>>
> >>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >>>
> >>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >>>    1 file changed, 10 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> >>> index 68ab423..2ba5b66 100644
> >>> --- a/drivers/clocksource/mtk_timer.c
> >>> +++ b/drivers/clocksource/mtk_timer.c
> >>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >>>    }
> >>>
> >>> -static void
> >>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> >>> +				   u8 timer, u8 option, bool enable)
> >>>    {
> >>> +	u32 val;
> >>> +
> >>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
> >>>
> >>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>>
> >>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >>>
> >>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> >>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> >>> +	val = TIMER_CTRL_OP(option);
> >>> +	if (enable)
> >>> +		val |= TIMER_CTRL_ENABLE;
> >>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> >>
> >> Instead of the 'enable' new option, I prefer a test with 'timer' with a
> >> comment:
> >>
> >> 	/*
> >> 	 * the timer hw is broken in that way ... bla bla, so we only
> >> 	 * enable the clocksource ...
> >> 	 */
> >> 	if (timer == GPT_CLK_SRC)
> >> 		val |= TIMER_CTRL_ENABLE;
> >
> > Hi Daniel,
> >
> > Thanks for your review.
> > Since this bug happens to anyone using interrupt,
> 
> Can you elaborate ? I don't get the point.
> 
> > I'm not sure checking
> > timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> > change to this in next version.
> >> That said, can you have a look at commit 1096be08 ?
> >> "clockevents: sun5i: Fix setup_irq init sequence"
> >>
> >> first and check if moving the interrupt request after the
> >> clockevents_config_and_register could fix your issue.
> >
> > I've tested this before, see:
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html
> 
> I could take or ack this patch trusting it fixes the issue but there are 
> some points that need clarifications.
> 
>   - Does the spurious interrupt occurs *every* time ? at each boot ?

Yes. If you applied this series to enable mtk timer without this fix on
mt8173 or mt8135 you can reproduce it. It occurs for every boot.

It crash before uart driver is ready, so you'll have to use earlycon to
see the crash log.

> The previous patches were supposed to fix the issue but they actually 
> didn't. So how is tested the patch ?

I'm not sure. I believe Matthias test that one on mt6589, maybe it have
different behavior, or different timing.

> Regarding the different fixes for this problem, it sounds like you are 
> proceeding by trial and error.
> 
> Please give a more detailed analysis of the problem and especially check 
> the timer is not altered by the firmware leaving it in a transient state 
> or whatever.

See above for my analysis.
Thanks.

Joe.C



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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-21 14:39               ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-21 14:39 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Thu, 2015-08-20 at 16:28 +0200, Daniel Lezcano wrote:
> On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> > On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> >> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> >>> Spurious mtk timer interrupt is noticed at boot and cause kernel
> >>> crash. It seems if GPT is enabled, it will latch irq status even
> >>> when its IRQ is disabled.
> 
> It "seems" ?

Hi,

Datasheet doesn't mention detail. So I did some experiments, playing
around with registers. Based on my observation, I think this is what
happens:

For each GPT timer, it has ENABLE, IRQ_EN, IRQ status, IRQ_ACK, counter
& compare.

When mtk_timer_init calls mtk_timer_setup to setup GPT_CLK_EVT, it
enable the timer but didn't set counter or compare. Both counter &
compare is zero on reset, so GPT immediately raise IRQ status. IRQ_EN is
still disabled now, so it didn't trigger interrupt right away.

At end of mtk_timer_init, it calls mtk_timer_enable_irq to enable irq.
Since IRQ status is 1 now, GPT trigger interrupt immediately. The
interrupt is serviced by mtk_timer_interrupt. Since this is not an
expected event, evt->dev.event_handler will be NULL and system crashed
in the handler.

> >>> When irq is enabled afterward, we see
> >>> spurious interrupt.
> 
> Doesn't have the firmware something to do with that ?

We have 6 GPT on mt8173, mtk timer use 2 of them. The spurious interrupt
only happens on GPT_CLK_EVT (GPT1). Our firmware didn't touch that one,
so it is in reset default when mtk timer driver try to enable it.

> I have a mtk 8173 board I can use next week. How do you reproduce the 
> issue ?
>
> >>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >>>
> >>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> >>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> >>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> >>> ---
> >>>
> >>> Update to my patch [1], added __init as Daniel suggest. This is the
> >>> only patch that need to change in that series, so I only sent this one.
> >>>
> >>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >>>
> >>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >>>    1 file changed, 10 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> >>> index 68ab423..2ba5b66 100644
> >>> --- a/drivers/clocksource/mtk_timer.c
> >>> +++ b/drivers/clocksource/mtk_timer.c
> >>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >>>    }
> >>>
> >>> -static void
> >>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> >>> +				   u8 timer, u8 option, bool enable)
> >>>    {
> >>> +	u32 val;
> >>> +
> >>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
> >>>
> >>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>>
> >>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >>>
> >>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> >>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> >>> +	val = TIMER_CTRL_OP(option);
> >>> +	if (enable)
> >>> +		val |= TIMER_CTRL_ENABLE;
> >>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> >>
> >> Instead of the 'enable' new option, I prefer a test with 'timer' with a
> >> comment:
> >>
> >> 	/*
> >> 	 * the timer hw is broken in that way ... bla bla, so we only
> >> 	 * enable the clocksource ...
> >> 	 */
> >> 	if (timer == GPT_CLK_SRC)
> >> 		val |= TIMER_CTRL_ENABLE;
> >
> > Hi Daniel,
> >
> > Thanks for your review.
> > Since this bug happens to anyone using interrupt,
> 
> Can you elaborate ? I don't get the point.
> 
> > I'm not sure checking
> > timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> > change to this in next version.
> >> That said, can you have a look at commit 1096be08 ?
> >> "clockevents: sun5i: Fix setup_irq init sequence"
> >>
> >> first and check if moving the interrupt request after the
> >> clockevents_config_and_register could fix your issue.
> >
> > I've tested this before, see:
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html
> 
> I could take or ack this patch trusting it fixes the issue but there are 
> some points that need clarifications.
> 
>   - Does the spurious interrupt occurs *every* time ? at each boot ?

Yes. If you applied this series to enable mtk timer without this fix on
mt8173 or mt8135 you can reproduce it. It occurs for every boot.

It crash before uart driver is ready, so you'll have to use earlycon to
see the crash log.

> The previous patches were supposed to fix the issue but they actually 
> didn't. So how is tested the patch ?

I'm not sure. I believe Matthias test that one on mt6589, maybe it have
different behavior, or different timing.

> Regarding the different fixes for this problem, it sounds like you are 
> proceeding by trial and error.
> 
> Please give a more detailed analysis of the problem and especially check 
> the timer is not altered by the firmware leaving it in a transient state 
> or whatever.

See above for my analysis.
Thanks.

Joe.C

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-21 14:39               ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-21 14:39 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Thu, 2015-08-20 at 16:28 +0200, Daniel Lezcano wrote:
> On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> > On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> >> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> >>> Spurious mtk timer interrupt is noticed at boot and cause kernel
> >>> crash. It seems if GPT is enabled, it will latch irq status even
> >>> when its IRQ is disabled.
> 
> It "seems" ?

Hi,

Datasheet doesn't mention detail. So I did some experiments, playing
around with registers. Based on my observation, I think this is what
happens:

For each GPT timer, it has ENABLE, IRQ_EN, IRQ status, IRQ_ACK, counter
& compare.

When mtk_timer_init calls mtk_timer_setup to setup GPT_CLK_EVT, it
enable the timer but didn't set counter or compare. Both counter &
compare is zero on reset, so GPT immediately raise IRQ status. IRQ_EN is
still disabled now, so it didn't trigger interrupt right away.

At end of mtk_timer_init, it calls mtk_timer_enable_irq to enable irq.
Since IRQ status is 1 now, GPT trigger interrupt immediately. The
interrupt is serviced by mtk_timer_interrupt. Since this is not an
expected event, evt->dev.event_handler will be NULL and system crashed
in the handler.

> >>> When irq is enabled afterward, we see
> >>> spurious interrupt.
> 
> Doesn't have the firmware something to do with that ?

We have 6 GPT on mt8173, mtk timer use 2 of them. The spurious interrupt
only happens on GPT_CLK_EVT (GPT1). Our firmware didn't touch that one,
so it is in reset default when mtk timer driver try to enable it.

> I have a mtk 8173 board I can use next week. How do you reproduce the 
> issue ?
>
> >>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >>>
> >>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> >>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> >>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> >>> ---
> >>>
> >>> Update to my patch [1], added __init as Daniel suggest. This is the
> >>> only patch that need to change in that series, so I only sent this one.
> >>>
> >>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >>>
> >>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >>>    1 file changed, 10 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> >>> index 68ab423..2ba5b66 100644
> >>> --- a/drivers/clocksource/mtk_timer.c
> >>> +++ b/drivers/clocksource/mtk_timer.c
> >>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >>>    }
> >>>
> >>> -static void
> >>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> >>> +				   u8 timer, u8 option, bool enable)
> >>>    {
> >>> +	u32 val;
> >>> +
> >>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
> >>>
> >>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>>
> >>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >>>
> >>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> >>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> >>> +	val = TIMER_CTRL_OP(option);
> >>> +	if (enable)
> >>> +		val |= TIMER_CTRL_ENABLE;
> >>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> >>
> >> Instead of the 'enable' new option, I prefer a test with 'timer' with a
> >> comment:
> >>
> >> 	/*
> >> 	 * the timer hw is broken in that way ... bla bla, so we only
> >> 	 * enable the clocksource ...
> >> 	 */
> >> 	if (timer == GPT_CLK_SRC)
> >> 		val |= TIMER_CTRL_ENABLE;
> >
> > Hi Daniel,
> >
> > Thanks for your review.
> > Since this bug happens to anyone using interrupt,
> 
> Can you elaborate ? I don't get the point.
> 
> > I'm not sure checking
> > timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> > change to this in next version.
> >> That said, can you have a look at commit 1096be08 ?
> >> "clockevents: sun5i: Fix setup_irq init sequence"
> >>
> >> first and check if moving the interrupt request after the
> >> clockevents_config_and_register could fix your issue.
> >
> > I've tested this before, see:
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html
> 
> I could take or ack this patch trusting it fixes the issue but there are 
> some points that need clarifications.
> 
>   - Does the spurious interrupt occurs *every* time ? at each boot ?

Yes. If you applied this series to enable mtk timer without this fix on
mt8173 or mt8135 you can reproduce it. It occurs for every boot.

It crash before uart driver is ready, so you'll have to use earlycon to
see the crash log.

> The previous patches were supposed to fix the issue but they actually 
> didn't. So how is tested the patch ?

I'm not sure. I believe Matthias test that one on mt6589, maybe it have
different behavior, or different timing.

> Regarding the different fixes for this problem, it sounds like you are 
> proceeding by trial and error.
> 
> Please give a more detailed analysis of the problem and especially check 
> the timer is not altered by the firmware leaving it in a transient state 
> or whatever.

See above for my analysis.
Thanks.

Joe.C

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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-21 14:39               ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-21 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2015-08-20 at 16:28 +0200, Daniel Lezcano wrote:
> On 08/17/2015 04:10 PM, Yingjoe Chen wrote:
> > On Thu, 2015-08-13 at 10:35 +0200, Daniel Lezcano wrote:
> >> On 07/22/2015 10:14 AM, Yingjoe Chen wrote:
> >>> Spurious mtk timer interrupt is noticed at boot and cause kernel
> >>> crash. It seems if GPT is enabled, it will latch irq status even
> >>> when its IRQ is disabled.
> 
> It "seems" ?

Hi,

Datasheet doesn't mention detail. So I did some experiments, playing
around with registers. Based on my observation, I think this is what
happens:

For each GPT timer, it has ENABLE, IRQ_EN, IRQ status, IRQ_ACK, counter
& compare.

When mtk_timer_init calls mtk_timer_setup to setup GPT_CLK_EVT, it
enable the timer but didn't set counter or compare. Both counter &
compare is zero on reset, so GPT immediately raise IRQ status. IRQ_EN is
still disabled now, so it didn't trigger interrupt right away.

At end of mtk_timer_init, it calls mtk_timer_enable_irq to enable irq.
Since IRQ status is 1 now, GPT trigger interrupt immediately. The
interrupt is serviced by mtk_timer_interrupt. Since this is not an
expected event, evt->dev.event_handler will be NULL and system crashed
in the handler.

> >>> When irq is enabled afterward, we see
> >>> spurious interrupt.
> 
> Doesn't have the firmware something to do with that ?

We have 6 GPT on mt8173, mtk timer use 2 of them. The spurious interrupt
only happens on GPT_CLK_EVT (GPT1). Our firmware didn't touch that one,
so it is in reset default when mtk timer driver try to enable it.

> I have a mtk 8173 board I can use next week. How do you reproduce the 
> issue ?
>
> >>> Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.
> >>>
> >>> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> >>> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> >>> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> >>> ---
> >>>
> >>> Update to my patch [1], added __init as Daniel suggest. This is the
> >>> only patch that need to change in that series, so I only sent this one.
> >>>
> >>> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html
> >>>
> >>>    drivers/clocksource/mtk_timer.c | 16 ++++++++++------
> >>>    1 file changed, 10 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> >>> index 68ab423..2ba5b66 100644
> >>> --- a/drivers/clocksource/mtk_timer.c
> >>> +++ b/drivers/clocksource/mtk_timer.c
> >>> @@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> >>>    	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> >>>    }
> >>>
> >>> -static void
> >>> -mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>> +static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
> >>> +				   u8 timer, u8 option, bool enable)
> >>>    {
> >>> +	u32 val;
> >>> +
> >>>    	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
> >>>    		evt->gpt_base + TIMER_CTRL_REG(timer));
> >>>
> >>> @@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
> >>>
> >>>    	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
> >>>
> >>> -	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
> >>> -			evt->gpt_base + TIMER_CTRL_REG(timer));
> >>> +	val = TIMER_CTRL_OP(option);
> >>> +	if (enable)
> >>> +		val |= TIMER_CTRL_ENABLE;
> >>> +	writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));
> >>
> >> Instead of the 'enable' new option, I prefer a test with 'timer' with a
> >> comment:
> >>
> >> 	/*
> >> 	 * the timer hw is broken in that way ... bla bla, so we only
> >> 	 * enable the clocksource ...
> >> 	 */
> >> 	if (timer == GPT_CLK_SRC)
> >> 		val |= TIMER_CTRL_ENABLE;
> >
> > Hi Daniel,
> >
> > Thanks for your review.
> > Since this bug happens to anyone using interrupt,
> 
> Can you elaborate ? I don't get the point.
> 
> > I'm not sure checking
> > timer and only enable it for GPT_CLK_SRC is easier to read. Anyway, I'll
> > change to this in next version.
> >> That said, can you have a look at commit 1096be08 ?
> >> "clockevents: sun5i: Fix setup_irq init sequence"
> >>
> >> first and check if moving the interrupt request after the
> >> clockevents_config_and_register could fix your issue.
> >
> > I've tested this before, see:
> >
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000539.html
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000551.html
> 
> I could take or ack this patch trusting it fixes the issue but there are 
> some points that need clarifications.
> 
>   - Does the spurious interrupt occurs *every* time ? at each boot ?

Yes. If you applied this series to enable mtk timer without this fix on
mt8173 or mt8135 you can reproduce it. It occurs for every boot.

It crash before uart driver is ready, so you'll have to use earlycon to
see the crash log.

> The previous patches were supposed to fix the issue but they actually 
> didn't. So how is tested the patch ?

I'm not sure. I believe Matthias test that one on mt6589, maybe it have
different behavior, or different timing.

> Regarding the different fixes for this problem, it sounds like you are 
> proceeding by trial and error.
> 
> Please give a more detailed analysis of the problem and especially check 
> the timer is not altered by the firmware leaving it in a transient state 
> or whatever.

See above for my analysis.
Thanks.

Joe.C

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-08-21 14:39               ` Yingjoe Chen
  (?)
  (?)
@ 2015-08-24  7:51                 ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24  7:51 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 08/21/2015 04:39 PM, Yingjoe Chen wrote:

[ ... ]

>>    - Does the spurious interrupt occurs *every* time ? at each boot ?
>
> Yes. If you applied this series to enable mtk timer without this fix on
> mt8173 or mt8135 you can reproduce it. It occurs for every boot.
>
> It crash before uart driver is ready, so you'll have to use earlycon to
> see the crash log.

Can you give me the earlycon params ?

Thanks.

  -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24  7:51                 ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24  7:51 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Olof Johansson, Rob Herring,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sascha Hauer,
	Matthias Brugger, linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 08/21/2015 04:39 PM, Yingjoe Chen wrote:

[ ... ]

>>    - Does the spurious interrupt occurs *every* time ? at each boot ?
>
> Yes. If you applied this series to enable mtk timer without this fix on
> mt8173 or mt8135 you can reproduce it. It occurs for every boot.
>
> It crash before uart driver is ready, so you'll have to use earlycon to
> see the crash log.

Can you give me the earlycon params ?

Thanks.

  -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24  7:51                 ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24  7:51 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On 08/21/2015 04:39 PM, Yingjoe Chen wrote:

[ ... ]

>>    - Does the spurious interrupt occurs *every* time ? at each boot ?
>
> Yes. If you applied this series to enable mtk timer without this fix on
> mt8173 or mt8135 you can reproduce it. It occurs for every boot.
>
> It crash before uart driver is ready, so you'll have to use earlycon to
> see the crash log.

Can you give me the earlycon params ?

Thanks.

  -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24  7:51                 ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24  7:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/21/2015 04:39 PM, Yingjoe Chen wrote:

[ ... ]

>>    - Does the spurious interrupt occurs *every* time ? at each boot ?
>
> Yes. If you applied this series to enable mtk timer without this fix on
> mt8173 or mt8135 you can reproduce it. It occurs for every boot.
>
> It crash before uart driver is ready, so you'll have to use earlycon to
> see the crash log.

Can you give me the earlycon params ?

Thanks.

  -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-21 14:39               ` Yingjoe Chen
  (?)
@ 2015-08-24 13:30                 ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 13:30 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..13543a8 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+        /* Acknowledge all spurious pending interrupts */
+        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1


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

* [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 13:30                 ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 13:30 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..13543a8 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+        /* Acknowledge all spurious pending interrupts */
+        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1

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

* [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 13:30                 ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 13:30 UTC (permalink / raw)
  To: linux-arm-kernel

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..13543a8 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+        /* Acknowledge all spurious pending interrupts */
+        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
  2015-08-24  7:51                 ` Daniel Lezcano
  (?)
  (?)
@ 2015-08-24 14:22                   ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:22 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Mon, 2015-08-24 at 09:51 +0200, Daniel Lezcano wrote:
> On 08/21/2015 04:39 PM, Yingjoe Chen wrote:
> 
> [ ... ]
> 
> >>    - Does the spurious interrupt occurs *every* time ? at each boot ?
> >
> > Yes. If you applied this series to enable mtk timer without this fix on
> > mt8173 or mt8135 you can reproduce it. It occurs for every boot.
> >
> > It crash before uart driver is ready, so you'll have to use earlycon to
> > see the crash log.
> 
> Can you give me the earlycon params ?

Hi Daniel,

You probably already figure this out. anyway I'm using this to enable
earlycon:

Add 'earlycon' in bootargs, and in device tree chosen part, add
"linux,stdout-path=&uart0;"

Joe.C




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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24 14:22                   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:22 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Mon, 2015-08-24 at 09:51 +0200, Daniel Lezcano wrote:
> On 08/21/2015 04:39 PM, Yingjoe Chen wrote:
> 
> [ ... ]
> 
> >>    - Does the spurious interrupt occurs *every* time ? at each boot ?
> >
> > Yes. If you applied this series to enable mtk timer without this fix on
> > mt8173 or mt8135 you can reproduce it. It occurs for every boot.
> >
> > It crash before uart driver is ready, so you'll have to use earlycon to
> > see the crash log.
> 
> Can you give me the earlycon params ?

Hi Daniel,

You probably already figure this out. anyway I'm using this to enable
earlycon:

Add 'earlycon' in bootargs, and in device tree chosen part, add
"linux,stdout-path=&uart0;"

Joe.C

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

* Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24 14:22                   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:22 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Daniel Kurtz, Stephen Boyd, Thomas Gleixner, James Liao,
	Russell King, srv_heupstream, Arnd Bergmann,
	open list:OPEN FIRMWARE AND...,
	Catalin Marinas, Michael Turquette, linux-kernel, Olof Johansson,
	Rob Herring, linux-mediatek, Sascha Hauer, Matthias Brugger,
	linux-clk, linux-arm-kernel

On Mon, 2015-08-24 at 09:51 +0200, Daniel Lezcano wrote:
> On 08/21/2015 04:39 PM, Yingjoe Chen wrote:
> 
> [ ... ]
> 
> >>    - Does the spurious interrupt occurs *every* time ? at each boot ?
> >
> > Yes. If you applied this series to enable mtk timer without this fix on
> > mt8173 or mt8135 you can reproduce it. It occurs for every boot.
> >
> > It crash before uart driver is ready, so you'll have to use earlycon to
> > see the crash log.
> 
> Can you give me the earlycon params ?

Hi Daniel,

You probably already figure this out. anyway I'm using this to enable
earlycon:

Add 'earlycon' in bootargs, and in device tree chosen part, add
"linux,stdout-path=&uart0;"

Joe.C




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

* [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup
@ 2015-08-24 14:22                   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2015-08-24 at 09:51 +0200, Daniel Lezcano wrote:
> On 08/21/2015 04:39 PM, Yingjoe Chen wrote:
> 
> [ ... ]
> 
> >>    - Does the spurious interrupt occurs *every* time ? at each boot ?
> >
> > Yes. If you applied this series to enable mtk timer without this fix on
> > mt8173 or mt8135 you can reproduce it. It occurs for every boot.
> >
> > It crash before uart driver is ready, so you'll have to use earlycon to
> > see the crash log.
> 
> Can you give me the earlycon params ?

Hi Daniel,

You probably already figure this out. anyway I'm using this to enable
earlycon:

Add 'earlycon' in bootargs, and in device tree chosen part, add
"linux,stdout-path=&uart0;"

Joe.C

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

* Re: [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-24 13:30                 ` Daniel Lezcano
  (?)
@ 2015-08-24 14:35                   ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:35 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Mon, 2015-08-24 at 15:30 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
>
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Daniel,


Thanks for your patch, this can fix the boot issue.
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

> ---
>  drivers/clocksource/mtk_timer.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..13543a8 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +        /* Acknowledge all spurious pending interrupts */
> +        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);

This should use tab to indent.

> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -

I think we should keep this one, or at least disable irq first in
mtk_timer_enable_irq. MT8173 firmware didn't use this GPT, but I think
it is a good ideat to do it just in case firmware in some other platform
use it.

Joe.C



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

* Re: [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 14:35                   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:35 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Mon, 2015-08-24 at 15:30 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
>
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Daniel,


Thanks for your patch, this can fix the boot issue.
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

> ---
>  drivers/clocksource/mtk_timer.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..13543a8 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +        /* Acknowledge all spurious pending interrupts */
> +        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);

This should use tab to indent.

> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -

I think we should keep this one, or at least disable irq first in
mtk_timer_enable_irq. MT8173 firmware didn't use this GPT, but I think
it is a good ideat to do it just in case firmware in some other platform
use it.

Joe.C

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

* [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 14:35                   ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2015-08-24 at 15:30 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
>
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Daniel,


Thanks for your patch, this can fix the boot issue.
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

> ---
>  drivers/clocksource/mtk_timer.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..13543a8 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,9 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +        /* Acknowledge all spurious pending interrupts */
> +        writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);

This should use tab to indent.

> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +227,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -

I think we should keep this one, or at least disable irq first in
mtk_timer_enable_irq. MT8173 firmware didn't use this GPT, but I think
it is a good ideat to do it just in case firmware in some other platform
use it.

Joe.C

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-24 14:35                   ` Yingjoe Chen
  (?)
@ 2015-08-24 21:57                     ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 21:57 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..505f53d 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+	/* Disable all interrupts */
+	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
+
+	/* Acknowledge all spurious pending interrupts */
+	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1


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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 21:57                     ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 21:57 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..505f53d 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+	/* Disable all interrupts */
+	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
+
+	/* Acknowledge all spurious pending interrupts */
+	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-24 21:57                     ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-24 21:57 UTC (permalink / raw)
  To: linux-arm-kernel

After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4cd16fb..505f53d 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+	/* Disable all interrupts */
+	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
+
+	/* Acknowledge all spurious pending interrupts */
+	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.1

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-24 21:57                     ` Daniel Lezcano
  (?)
@ 2015-08-25 13:21                       ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-25 13:21 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Mon, 2015-08-24 at 23:57 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
> 
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..505f53d 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +	/* Disable all interrupts */
> +	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> +
> +	/* Acknowledge all spurious pending interrupts */
> +	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -
>  	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
>  			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
>  		pr_warn("failed to setup irq %d\n", evt->dev.irq);


Hi Daniel,


Thanks for your patch, tested on mt8173
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

Joe.C



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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-25 13:21                       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-25 13:21 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Mon, 2015-08-24 at 23:57 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
> 
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..505f53d 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +	/* Disable all interrupts */
> +	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> +
> +	/* Acknowledge all spurious pending interrupts */
> +	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -
>  	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
>  			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
>  		pr_warn("failed to setup irq %d\n", evt->dev.irq);


Hi Daniel,


Thanks for your patch, tested on mt8173
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

Joe.C

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-25 13:21                       ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-25 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2015-08-24 at 23:57 +0200, Daniel Lezcano wrote:
> After analysis done by Yingjoe Chen, the timer appears to have a pending
> interrupt when it is enabled.
> 
> Fix this by acknowledging the pending interrupt when enabling the timer
> interrupt.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/mtk_timer.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 4cd16fb..505f53d 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -156,14 +156,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
> -{
> -	/* Disable all interrupts */
> -	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> -	/* Acknowledge all interrupts */
> -	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> -}
> -
>  static void
>  mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
>  {
> @@ -183,6 +175,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
>  {
>  	u32 val;
>  
> +	/* Disable all interrupts */
> +	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
> +
> +	/* Acknowledge all spurious pending interrupts */
> +	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
> +
>  	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
>  	writel(val | GPT_IRQ_ENABLE(timer),
>  			evt->gpt_base + GPT_IRQ_EN_REG);
> @@ -232,8 +230,6 @@ static void __init mtk_timer_init(struct device_node *node)
>  	}
>  	rate = clk_get_rate(clk);
>  
> -	mtk_timer_global_reset(evt);
> -
>  	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
>  			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
>  		pr_warn("failed to setup irq %d\n", evt->dev.irq);


Hi Daniel,


Thanks for your patch, tested on mt8173
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>

Joe.C

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
  2015-07-13  9:32 ` Yingjoe Chen
@ 2015-08-26  7:37   ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-26  7:37 UTC (permalink / raw)
  To: Yingjoe Chen, Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao
  Cc: Russell King, devicetree, Arnd Bergmann, Catalin Marinas,
	linux-kernel, Rob Herring, linux-mediatek, Sascha Hauer,
	Olof Johansson, srv_heupstream, linux-arm-kernel, Daniel Kurtz,
	linux-clk

On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
> This series add GPT timer support for mt8173. This is based on v4.2-rc1
> and Matthias' next branch (for dts parts).
>
> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> series [1]. I decide to move these 2 patches to this series, since it
> is more relevent here. They are changed based on Matthias' and Daniel's
> comments.
>
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> Daniel Kurtz (1):
>    arm64: dts: mt8173: add timer node
>
> Yingjoe Chen (4):
>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>    clocksource: mediatek: Use GPT as sched clock source
>    arm64: mediatek: enable MTK_TIMER
>    clk: mediatek: add 13mhz clock for MT8173
>
>   arch/arm64/Kconfig                       |  1 +
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
>   drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
>   drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
>   include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
>   5 files changed, 37 insertions(+), 7 deletions(-)

Who will take this patchset ? I can take the patch 2 if needed.


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-26  7:37   ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-26  7:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
> This series add GPT timer support for mt8173. This is based on v4.2-rc1
> and Matthias' next branch (for dts parts).
>
> The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> series [1]. I decide to move these 2 patches to this series, since it
> is more relevent here. They are changed based on Matthias' and Daniel's
> comments.
>
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> Daniel Kurtz (1):
>    arm64: dts: mt8173: add timer node
>
> Yingjoe Chen (4):
>    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
>    clocksource: mediatek: Use GPT as sched clock source
>    arm64: mediatek: enable MTK_TIMER
>    clk: mediatek: add 13mhz clock for MT8173
>
>   arch/arm64/Kconfig                       |  1 +
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
>   drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
>   drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
>   include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
>   5 files changed, 37 insertions(+), 7 deletions(-)

Who will take this patchset ? I can take the patch 2 if needed.


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-26 14:10     ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-26 14:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King, devicetree,
	Arnd Bergmann, Catalin Marinas, linux-kernel, Rob Herring,
	linux-mediatek, Sascha Hauer, Olof Johansson, srv_heupstream,
	linux-arm-kernel, Daniel Kurtz, linux-clk

On Wed, 2015-08-26 at 09:37 +0200, Daniel Lezcano wrote:
> On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
> > This series add GPT timer support for mt8173. This is based on v4.2-rc1
> > and Matthias' next branch (for dts parts).
> >
> > The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> > series [1]. I decide to move these 2 patches to this series, since it
> > is more relevent here. They are changed based on Matthias' and Daniel's
> > comments.
> >
> > [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
> >
> > Daniel Kurtz (1):
> >    arm64: dts: mt8173: add timer node
> >
> > Yingjoe Chen (4):
> >    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
> >    clocksource: mediatek: Use GPT as sched clock source
> >    arm64: mediatek: enable MTK_TIMER
> >    clk: mediatek: add 13mhz clock for MT8173
> >
> >   arch/arm64/Kconfig                       |  1 +
> >   arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
> >   drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
> >   drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
> >   include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
> >   5 files changed, 37 insertions(+), 7 deletions(-)
> 
> Who will take this patchset ? I can take the patch 2 if needed.
> 
> 

Hi Daniel,

Please take patch 2 with your fix. Thanks.

I think patch 3(enable MTK_TIMER in Kconfig) and 5 (add timer node)
should go through Matthias' tree to arm-soc and patch 4(add 13mhz clock)
should go through James' mtk-clk tree to clk maintainer.

Joe.C



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

* Re: [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-26 14:10     ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-26 14:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Matthias Brugger, Thomas Gleixner, Stephen Boyd,
	Michael Turquette, James Liao, Russell King,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	Catalin Marinas, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Rob Herring, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Sascha Hauer, Olof Johansson,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Daniel Kurtz,
	linux-clk-u79uwXL29TY76Z2rM5mHXA

On Wed, 2015-08-26 at 09:37 +0200, Daniel Lezcano wrote:
> On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
> > This series add GPT timer support for mt8173. This is based on v4.2-rc1
> > and Matthias' next branch (for dts parts).
> >
> > The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> > series [1]. I decide to move these 2 patches to this series, since it
> > is more relevent here. They are changed based on Matthias' and Daniel's
> > comments.
> >
> > [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
> >
> > Daniel Kurtz (1):
> >    arm64: dts: mt8173: add timer node
> >
> > Yingjoe Chen (4):
> >    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
> >    clocksource: mediatek: Use GPT as sched clock source
> >    arm64: mediatek: enable MTK_TIMER
> >    clk: mediatek: add 13mhz clock for MT8173
> >
> >   arch/arm64/Kconfig                       |  1 +
> >   arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
> >   drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
> >   drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
> >   include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
> >   5 files changed, 37 insertions(+), 7 deletions(-)
> 
> Who will take this patchset ? I can take the patch 2 if needed.
> 
> 

Hi Daniel,

Please take patch 2 with your fix. Thanks.

I think patch 3(enable MTK_TIMER in Kconfig) and 5 (add timer node)
should go through Matthias' tree to arm-soc and patch 4(add 13mhz clock)
should go through James' mtk-clk tree to clk maintainer.

Joe.C


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 0/5] add GPT timer support for mt8173
@ 2015-08-26 14:10     ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-08-26 14:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-08-26 at 09:37 +0200, Daniel Lezcano wrote:
> On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
> > This series add GPT timer support for mt8173. This is based on v4.2-rc1
> > and Matthias' next branch (for dts parts).
> >
> > The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
> > series [1]. I decide to move these 2 patches to this series, since it
> > is more relevent here. They are changed based on Matthias' and Daniel's
> > comments.
> >
> > [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
> >
> > Daniel Kurtz (1):
> >    arm64: dts: mt8173: add timer node
> >
> > Yingjoe Chen (4):
> >    clocksource: mediatek: do not enable GPT_CLK_EVT when setup
> >    clocksource: mediatek: Use GPT as sched clock source
> >    arm64: mediatek: enable MTK_TIMER
> >    clk: mediatek: add 13mhz clock for MT8173
> >
> >   arch/arm64/Kconfig                       |  1 +
> >   arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +++++++++
> >   drivers/clk/mediatek/clk-mt8173.c        |  5 +++++
> >   drivers/clocksource/mtk_timer.c          | 26 ++++++++++++++++++++------
> >   include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
> >   5 files changed, 37 insertions(+), 7 deletions(-)
> 
> Who will take this patchset ? I can take the patch 2 if needed.
> 
> 

Hi Daniel,

Please take patch 2 with your fix. Thanks.

I think patch 3(enable MTK_TIMER in Kconfig) and 5 (add timer node)
should go through Matthias' tree to arm-soc and patch 4(add 13mhz clock)
should go through James' mtk-clk tree to clk maintainer.

Joe.C

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-25 13:21                       ` Yingjoe Chen
  (?)
@ 2015-08-26 14:25                         ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-26 14:25 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>

Applied to my tree for 4.4.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-26 14:25                         ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-26 14:25 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>

Applied to my tree for 4.4.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-08-26 14:25                         ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-08-26 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>

Applied to my tree for 4.4.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-26 14:25                         ` Daniel Lezcano
  (?)
@ 2015-09-04  7:15                           ` Yingjoe Chen
  -1 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-09-04  7:15 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> > Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
> 
> Applied to my tree for 4.4.
> 
>    -- Daniel
> 

Hi Daniel,

I can't find this patch in
https://git.linaro.org/people/daniel.lezcano/linux.git
Is this tree public now? Where can I see it?

Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
clock source" in your tree?

Joe.C

[1]:
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html



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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-09-04  7:15                           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-09-04  7:15 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> > Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
> 
> Applied to my tree for 4.4.
> 
>    -- Daniel
> 

Hi Daniel,

I can't find this patch in
https://git.linaro.org/people/daniel.lezcano/linux.git
Is this tree public now? Where can I see it?

Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
clock source" in your tree?

Joe.C

[1]:
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-09-04  7:15                           ` Yingjoe Chen
  0 siblings, 0 replies; 131+ messages in thread
From: Yingjoe Chen @ 2015-09-04  7:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
> > Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
> 
> Applied to my tree for 4.4.
> 
>    -- Daniel
> 

Hi Daniel,

I can't find this patch in
https://git.linaro.org/people/daniel.lezcano/linux.git
Is this tree public now? Where can I see it?

Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
clock source" in your tree?

Joe.C

[1]:
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-09-04  7:15                           ` Yingjoe Chen
  (?)
@ 2015-09-04  7:36                             ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-09-04  7:36 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On 09/04/2015 09:15 AM, Yingjoe Chen wrote:
> On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>     -- Daniel
>>
>
> Hi Daniel,
>
> I can't find this patch in
> https://git.linaro.org/people/daniel.lezcano/linux.git
> Is this tree public now? Where can I see it?
>
> Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
> clock source" in your tree?

Yep. I did not push my branch. Done.

Note it will be also available for linux-next.

Thanks for the head up.

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-09-04  7:36                             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-09-04  7:36 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, matthias.bgg, open list:CLOCKSOURCE,
	CLOC..., moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...

On 09/04/2015 09:15 AM, Yingjoe Chen wrote:
> On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>     -- Daniel
>>
>
> Hi Daniel,
>
> I can't find this patch in
> https://git.linaro.org/people/daniel.lezcano/linux.git
> Is this tree public now? Where can I see it?
>
> Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
> clock source" in your tree?

Yep. I did not push my branch. Done.

Note it will be also available for linux-next.

Thanks for the head up.

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-09-04  7:36                             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-09-04  7:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/04/2015 09:15 AM, Yingjoe Chen wrote:
> On Wed, 2015-08-26 at 16:25 +0200, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>     -- Daniel
>>
>
> Hi Daniel,
>
> I can't find this patch in
> https://git.linaro.org/people/daniel.lezcano/linux.git
> Is this tree public now? Where can I see it?
>
> Also, will you take patch[1] "clocksource: mediatek: Use GPT as sched
> clock source" in your tree?

Yep. I did not push my branch. Done.

Note it will be also available for linux-next.

Thanks for the head up.

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-08-26 14:25                         ` Daniel Lezcano
  (?)
@ 2015-10-27 11:11                           ` Matthias Brugger
  -1 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-10-27 11:11 UTC (permalink / raw)
  To: Daniel Lezcano, Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...,
	Kevin Hilman

Hi Daniel,

On 26/08/15 16:25, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>
> Applied to my tree for 4.4.
>
>    -- Daniel
>

Kevin found a regression in v4.3 which will need this patch to fix it 
[1]. Can you apply it to your clockevents/4.3-fixes branch please.

Thanks,
Matthias

[1] https://lkml.org/lkml/2015/10/26/211

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:11                           ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-10-27 11:11 UTC (permalink / raw)
  To: Daniel Lezcano, Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...,
	Kevin Hilman

Hi Daniel,

On 26/08/15 16:25, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>
> Applied to my tree for 4.4.
>
>    -- Daniel
>

Kevin found a regression in v4.3 which will need this patch to fix it 
[1]. Can you apply it to your clockevents/4.3-fixes branch please.

Thanks,
Matthias

[1] https://lkml.org/lkml/2015/10/26/211

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:11                           ` Matthias Brugger
  0 siblings, 0 replies; 131+ messages in thread
From: Matthias Brugger @ 2015-10-27 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Daniel,

On 26/08/15 16:25, Daniel Lezcano wrote:
> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>
> Applied to my tree for 4.4.
>
>    -- Daniel
>

Kevin found a regression in v4.3 which will need this patch to fix it 
[1]. Can you apply it to your clockevents/4.3-fixes branch please.

Thanks,
Matthias

[1] https://lkml.org/lkml/2015/10/26/211

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:23                             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:23 UTC (permalink / raw)
  To: Matthias Brugger, Yingjoe Chen
  Cc: djkurtz, sboyd, tglx, jamesjj.liao, linux, srv_heupstream, arnd,
	catalin.marinas, kernel, open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...,
	Kevin Hilman, Thomas Gleixner

On 10/27/2015 12:11 PM, Matthias Brugger wrote:
> Hi Daniel,
>
> On 26/08/15 16:25, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>    -- Daniel
>>
>
> Kevin found a regression in v4.3 which will need this patch to fix it
> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>
> Thanks,
> Matthias
>
> [1] https://lkml.org/lkml/2015/10/26/211

Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.

Let me look how to backport this fix without introducing a conflict when 
tip/timers/urgent will be merged to tip/timers/core.

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:23                             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:23 UTC (permalink / raw)
  To: Matthias Brugger, Yingjoe Chen
  Cc: jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w,
	linux-lFZ/pmaqli7XmaaqVzeoHQ, arnd-r2nGTMty4D4,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Kevin Hilman,
	catalin.marinas-5wv7dgnIgG8, sboyd-sgV2jX0FEOL9JmXXK+q4OQ,
	open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Thomas Gleixner,
	moderated list:ARM/Mediatek SoC...

On 10/27/2015 12:11 PM, Matthias Brugger wrote:
> Hi Daniel,
>
> On 26/08/15 16:25, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>    -- Daniel
>>
>
> Kevin found a regression in v4.3 which will need this patch to fix it
> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>
> Thanks,
> Matthias
>
> [1] https://lkml.org/lkml/2015/10/26/211

Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.

Let me look how to backport this fix without introducing a conflict when 
tip/timers/urgent will be merged to tip/timers/core.

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:23                             ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/27/2015 12:11 PM, Matthias Brugger wrote:
> Hi Daniel,
>
> On 26/08/15 16:25, Daniel Lezcano wrote:
>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>
>> Applied to my tree for 4.4.
>>
>>    -- Daniel
>>
>
> Kevin found a regression in v4.3 which will need this patch to fix it
> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>
> Thanks,
> Matthias
>
> [1] https://lkml.org/lkml/2015/10/26/211

Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.

Let me look how to backport this fix without introducing a conflict when 
tip/timers/urgent will be merged to tip/timers/core.

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
  2015-10-27 11:23                             ` Daniel Lezcano
  (?)
@ 2015-10-27 11:47                               ` Daniel Lezcano
  -1 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:47 UTC (permalink / raw)
  To: Yingjoe Chen, tglx
  Cc: Matthias Brugger, djkurtz, sboyd, jamesjj.liao, linux,
	srv_heupstream, arnd, catalin.marinas, kernel,
	open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...,
	Kevin Hilman

On 10/27/2015 12:23 PM, Daniel Lezcano wrote:
> On 10/27/2015 12:11 PM, Matthias Brugger wrote:
>> Hi Daniel,
>>
>> On 26/08/15 16:25, Daniel Lezcano wrote:
>>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>>
>>> Applied to my tree for 4.4.
>>>
>>>    -- Daniel
>>>
>>
>> Kevin found a regression in v4.3 which will need this patch to fix it
>> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>>
>> Thanks,
>> Matthias
>>
>> [1] https://lkml.org/lkml/2015/10/26/211
>
> Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.
>
> Let me look how to backport this fix without introducing a conflict when
> tip/timers/urgent will be merged to tip/timers/core.

Thomas,

do you think I can cherry-pick from tip/timers/core or clockevents/4.4 
directly the fix to be pulled into clockevents/4.3-fixes ? That will 
certainly raise a conflict when tip/timers/urgent will be merged to 
tip/timers/core (a trivial conflict actually).

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:47                               ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:47 UTC (permalink / raw)
  To: Yingjoe Chen, tglx
  Cc: Matthias Brugger, djkurtz, sboyd, jamesjj.liao, linux,
	srv_heupstream, arnd, catalin.marinas, kernel,
	open list:CLOCKSOURCE, CLOC...,
	moderated list:ARM/Mediatek SoC...,
	moderated list:ARM/Mediatek SoC...,
	Kevin Hilman

On 10/27/2015 12:23 PM, Daniel Lezcano wrote:
> On 10/27/2015 12:11 PM, Matthias Brugger wrote:
>> Hi Daniel,
>>
>> On 26/08/15 16:25, Daniel Lezcano wrote:
>>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>>
>>> Applied to my tree for 4.4.
>>>
>>>    -- Daniel
>>>
>>
>> Kevin found a regression in v4.3 which will need this patch to fix it
>> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>>
>> Thanks,
>> Matthias
>>
>> [1] https://lkml.org/lkml/2015/10/26/211
>
> Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.
>
> Let me look how to backport this fix without introducing a conflict when
> tip/timers/urgent will be merged to tip/timers/core.

Thomas,

do you think I can cherry-pick from tip/timers/core or clockevents/4.4 
directly the fix to be pulled into clockevents/4.3-fixes ? That will 
certainly raise a conflict when tip/timers/urgent will be merged to 
tip/timers/core (a trivial conflict actually).

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH V2] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
@ 2015-10-27 11:47                               ` Daniel Lezcano
  0 siblings, 0 replies; 131+ messages in thread
From: Daniel Lezcano @ 2015-10-27 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/27/2015 12:23 PM, Daniel Lezcano wrote:
> On 10/27/2015 12:11 PM, Matthias Brugger wrote:
>> Hi Daniel,
>>
>> On 26/08/15 16:25, Daniel Lezcano wrote:
>>> On 08/25/2015 03:21 PM, Yingjoe Chen wrote:
>>>> Tested-by: Yingjoe Chen<yingjoe.chen@mediatek.com>
>>>
>>> Applied to my tree for 4.4.
>>>
>>>    -- Daniel
>>>
>>
>> Kevin found a regression in v4.3 which will need this patch to fix it
>> [1]. Can you apply it to your clockevents/4.3-fixes branch please.
>>
>> Thanks,
>> Matthias
>>
>> [1] https://lkml.org/lkml/2015/10/26/211
>
> Hmm, I thought it wasn't impacting 4.3, so it went to 4.4.
>
> Let me look how to backport this fix without introducing a conflict when
> tip/timers/urgent will be merged to tip/timers/core.

Thomas,

do you think I can cherry-pick from tip/timers/core or clockevents/4.4 
directly the fix to be pulled into clockevents/4.3-fixes ? That will 
certainly raise a conflict when tip/timers/urgent will be merged to 
tip/timers/core (a trivial conflict actually).

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2015-10-27 11:47 UTC | newest]

Thread overview: 131+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-13  9:32 [PATCH 0/5] add GPT timer support for mt8173 Yingjoe Chen
2015-07-13  9:32 ` Yingjoe Chen
2015-07-13  9:32 ` Yingjoe Chen
2015-07-13  9:32 ` [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-14  7:39   ` Daniel Kurtz
2015-07-14  7:39     ` Daniel Kurtz
2015-07-14  7:39     ` Daniel Kurtz
2015-07-22  8:14     ` [PATCH v2 " Yingjoe Chen
2015-07-22  8:14       ` Yingjoe Chen
2015-07-22  8:14       ` Yingjoe Chen
2015-07-22  8:14       ` Yingjoe Chen
2015-07-31  3:14       ` Yingjoe Chen
2015-07-31  3:14         ` Yingjoe Chen
2015-07-31  3:14         ` Yingjoe Chen
2015-07-31  3:14         ` Yingjoe Chen
2015-08-13  8:35       ` Daniel Lezcano
2015-08-13  8:35         ` Daniel Lezcano
2015-08-13  8:35         ` Daniel Lezcano
2015-08-17 14:10         ` Yingjoe Chen
2015-08-17 14:10           ` Yingjoe Chen
2015-08-17 14:10           ` Yingjoe Chen
2015-08-17 14:10           ` Yingjoe Chen
2015-08-20 14:28           ` Daniel Lezcano
2015-08-20 14:28             ` Daniel Lezcano
2015-08-20 14:28             ` Daniel Lezcano
2015-08-21 14:39             ` Yingjoe Chen
2015-08-21 14:39               ` Yingjoe Chen
2015-08-21 14:39               ` Yingjoe Chen
2015-08-21 14:39               ` Yingjoe Chen
2015-08-24  7:51               ` Daniel Lezcano
2015-08-24  7:51                 ` Daniel Lezcano
2015-08-24  7:51                 ` Daniel Lezcano
2015-08-24  7:51                 ` Daniel Lezcano
2015-08-24 14:22                 ` Yingjoe Chen
2015-08-24 14:22                   ` Yingjoe Chen
2015-08-24 14:22                   ` Yingjoe Chen
2015-08-24 14:22                   ` Yingjoe Chen
2015-08-24 13:30               ` [PATCH] clockevents/drivers/mtk: Fix spurious interrupt leading to crash Daniel Lezcano
2015-08-24 13:30                 ` Daniel Lezcano
2015-08-24 13:30                 ` Daniel Lezcano
2015-08-24 14:35                 ` Yingjoe Chen
2015-08-24 14:35                   ` Yingjoe Chen
2015-08-24 14:35                   ` Yingjoe Chen
2015-08-24 21:57                   ` [PATCH V2] " Daniel Lezcano
2015-08-24 21:57                     ` Daniel Lezcano
2015-08-24 21:57                     ` Daniel Lezcano
2015-08-25 13:21                     ` Yingjoe Chen
2015-08-25 13:21                       ` Yingjoe Chen
2015-08-25 13:21                       ` Yingjoe Chen
2015-08-26 14:25                       ` Daniel Lezcano
2015-08-26 14:25                         ` Daniel Lezcano
2015-08-26 14:25                         ` Daniel Lezcano
2015-09-04  7:15                         ` Yingjoe Chen
2015-09-04  7:15                           ` Yingjoe Chen
2015-09-04  7:15                           ` Yingjoe Chen
2015-09-04  7:36                           ` Daniel Lezcano
2015-09-04  7:36                             ` Daniel Lezcano
2015-09-04  7:36                             ` Daniel Lezcano
2015-10-27 11:11                         ` Matthias Brugger
2015-10-27 11:11                           ` Matthias Brugger
2015-10-27 11:11                           ` Matthias Brugger
2015-10-27 11:23                           ` Daniel Lezcano
2015-10-27 11:23                             ` Daniel Lezcano
2015-10-27 11:23                             ` Daniel Lezcano
2015-10-27 11:47                             ` Daniel Lezcano
2015-10-27 11:47                               ` Daniel Lezcano
2015-10-27 11:47                               ` Daniel Lezcano
2015-07-22  8:24     ` [PATCH 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup Yingjoe Chen
2015-07-22  8:24       ` Yingjoe Chen
2015-07-22  8:24       ` Yingjoe Chen
2015-07-22  8:24       ` Yingjoe Chen
2015-07-17 21:56   ` Matthias Brugger
2015-07-17 21:56     ` Matthias Brugger
2015-07-17 21:56     ` Matthias Brugger
2015-07-13  9:32 ` [PATCH 2/5] clocksource: mediatek: Use GPT as sched clock source Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-14  0:40   ` Stephen Boyd
2015-07-14  0:40     ` Stephen Boyd
2015-07-14  0:40     ` Stephen Boyd
2015-07-17 21:49   ` Matthias Brugger
2015-07-17 21:49     ` Matthias Brugger
2015-07-17 21:49     ` Matthias Brugger
2015-07-13  9:32 ` [PATCH 3/5] arm64: mediatek: enable MTK_TIMER Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-17 21:54   ` Matthias Brugger
2015-07-17 21:54     ` Matthias Brugger
2015-07-18  7:31     ` Thomas Gleixner
2015-07-18  7:31       ` Thomas Gleixner
2015-07-18  7:31       ` Thomas Gleixner
2015-07-21  7:52       ` Matthias Brugger
2015-07-21  7:52         ` Matthias Brugger
2015-07-21  7:52         ` Matthias Brugger
2015-07-13  9:32 ` [PATCH 4/5] clk: mediatek: add 13mhz clock for MT8173 Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-14  0:40   ` Stephen Boyd
2015-07-14  0:40     ` Stephen Boyd
2015-07-14  0:40     ` Stephen Boyd
2015-07-14  7:34   ` Daniel Kurtz
2015-07-14  7:34     ` Daniel Kurtz
2015-07-14  7:34     ` Daniel Kurtz
2015-07-14  7:34     ` Daniel Kurtz
2015-07-13  9:32 ` [PATCH 5/5] arm64: dts: mt8173: add timer node Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-13  9:32   ` Yingjoe Chen
2015-07-14  4:26   ` Daniel Kurtz
2015-07-14  4:26     ` Daniel Kurtz
2015-07-14  4:26     ` Daniel Kurtz
2015-07-14  4:27     ` Daniel Kurtz
2015-07-14  4:27       ` Daniel Kurtz
2015-07-14  4:27       ` Daniel Kurtz
2015-07-14  4:27       ` Daniel Kurtz
2015-08-11 15:54 ` [PATCH 0/5] add GPT timer support for mt8173 Daniel Kurtz
2015-08-11 15:54   ` Daniel Kurtz
2015-08-11 15:54   ` Daniel Kurtz
2015-08-12 12:32   ` Daniel Lezcano
2015-08-12 12:32     ` Daniel Lezcano
2015-08-12 12:32     ` Daniel Lezcano
2015-08-13  4:49     ` Daniel Kurtz
2015-08-13  4:49       ` Daniel Kurtz
2015-08-13  4:49       ` Daniel Kurtz
2015-08-13  4:49       ` Daniel Kurtz
2015-08-26  7:37 ` Daniel Lezcano
2015-08-26  7:37   ` Daniel Lezcano
2015-08-26 14:10   ` Yingjoe Chen
2015-08-26 14:10     ` Yingjoe Chen
2015-08-26 14:10     ` Yingjoe Chen

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.