linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support
@ 2014-09-05  5:02 Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Xiubo Li @ 2014-09-05  5:02 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Xiubo Li

Change in v2:
- Follows Thomas Gleixner advice.


Xiubo Li (4):
  Clocksource: Flextimer: Use internal clocksource read API.
  Clocksource: Flextimer: Remove the useless code.
  Clocksource: Flextimer: Set cpumask to cpu_possible_mask
  Clocksource: Flextimer: Fix counter clock prescaler calculation.

 drivers/clocksource/fsl_ftm_timer.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

-- 
2.1.0.27.g96db324


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

* [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API.
  2014-09-05  5:02 [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support Xiubo Li
@ 2014-09-05  5:02 ` Xiubo Li
  2014-09-05 15:40   ` Thomas Gleixner
  2014-09-05  5:02 ` [PATCHv2 2/4] Clocksource: Flextimer: Remove the useless code Xiubo Li
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Xiubo Li @ 2014-09-05  5:02 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Xiubo Li

Since the Flextimer device will be implemented in BE mode on
LS1 SoC, and in LE mode on Vybrid, LS2 SoCs, so here we need
the endianness judgment before doing the mmio.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/fsl_ftm_timer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index 454227d..9c6e935 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -226,6 +226,11 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq)
 	return 0;
 }
 
+static cycle_t ftm_clocksource_read_up(struct clocksource *c)
+{
+	return ftm_readl(priv->clksrc_base + FTM_CNT) & 0xffff;
+}
+
 static int __init ftm_clocksource_init(unsigned long freq)
 {
 	int err;
@@ -238,7 +243,7 @@ static int __init ftm_clocksource_init(unsigned long freq)
 	sched_clock_register(ftm_read_sched_clock, 16, freq / (1 << priv->ps));
 	err = clocksource_mmio_init(priv->clksrc_base + FTM_CNT, "fsl-ftm",
 				    freq / (1 << priv->ps), 300, 16,
-				    clocksource_mmio_readl_up);
+				    ftm_clocksource_read_up);
 	if (err) {
 		pr_err("ftm: init clock source mmio failed: %d\n", err);
 		return err;
-- 
2.1.0.27.g96db324


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

* [PATCHv2 2/4] Clocksource: Flextimer: Remove the useless code.
  2014-09-05  5:02 [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
@ 2014-09-05  5:02 ` Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 3/4] Clocksource: Flextimer: Set cpumask to cpu_possible_mask Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 4/4] Clocksource: Flextimer: Fix counter clock prescaler calculation Xiubo Li
  3 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2014-09-05  5:02 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Xiubo Li

The clock envnt counter will be enabled in proper time and proper
place when needed.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/fsl_ftm_timer.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index 9c6e935..ccb8c32 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -221,8 +221,6 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq)
 					freq / (1 << priv->ps),
 					1, 0xffff);
 
-	ftm_counter_enable(priv->clkevt_base);
-
 	return 0;
 }
 
-- 
2.1.0.27.g96db324


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

* [PATCHv2 3/4] Clocksource: Flextimer: Set cpumask to cpu_possible_mask
  2014-09-05  5:02 [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 2/4] Clocksource: Flextimer: Remove the useless code Xiubo Li
@ 2014-09-05  5:02 ` Xiubo Li
  2014-09-05  5:02 ` [PATCHv2 4/4] Clocksource: Flextimer: Fix counter clock prescaler calculation Xiubo Li
  3 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2014-09-05  5:02 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Xiubo Li

The Flextimer is not tied to CPU0, make it usable on any CPU.
For Vybrid there is only one CPU, while for LS1+ there are more
than one.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/fsl_ftm_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index ccb8c32..c0ce603 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -214,7 +214,7 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq)
 		return err;
 	}
 
