Skip to contentSkip to conversation

get rid of <mach/timex.h>

GIT PULL New Uwe Kleine-König 6 participants 15 messages Dec 13, 2013 – Feb 17, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hello,

the following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

for you to fetch changes up to c24eb46490c8232c08c82cd591ba332284d257b2:

ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too (2013-12-07 23:31:28 +0100)

I'd like to get these changes into 3.14-rc1, so it would be great if you could take it into armsoc for some exposure into next.

The kbuild test robot is happy with these changes, and I did several build tests, too, so I don't expect any breakage.

Merging this series will result in a few merge conflicts. I pushed a branch dropmachtimexh-merged into my repository where you can see how I resolved them merging in current next/master into my tag.

----------------------------------------------------------------
This cleanup series gets rid of <mach/timex.h> for platforms not using ARCH_MULTIPLATFORM. (For multi-platform code it's already unused since 387798b (ARM: initial multiplatform support).)

To make this work some code out of arch/arm needed to be adapted. Apart from two changes in drivers/rtc I got the relevant maintainer Acks. For the rtc changes I didn't get any feedback by Alexandro Zummo since I posted the first change 5 weeks ago despite pinging it several times. The current state seems to be that Andrew Morton takes odd fixes, but I couldn't get him to give an Ack either. (One of the two patches is in his queue, but I expect him to drop that as soon as the patch makes it in via another path. Didn't get any feedback here, too.)

----------------------------------------------------------------
Linus Walleij (1):
ARM/serial: at91: switch atmel serial to use gpiolib

Uwe Kleine-K?nig (11):
rtc: at91sam9: include <mach/hardware.h> explicitly
rtc: pxa: drop unused #define TIMER_FREQ
clocksource: sirf/marco+prima2: drop usage of CLOCK_TICK_RATE
ARM: sa1100: stop using mach/timex.h
ARM: netx: stop using mach/timex.h
ARM: mmp: stop using mach/timex.h
ARM: ep93xx: stop using mach/timex.h
ARM: at91: don't use <mach/timex.h>
input: ixp4xx-beeper: don't use symbols from <mach/timex.h>
ARM: ixp4xx: stop using <mach/timex.h>
ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too

 .../devicetree/bindings/serial/atmel-usart.txt     |  3 ++
 arch/arm/include/asm/timex.h                       |  6 ---
 arch/arm/mach-at91/at91rm9200.c                    |  1 +
 arch/arm/mach-at91/at91rm9200_devices.c            | 11 ++++-
 arch/arm/mach-at91/at91rm9200_time.c               |  1 +
 arch/arm/mach-at91/at91sam9260.c                   |  1 +
 arch/arm/mach-at91/at91sam9260_devices.c           |  8 ++++
 arch/arm/mach-at91/at91sam9261.c                   |  1 +
 arch/arm/mach-at91/at91sam9261_devices.c           |  5 +++
 arch/arm/mach-at91/at91sam9263.c                   |  1 +
 arch/arm/mach-at91/at91sam9263_devices.c           |  5 +++
 arch/arm/mach-at91/at91sam926x_time.c              |  1 +
 arch/arm/mach-at91/at91sam9g45.c                   |  1 +
 arch/arm/mach-at91/at91sam9g45_devices.c           |  6 +++
 arch/arm/mach-at91/at91sam9rl.c                    |  1 +
 arch/arm/mach-at91/at91sam9rl_devices.c            |  6 +++
 arch/arm/mach-at91/at91x40.c                       |  2 +-
 arch/arm/mach-at91/at91x40_time.c                  |  1 +
 arch/arm/mach-at91/board-gsia18s.c                 |  1 +
 arch/arm/mach-at91/board-pcontrol-g20.c            |  1 +
 arch/arm/mach-at91/board-stamp9g20.c               |  1 +
 arch/arm/mach-at91/include/mach/at91x40.h          |  2 +
 arch/arm/mach-at91/include/mach/timex.h            | 37 ----------------
 arch/arm/mach-at91/pm.c                            |  1 +
 arch/arm/mach-clps711x/include/mach/timex.h        |  2 -
 arch/arm/mach-davinci/include/mach/timex.h         | 22 ----------
 arch/arm/mach-dove/include/mach/timex.h            |  9 ----
 arch/arm/mach-ebsa110/include/mach/timex.h         | 19 ---------
 arch/arm/mach-ep93xx/core.c                        |  2 +-
 arch/arm/mach-ep93xx/include/mach/timex.h          |  5 ---
 arch/arm/mach-exynos/include/mach/timex.h          | 29 -------------
 arch/arm/mach-footbridge/include/mach/timex.h      | 18 --------
 arch/arm/mach-gemini/include/mach/timex.h          | 13 ------
 arch/arm/mach-integrator/include/mach/timex.h      | 26 ------------
 arch/arm/mach-iop13xx/include/mach/timex.h         |  1 -
 arch/arm/mach-iop32x/include/mach/timex.h          |  6 ---
 arch/arm/mach-iop33x/include/mach/timex.h          |  6 ---
 arch/arm/mach-ixp4xx/common.c                      |  3 +-
 arch/arm/mach-ixp4xx/include/mach/timex.h          | 16 -------
 arch/arm/mach-kirkwood/include/mach/timex.h        | 10 -----
 arch/arm/mach-ks8695/include/mach/timex.h          | 21 ----------
 arch/arm/mach-lpc32xx/include/mach/timex.h         | 28 -------------
 arch/arm/mach-mmp/include/mach/timex.h             | 13 ------
 arch/arm/mach-mmp/time.c                           | 12 ++++--
 arch/arm/mach-msm/include/mach/timex.h             | 21 ----------
 arch/arm/mach-mv78xx0/include/mach/timex.h         |  9 ----
 arch/arm/mach-netx/include/mach/timex.h            | 20 ---------
 arch/arm/mach-netx/time.c                          |  6 ++-
 arch/arm/mach-omap1/include/mach/timex.h           |  5 ---
 arch/arm/mach-omap2/include/mach/timex.h           |  5 ---
 arch/arm/mach-orion5x/include/mach/timex.h         | 11 -----
 arch/arm/mach-pxa/include/mach/timex.h             | 34 ---------------
 arch/arm/mach-realview/include/mach/timex.h        | 23 ----------
 arch/arm/mach-rpc/include/mach/timex.h             | 17 --------
 arch/arm/mach-s3c24xx/include/mach/timex.h         | 24 -----------
 arch/arm/mach-s3c64xx/include/mach/timex.h         | 24 -----------
 arch/arm/mach-s5p64x0/include/mach/timex.h         | 27 ------------
 arch/arm/mach-s5pc100/include/mach/timex.h         | 24 -----------
 arch/arm/mach-s5pv210/include/mach/timex.h         | 29 -------------
 arch/arm/mach-sa1100/include/mach/timex.h          | 12 ------
 arch/arm/mach-sa1100/time.c                        |  4 +-
 arch/arm/mach-shmobile/include/mach/timex.h        |  6 ---
 arch/arm/mach-spear/include/mach/timex.h           | 19 ---------
 arch/arm/mach-versatile/include/mach/timex.h       | 23 ----------
 arch/arm/mach-w90x900/include/mach/timex.h         | 25 -----------
 arch/arm/plat-omap/include/plat/timex.h            | 33 ---------------
 drivers/clocksource/timer-marco.c                  | 13 +++---
 drivers/clocksource/timer-prima2.c                 | 16 ++++---
 drivers/input/misc/ixp4xx-beeper.c                 |  2 +-
 drivers/rtc/rtc-at91sam9.c                         |  2 +-
 drivers/rtc/rtc-pxa.c                              |  1 -
 drivers/tty/serial/atmel_serial.c                  | 49 ++++++++++++++--------
 include/linux/platform_data/atmel.h                |  1 +
 73 files changed, 128 insertions(+), 722 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/timex.h
 delete mode 100644 arch/arm/mach-clps711x/include/mach/timex.h
 delete mode 100644 arch/arm/mach-davinci/include/mach/timex.h
 delete mode 100644 arch/arm/mach-dove/include/mach/timex.h
 delete mode 100644 arch/arm/mach-ebsa110/include/mach/timex.h
 delete mode 100644 arch/arm/mach-ep93xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-exynos/include/mach/timex.h
 delete mode 100644 arch/arm/mach-footbridge/include/mach/timex.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/timex.h
 delete mode 100644 arch/arm/mach-integrator/include/mach/timex.h
 delete mode 100644 arch/arm/mach-iop13xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-iop32x/include/mach/timex.h
 delete mode 100644 arch/arm/mach-iop33x/include/mach/timex.h
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-kirkwood/include/mach/timex.h
 delete mode 100644 arch/arm/mach-ks8695/include/mach/timex.h
 delete mode 100644 arch/arm/mach-lpc32xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-mmp/include/mach/timex.h
 delete mode 100644 arch/arm/mach-msm/include/mach/timex.h
 delete mode 100644 arch/arm/mach-mv78xx0/include/mach/timex.h
 delete mode 100644 arch/arm/mach-netx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-omap1/include/mach/timex.h
 delete mode 100644 arch/arm/mach-omap2/include/mach/timex.h
 delete mode 100644 arch/arm/mach-orion5x/include/mach/timex.h
 delete mode 100644 arch/arm/mach-pxa/include/mach/timex.h
 delete mode 100644 arch/arm/mach-realview/include/mach/timex.h
 delete mode 100644 arch/arm/mach-rpc/include/mach/timex.h
 delete mode 100644 arch/arm/mach-s3c24xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/timex.h
 delete mode 100644 arch/arm/mach-s5p64x0/include/mach/timex.h
 delete mode 100644 arch/arm/mach-s5pc100/include/mach/timex.h
 delete mode 100644 arch/arm/mach-s5pv210/include/mach/timex.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/timex.h
 delete mode 100644 arch/arm/mach-shmobile/include/mach/timex.h
 delete mode 100644 arch/arm/mach-spear/include/mach/timex.h
 delete mode 100644 arch/arm/mach-versatile/include/mach/timex.h
 delete mode 100644 arch/arm/mach-w90x900/include/mach/timex.h
 delete mode 100644 arch/arm/plat-omap/include/plat/timex.h
#1 lore raw

Hello,

Quoted 27 lines · Uwe Kleine-K?nig

the following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

for you to fetch changes up to c24eb46490c8232c08c82cd591ba332284d257b2:

ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too (2013-12-07 23:31:28 +0100)

I'd like to get these changes into 3.14-rc1, so it would be great if you could take it into armsoc for some exposure into next.

The kbuild test robot is happy with these changes, and I did several build tests, too, so I don't expect any breakage.

Merging this series will result in a few merge conflicts. I pushed a branch dropmachtimexh-merged into my repository where you can see how I resolved them merging in current next/master into my tag.

----------------------------------------------------------------
This cleanup series gets rid of <mach/timex.h> for platforms not using ARCH_MULTIPLATFORM. (For multi-platform code it's already unused since 387798b (ARM: initial multiplatform support).)

Quoted 7 lines

To make this work some code out of arch/arm needed to be adapted. Apart from two changes in drivers/rtc I got the relevant maintainer Acks. For the rtc changes I didn't get any feedback by Alexandro Zummo since I posted the first change 5 weeks ago despite pinging it several times. The current state seems to be that Andrew Morton takes odd fixes, but I couldn't get him to give an Ack either. (One of the two patches is in his queue, but I expect him to drop that as soon as the patch makes it in via another path. Didn't get any feedback here, too.)

In the meantime I got Acks for the rtc changes by apkm. I updated my tag to include these two. It now points on b5ea554282d15d14270e5a5ff80418d8d6410f85. The tag-log is updated accordingly:

------
This cleanup series gets rid of <mach/timex.h> for platforms not using ARCH_MULTIPLATFORM. (For multi-platform code it's already unused since 387798b (ARM: initial multiplatform support).)

To make this work some code out of arch/arm needed to be adapted. The respective changes got acks by their maintainers to be taken via armsoc (with Andrew Morton substituting for Alessandro Zummo as rtc maintainer).
------

The patches are unchanged.

Please pull for 3.14-rc1.

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw
In reply to Uwe Kleine-König

Hi Uwe,

Quoted 17 lines · Uwe Kleine-K?nig

Hello,

the following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

for you to fetch changes up to c24eb46490c8232c08c82cd591ba332284d257b2:

ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too (2013-12-07 23:31:28 +0100)

I'd like to get these changes into 3.14-rc1, so it would be great if you could take it into armsoc for some exposure into next.

Quoted 6 lines

The kbuild test robot is happy with these changes, and I did several build tests, too, so I don't expect any breakage.

Merging this series will result in a few merge conflicts. I pushed a branch dropmachtimexh-merged into my repository where you can see how I resolved them merging in current next/master into my tag.

I pulled this into our arm-soc/to-build for build and boot testing and there was quite a few defconfigs that did not build (ignore the at91 failures, those are my fault):

http://lists.linaro.org/pipermail/kernel-build-reports/2013-December/001573.html

Looks like there are still several users of LATCH, which references CLOCK_TICK_RATE and is causing failures on lots of defconfigs.

I tried a few of those same defconfig builds on your merged branch and it has the same build failures.

Kevin

#3 lore raw

PATCH 1/1 ARM: rpc: stop using <mach/timex.h>

The rpc timekeeping code uses the symbol LATCH which depends on CLOCK_TICK_RATE which is defined in rpc's <mach/timex.h>. As this header will go away in a later patch introduce a local variable holding the same value as LATCH and use that instead.

---
 arch/arm/mach-rpc/time.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm/mach-rpc/time.c +9 -6
index 9a6def1..99363ae 100644
@@ -24,6 +24,9 @@
 
 #include <asm/mach/time.h>
 
+#define RPC_CLOCK_FREQ 2000000
+#define RPC_LATCH DIV_ROUND_CLOSEST(RPC_CLOCK_FREQ, HZ)
+
 static u32 ioc_timer_gettimeoffset(void)
 {
 	unsigned int count1, count2, status;
@@ -46,23 +49,23 @@ static u32 ioc_timer_gettimeoffset(void)
 		 * and count2.
 		 */
 		if (status & (1 << 5))
-			offset -= LATCH;
+			offset -= RPC_LATCH;
 	} else if (count2 > count1) {
 		/*
 		 * We have just had another interrupt between reading
 		 * count1 and count2.
 		 */
-		offset -= LATCH;
+		offset -= RPC_LATCH;
 	}
 
-	offset = (LATCH - offset) * (tick_nsec / 1000);
-	return ((offset + LATCH/2) / LATCH) * 1000;
+	offset = (RPC_LATCH - offset) * (tick_nsec / 1000);
+	return DIV_ROUND_CLOSEST(offset, RPC_LATCH) * 1000;
 }
 
 void __init ioctime_init(void)
 {
-	ioc_writeb(LATCH & 255, IOC_T0LTCHL);
-	ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
+	ioc_writeb(RPC_LATCH & 255, IOC_T0LTCHL);
+	ioc_writeb(RPC_LATCH >> 8, IOC_T0LTCHH);
 	ioc_writeb(0, IOC_T0GO);
 }
 
Signature · 1 line
1.8.4.4
#4 lore raw
In reply to Kevin Hilman

Hello,

Quoted 26 lines · Kevin Hilman
Quoted 17 lines · Uwe Kleine-K?nig

Hello,

the following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

for you to fetch changes up to c24eb46490c8232c08c82cd591ba332284d257b2:

ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too (2013-12-07 23:31:28 +0100)

I'd like to get these changes into 3.14-rc1, so it would be great if you could take it into armsoc for some exposure into next.

Quoted 6 lines

The kbuild test robot is happy with these changes, and I did several build tests, too, so I don't expect any breakage.

Merging this series will result in a few merge conflicts. I pushed a branch dropmachtimexh-merged into my repository where you can see how I resolved them merging in current next/master into my tag.

Quoted 8 lines

I pulled this into our arm-soc/to-build for build and boot testing and there was quite a few defconfigs that did not build (ignore the at91 failures, those are my fault):

   http://lists.linaro.org/pipermail/kernel-build-reports/2013-December/001573.html

Looks like there are still several users of LATCH, which references CLOCK_TICK_RATE and is causing failures on lots of defconfigs.

darn, I missed these because my compile testing was done without removing the dummy value of CLOCK_TICK_RATE in <asm/timex.h> and I then relied on the 0day bot who obviously didn't build the critical configs. :-\

The problems are fixed by:
- "ARM: rpc: stop using <mach/timex.h>" which I just sent in this thread.
- "ARM: u300: fix timekeeping when periodic mode is used", a patch I sent earlier and that Linus W. wanted to merge. It's not yet in -next. Maybe I can take it instead into this series? Linus?
- The patch pasted below distributed on the respective commits. Apart from the netx patch these don't have any affected acks. Sascha, I assume I can keep your Ack?

I'll update my tree when I have feedback by Linus and Sascha.

Best regards
Uwe

arch/arm/mach-ixp4xx/common.c +2 -1
index 967ddc2..20b62aa 100644
@@ -45,6 +45,7 @@
 #include <asm/mach/time.h>
 
 #define IXP4XX_TIMER_FREQ 66666000
+#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)
 
 static void __init ixp4xx_clocksource_init(void);
 static void __init ixp4xx_clockevent_init(void);
@@ -521,7 +522,7 @@ static void ixp4xx_set_mode(enum clock_event_mode mode,
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		osrt = LATCH & ~IXP4XX_OST_RELOAD_MASK;
+		osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK;
  		opts = IXP4XX_OST_ENABLE;
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
arch/arm/mach-netx/time.c +3 -2
index 0e29902..e234601 100644
@@ -29,6 +29,7 @@
 #include <mach/netx-regs.h>
 
 #define NETX_CLOCK_FREQ 100000000
+#define NETX_LATCH DIV_ROUND_CLOSEST(NETX_CLOCK_FREQ, HZ)
 
 #define TIMER_CLOCKEVENT 0
 #define TIMER_CLOCKSOURCE 1
@@ -43,7 +44,7 @@ static void netx_set_mode(enum clock_event_mode mode,
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		writel(LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
+		writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
 		tmode = NETX_GPIO_COUNTER_CTRL_RST_EN |
 			NETX_GPIO_COUNTER_CTRL_IRQ_EN |
 			NETX_GPIO_COUNTER_CTRL_RUN;
@@ -116,7 +117,7 @@ void __init netx_timer_init(void)
 	/* Reset the timer value to zero */
 	writel(0, NETX_GPIO_COUNTER_CURRENT(0));
 
-	writel(LATCH, NETX_GPIO_COUNTER_MAX(0));
+	writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(0));
 
 	/* acknowledge interrupt */
 	writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
arch/arm/mach-sa1100/time.c +3 -1
index 83be0d6..b4e7f2d 100644
@@ -9,6 +9,7 @@
  *
  */
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -21,6 +22,7 @@
 #include <mach/irqs.h>
 
 #define SA1100_CLOCK_FREQ 3686400
+#define SA1100_LATCH DIV_ROUND_CLOSEST(SA1100_CLOCK_FREQ, HZ)
 
 static u32 notrace sa1100_read_sched_clock(void)
 {
@@ -95,7 +97,7 @@ static void sa1100_timer_resume(struct clock_event_device *cedev)
 	/*
 	 * OSMR0 is the system timer: make sure OSCR is sufficiently behind
 	 */
-	writel_relaxed(OSMR0 - LATCH, OSCR);
+	writel_relaxed(OSMR0 - SA1100_LATCH, OSCR);
 }
 #else
 #define sa1100_timer_suspend NULL
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#5 lore raw
Quoted 3 lines · Uwe Kleine-K?nig

- "ARM: u300: fix timekeeping when periodic mode is used", a patch I sent earlier and that Linus W. wanted to merge. It's not yet in -next. Maybe I can take it instead into this series? Linus?

I have planned a U300 pull request and I thought I had fixed it, but apparently it fell off the planet :-(

I will send it right now, mea culpa.

Yours,
Linus Walleij

#6 lore raw
In reply to Uwe Kleine-König
Quoted 7 lines · Uwe Kleine-K?nig

Hello,

darn, I missed these because my compile testing was done without removing the dummy value of CLOCK_TICK_RATE in <asm/timex.h> and I then relied on the 0day bot who obviously didn't build the critical configs. :-\

Quoted 9 lines

The problems are fixed by:
- "ARM: rpc: stop using <mach/timex.h>" which I just sent in this thread.
- "ARM: u300: fix timekeeping when periodic mode is used", a patch I sent earlier and that Linus W. wanted to merge. It's not yet in -next. Maybe I can take it instead into this series? Linus?
- The patch pasted below distributed on the respective commits. Apart from the netx patch these don't have any affected acks. Sascha, I assume I can keep your Ack?

Yes, go ahead.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#7 lore raw
In reply to Uwe Kleine-König

Hello again,

Quoted 18 lines · Uwe Kleine-K?nig
Quoted 2 lines · Kevin Hilman

Looks like there are still several users of LATCH, which references CLOCK_TICK_RATE and is causing failures on lots of defconfigs.

darn, I missed these because my compile testing was done without removing the dummy value of CLOCK_TICK_RATE in <asm/timex.h> and I then relied on the 0day bot who obviously didn't build the critical configs. :-\

The problems are fixed by:
- "ARM: rpc: stop using <mach/timex.h>" which I just sent in this thread.
- "ARM: u300: fix timekeeping when periodic mode is used", a patch I sent earlier and that Linus W. wanted to merge. It's not yet in -next. Maybe I can take it instead into this series? Linus?
- The patch pasted below distributed on the respective commits. Apart from the netx patch these don't have any affected acks. Sascha, I assume I can keep your Ack?

Quoted 1 line

I'll update my tree when I have feedback by Linus and Sascha.

I just did that. I squashed the changes into the respective commits, rebased on Linus W.'s latest pull request and added the rpc change. Now all defconfigs build.

Please pull

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

which points to 79f08d9ed217318b4f325b7fcf8f26dcd0e41689 now provided you are happy with Linus W.'s series, too.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw

On 20/12/2013 19:47, Uwe Kleine-K?nig :

Quoted 26 lines

Hello again,

Quoted 18 lines · Uwe Kleine-K?nig
Quoted 2 lines · Kevin Hilman

Looks like there are still several users of LATCH, which references CLOCK_TICK_RATE and is causing failures on lots of defconfigs.

darn, I missed these because my compile testing was done without removing the dummy value of CLOCK_TICK_RATE in <asm/timex.h> and I then relied on the 0day bot who obviously didn't build the critical configs. :-\

The problems are fixed by:
- "ARM: rpc: stop using <mach/timex.h>" which I just sent in this thread.
- "ARM: u300: fix timekeeping when periodic mode is used", a patch I sent earlier and that Linus W. wanted to merge. It's not yet in -next. Maybe I can take it instead into this series? Linus?
- The patch pasted below distributed on the respective commits. Apart from the netx patch these don't have any affected acks. Sascha, I assume I can keep your Ack?

Quoted 1 line

I'll update my tree when I have feedback by Linus and Sascha.

I just did that. I squashed the changes into the respective commits, rebased on Linus W.'s latest pull request and added the rpc change. Now all defconfigs build.

Quoted 6 lines

Please pull

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

which points to 79f08d9ed217318b4f325b7fcf8f26dcd0e41689 now provided you are happy with Linus W.'s series, too.

Hi all,

Is this pull-request is foreseen to be integrated in arm-soc for 3.14? I may have some material for Linus W. that I would like to queue that depend on these patches.

Bye,

Signature · 1 line
Nicolas Ferre
#9 lore raw
Quoted 6 lines · Nicolas Ferre

On 20/12/2013 19:47, Uwe Kleine-K?nig :

Quoted 4 lines

Please pull

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

Quoted 8 lines
Quoted 2 lines

which points to 79f08d9ed217318b4f325b7fcf8f26dcd0e41689 now provided you are happy with Linus W.'s series, too.

Hi all,

Is this pull-request is foreseen to be integrated in arm-soc for 3.14? I may have some material for Linus W. that I would like to queue that depend on these patches.

I'd like to know the status here. If the <timex.h> material is not going into v3.14 I'd very much like my single patch to the serial driver to go in, and the removal of AT91's <mach/gpio.h>.

In that case I'm requesting an ACK on the ARM portions from the ARM SoC folks, so I can take it through the GPIO tree.

Yours,
Linus Walleij

#10 lore raw
Quoted 12 lines · Linus Walleij
Quoted 11 lines · Nicolas Ferre

On 20/12/2013 19:47, Uwe Kleine-K?nig :

Quoted 6 lines

Please pull

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

which points to 79f08d9ed217318b4f325b7fcf8f26dcd0e41689 now provided you are happy with Linus W.'s series, too.

Hi all,

Quoted 7 lines
Quoted 3 lines

Is this pull-request is foreseen to be integrated in arm-soc for 3.14? I may have some material for Linus W. that I would like to queue that depend on these patches.

I'd like to know the status here. If the <timex.h> material is not going into v3.14 I'd very much like my single patch to the serial driver to go in, and the removal of AT91's <mach/gpio.h>.

Uwe made it a pain to review these patches, so it's taking a while. Instead of removing the header contents in the same commit, he just adds to the non-include-file code so I have to manually go find the right include file, check the value, and then move to the next one. Since he removes the headers in the last change that means checking out a different tree back and forth.

Quoted 2 lines

In that case I'm requesting an ACK on the ARM portions from the ARM SoC folks, so I can take it through the GPIO tree.

Most of the series looks OK, but the IXP4xx change looks fishy. This is exactly why I wanted to get the header touched at the same time. It says:

/*
* We use IXP425 General purpose timer for our timer needs, it runs at
* 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
* timer register ignores the bottom 2 bits of the LATCH value. */
#define IXP4XX_TIMER_FREQ 66666000

#define CLOCK_TICK_RATE \
        (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)

But all he does in the C file now is:

+#define IXP4XX_TIMER_FREQ 66666000
+#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)

So it seems that this code is now broken. Uwe?

-Olof

#11 lore raw

Hello Olof,

Quoted 21 lines · Olof Johansson
Quoted 12 lines · Linus Walleij
Quoted 11 lines · Nicolas Ferre

On 20/12/2013 19:47, Uwe Kleine-K?nig :

Quoted 6 lines

Please pull

git://git.pengutronix.de/git/ukl/linux.git tags/dropmachtimexh

which points to 79f08d9ed217318b4f325b7fcf8f26dcd0e41689 now provided you are happy with Linus W.'s series, too.

Hi all,

Quoted 7 lines
Quoted 3 lines

Is this pull-request is foreseen to be integrated in arm-soc for 3.14? I may have some material for Linus W. that I would like to queue that depend on these patches.

I'd like to know the status here. If the <timex.h> material is not going into v3.14 I'd very much like my single patch to the serial driver to go in, and the removal of AT91's <mach/gpio.h>.

Quoted 6 lines

Uwe made it a pain to review these patches, so it's taking a while. Instead of removing the header contents in the same commit, he just adds to the non-include-file code so I have to manually go find the right include file, check the value, and then move to the next one. Since he removes the headers in the last change that means checking out a different tree back and forth.

It wasn't that hard to create the patches. I had two terminals open, one to write the patch and the other to check the mainline tree. For you it would have been your MUA and a mainline tree. Then for a touched driver, determine the timex.h, and lookup the values there.
Moreover conceptually it's wrong to drop the values in the same patch as the local definition is added. Consider dropping the timex.h files results in a regression. Then you would have to revert the whole series. Now it's only the last patch.

Quoted 24 lines
Quoted 2 lines

In that case I'm requesting an ACK on the ARM portions from the ARM SoC folks, so I can take it through the GPIO tree.

Most of the series looks OK, but the IXP4xx change looks fishy. This is exactly why I wanted to get the header touched at the same time. It says:

/*
* We use IXP425 General purpose timer for our timer needs, it runs at
* 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
* timer register ignores the bottom 2 bits of the LATCH value. */
#define IXP4XX_TIMER_FREQ 66666000

#define CLOCK_TICK_RATE \
        (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)

But all he does in the C file now is:

(quoted diff) +2 -0
+#define IXP4XX_TIMER_FREQ 66666000
+#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)
Quoted 1 line

So it seems that this code is now broken. Uwe?

I remember that I wondered about that code and noticing that

	#define IXP4XX_OST_RELOAD_MASK 0x00000003

and IXP4XX_TIMER_FREQ being a multiple from HZ (100) results in

	IXP4XX_TIMER_FREQ / HZ == IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK

and multiplying that with HZ results in IXP4XX_TIMER_FREQ again. The only problem I see just now is that I didn't pay attention to the +1.

Quoted 1 line

From a quick glance I'd say the calculation is wrong, but still it's out

of the scope of my patch to fix that.

The old state is:

	#define IXP4XX_TIMER_FREQ 66666000
	#define CLOCK_TICK_RATE (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
	#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)

which results in CLOCK_TICK_RATE = 66666100 and LATCH = 666661 = 0xa2c25 which has one of the two bottom bits set, so I assume this results in an effective value of 666660 being used resulting in a cycle time of exactly 0.01s.

I'm using plain 66666000 / 100 so at least it doesn't result in a regression.

The more correct approach would be:

/*
* The timer register ignores the bottom 2 bits of the LATCH value
* i.e. assumes them being zero no matter what is written to them.
* So make sure IXP4XX_LATCH is the best value with the two least
* significant bits unset.
*/
#define IXP4XX_TIMER_FREQ 66666000
#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, 4 * HZ) * 4

As said above for the actuall values it doesn't matter, but if IXP4XX_TIMER_FREQ was 66665999 that would result in a cycle time of 0.0099999401494 with the old code but
0.01000000015 with my suggestion above.

I think the old calculation of CLOCK_TICK_RATE was more correct back when LATCH was defined as simply CLOCK_TICK_RATE / HZ. But even that I think it was wrong.

Imre, Krzysztof: care to comment?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#12 lore raw

RFC PATCH 1/1 ARM: ixp4xx: fix timer latch calculation

In commit f0402f9b4711 ("ARM: ixp4xx: stop using <mach/timex.h>") I didn't intend to implement a functional change, but as Olof noticed I failed---at least a bit. Before this commit the following was used to determine the latch value used:

	#define IXP4XX_TIMER_FREQ 66666000
	#define CLOCK_TICK_RATE \
		(((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
	#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)

The complicated calculation was done "b/c the timer register ignores the bottom 2 bits of the LATCH value." With HZ=100 CLOCK_TICK_RATE used to calculate to 66666100 and so LATCH to 666661. In ixp4xx_set_mode the term

LATCH & ~IXP4XX_OST_RELOAD_MASK

was used to write to the relevant register (with IXP4XX_OST_RELOAD_MASK being 3) and so effectively 666660 was used.

In commit f0402f9b4711 I translated that to:

	#define IXP4XX_TIMER_FREQ 66666000
	#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)

which results in the same register writes, but still doesn't bear in mind that the two least significant bits cannot be specified (which is relevant only when HZ or IXP4XX_TIMER_FREQ are changed).

Instead of reverting back to the old approach use a more obvious and also more correct way to calculate LATCH. (Regarding the more correct claim: With IXP4XX_TIMER_FREQ == 66665999, the old code resulted in LATCH = 666657 corresponding to a cycle time of 0.009999940149400597 seconds (error: -6.0e-8 s) while the new approach results in LATCH = 666660 and so a cycle time of 0.010000000150001503 seconds (error: 1.5e-10 s).)

Fixes f0402f9b4711 ("ARM: ixp4xx: stop using <mach/timex.h>")

---
Hello,

I didn't hear anything back from the ixp4xx maintainers, I didn't find a reference manual and I don't have an ixp4xx machine to test this patch. Still I'm confident it works as expected and results in a more exact clock calculation than both before and after my patch.

Olof requested this to be a seperate patch to not need to reverify the rest of the series. Does this make the series ready to be merged for 3.15 now? If so, should I send a new pull request with this patch applied on top of the old request or do you handle that yourself?

Best regards
Uwe

 arch/arm/mach-ixp4xx/common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-ixp4xx/common.c +9 -1
index 20b62aa30086..37e6cdac1642 100644
@@ -45,7 +45,15 @@
 #include <asm/mach/time.h>
 
 #define IXP4XX_TIMER_FREQ 66666000
-#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)
+
+/*
+ * The timer register doesn't allow to specify the two least significant bits of
+ * the timeout value and assumes them being zero. So make sure IXP4XX_LATCH is
+ * the best value with the two least significant bits unset.
+ */
+#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, \
+				       (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \
+			(IXP4XX_OST_RELOAD_MASK + 1)
 
 static void __init ixp4xx_clocksource_init(void);
 static void __init ixp4xx_clockevent_init(void);
Signature · 1 line
1.8.5.3
#13 lore raw

RFC PATCH 1/1 ARM: ixp4xx: fix timer latch calculation

Hello Olof,

I'd like to remove the timex.h cleanup from my todo list as done. How can we get forward here?

Best regards
Uwe

Quoted 87 lines · Uwe Kleine-K?nig

In commit f0402f9b4711 ("ARM: ixp4xx: stop using <mach/timex.h>") I didn't intend to implement a functional change, but as Olof noticed I failed---at least a bit. Before this commit the following was used to determine the latch value used:

	#define IXP4XX_TIMER_FREQ 66666000
	#define CLOCK_TICK_RATE \
		(((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
	#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)

The complicated calculation was done "b/c the timer register ignores the bottom 2 bits of the LATCH value." With HZ=100 CLOCK_TICK_RATE used to calculate to 66666100 and so LATCH to 666661. In ixp4xx_set_mode the term

LATCH & ~IXP4XX_OST_RELOAD_MASK

was used to write to the relevant register (with IXP4XX_OST_RELOAD_MASK being 3) and so effectively 666660 was used.

In commit f0402f9b4711 I translated that to:

	#define IXP4XX_TIMER_FREQ 66666000
	#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)

which results in the same register writes, but still doesn't bear in mind that the two least significant bits cannot be specified (which is relevant only when HZ or IXP4XX_TIMER_FREQ are changed).

Instead of reverting back to the old approach use a more obvious and also more correct way to calculate LATCH. (Regarding the more correct claim: With IXP4XX_TIMER_FREQ == 66665999, the old code resulted in LATCH = 666657 corresponding to a cycle time of 0.009999940149400597 seconds (error: -6.0e-8 s) while the new approach results in LATCH = 666660 and so a cycle time of 0.010000000150001503 seconds (error: 1.5e-10 s).)

Fixes f0402f9b4711 ("ARM: ixp4xx: stop using <mach/timex.h>")

---
Hello,

I didn't hear anything back from the ixp4xx maintainers, I didn't find a reference manual and I don't have an ixp4xx machine to test this patch. Still I'm confident it works as expected and results in a more exact clock calculation than both before and after my patch.

Olof requested this to be a seperate patch to not need to reverify the rest of the series. Does this make the series ready to be merged for 3.15 now? If so, should I send a new pull request with this patch applied on top of the old request or do you handle that yourself?

Best regards
Uwe

 arch/arm/mach-ixp4xx/common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-ixp4xx/common.c +9 -1
index 20b62aa30086..37e6cdac1642 100644
@@ -45,7 +45,15 @@
 #include <asm/mach/time.h>
 
 #define IXP4XX_TIMER_FREQ 66666000
-#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)
+
+/*
+ * The timer register doesn't allow to specify the two least significant bits of
+ * the timeout value and assumes them being zero. So make sure IXP4XX_LATCH is
+ * the best value with the two least significant bits unset.
+ */
+#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, \
+				       (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \
+			(IXP4XX_OST_RELOAD_MASK + 1)
 
 static void __init ixp4xx_clocksource_init(void);
 static void __init ixp4xx_clockevent_init(void);
Signature · 7 lines
1.8.5.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#14 lore raw
In reply to Olof Johansson
Quoted 2 lines · Olof Johansson

Most of the series looks OK, but the IXP4xx change looks fishy. This is exactly why I wanted to get the header touched at the same time.

Hm, I have an IXP4 system on my desk, I just haven't made it boot yet. I will try to get this up and try to run it with these series, but no promises.

Yours,
Linus Walleij