-	ftm_clockevent.cpumask = cpumask_of(0);
+	ftm_clockevent.cpumask = cpu_all_mask;
 	ftm_clockevent.irq = irq;
 
 	clockevents_config_and_register(&ftm_clockevent,
-- 
2.1.0.27.g96db324


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

* [PATCHv2 4/4] Clocksource: Flextimer: Fix counter clock prescaler calculation.
  2014-09-05  5:02 [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support Xiubo Li
                   ` (2 preceding siblings ...)
  2014-09-05  5:02 ` [PATCHv2 3/4] Clocksource: Flextimer: Set cpumask to cpu_possible_mask Xiubo Li
@ 2014-09-05  5:02 ` Xiubo Li
  3 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2014-09-05  5:02 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Xiubo Li

The old code will use the uncorrect clock prescaler after the
loop and the 'ps' must minus one after the loop.

This patch will use new style of this loop and will fix this bug
at the same time.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/fsl_ftm_timer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index c0ce603..2b0983d 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -300,16 +300,15 @@ static unsigned long __init ftm_clk_init(struct device_node *np)
 
 static int __init ftm_calc_closest_round_cyc(unsigned long freq)
 {
-	priv->ps = 0;
+	int div;
 
 	/* The counter register is only using the lower 16 bits, and
 	 * if the 'freq' value is to big here, then the periodic_cyc
 	 * may exceed 0xFFFF.
 	 */
-	do {
-		priv->periodic_cyc = DIV_ROUND_CLOSEST(freq,
-						HZ * (1 << priv->ps++));
-	} while (priv->periodic_cyc > 0xFFFF);
+	for (priv->ps = 0, priv->periodic_cyc = ~0UL, div = HZ;
+	     priv->periodic_cyc > 0xffff; priv->ps++, div *= 2)
+		priv->periodic_cyc = DIV_ROUND_CLOSEST(freq, div);
 
 	if (priv->ps > FTM_PS_MAX) {
 		pr_err("ftm: the prescaler is %lu > %d\n",
-- 
2.1.0.27.g96db324


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

* Re: [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API.
  2014-09-05  5:02 ` [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
@ 2014-09-05 15:40   ` Thomas Gleixner
  2014-09-09  1:55     ` Li.Xiubo
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2014-09-05 15:40 UTC (permalink / raw)
  To: Xiubo Li; +Cc: daniel.lezcano, linux-kernel

On Fri, 5 Sep 2014, Xiubo Li wrote:

> Since the Flextimer device will be implemented in BE mode on
> LS1 SoC, and in LE mode on Vybrid, LS2 SoCs, so here we need
> the endianness judgment before doing the mmio.

WTF? I explained you in great length HOW you should solve that, but
you just ignore it. Instead of trying to understand what I say you
just resend the same nonsense again.

Keep that attitude up, if you want to make sure, that your patches are
ignored in the future.

Thanks,

	tglx

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

* RE: [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API.
  2014-09-05 15:40   ` Thomas Gleixner
@ 2014-09-09  1:55     ` Li.Xiubo
  0 siblings, 0 replies; 7+ messages in thread
From: Li.Xiubo @ 2014-09-09  1:55 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: daniel.lezcano, linux-kernel

Hi Thomas,

Okay.

I will try to fix this.

Thanks,

BRs
Xiubo




> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Friday, September 05, 2014 11:40 PM
> To: Xiubo Li-B47053
> Cc: daniel.lezcano@linaro.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource
> read API.
> 
> On Fri, 5 Sep 2014, Xiubo Li wrote:
> 
> > Since the Flextimer device will be implemented in BE mode on
> > LS1 SoC, and in LE mode on Vybrid, LS2 SoCs, so here we need
> > the endianness judgment before doing the mmio.
> 
> WTF? I explained you in great length HOW you should solve that, but
> you just ignore it. Instead of trying to understand what I say you
> just resend the same nonsense again.
> 
> Keep that attitude up, if you want to make sure, that your patches are
> ignored in the future.
> 
> Thanks,
> 
> 	tglx

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

end of thread, other threads:[~2014-09-09  1:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-05  5:02 [PATCHv2 0/4] Clocksource: Flextimer: add LS1 support Xiubo Li
2014-09-05  5:02 ` [PATCHv2 1/4] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
2014-09-05 15:40   ` Thomas Gleixner
2014-09-09  1:55     ` Li.Xiubo
2014-09-05  5:02 ` [PATCHv2 2/4] Clocksource: Flextimer: Remove the useless code Xiubo Li
2014-09-05  5:02 ` [PATCHv2 3/4] Clocksource: Flextimer: Set cpumask to cpu_possible_mask Xiubo Li
2014-09-05  5:02 ` [PATCHv2 4/4] Clocksource: Flextimer: Fix counter clock prescaler calculation Xiubo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).