Re: [RFC PATCH v2 07/14] m68k: atari: Convert to clocksource API

2018-11-23 Thread Michael Schmitz
Am 20.11.2018 um 23:02 schrieb Andreas Schwab: On Nov 20 2018, Linus Walleij wrote: Yes you already see the same as I see: this chip MK68901 has no less than four timers. I bet the kernel is just using one of them, out of habit. Note that not all timers can be used freely. Some of them

Re: [RFC PATCH v2 07/14] m68k: atari: Convert to clocksource API

2018-11-23 Thread Finn Thain
On Sat, 24 Nov 2018, Michael Schmitz wrote: > > Am 20.11.2018 um 23:02 schrieb Andreas Schwab: > > On Nov 20 2018, Linus Walleij wrote: > > > > > Yes you already see the same as I see: this chip MK68901 has no less > > > than four timers. I bet the kernel is just using one of them, out of >

[RFC PATCH v3 10/14] m68k: mac: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij Tested-by: Stan Johnson --- Changed since v2: - Drop unneeded 'clk_offset' variable. Changed since v1: - Moved clk_total access to within the irq lock. -

[RFC PATCH v3 14/14] m68k: mvme16x: Handle timer counter overflow

2018-11-23 Thread Finn Thain
Reading the timer counter races with timer overflow (and the corresponding interrupt). This is resolved by reading the overflow register and taking this value into account. The interrupt handler must clear the overflow register when it eventually executes. Suggested-by: Thomas Gleixner

[RFC PATCH v3 08/14] m68k: hp300: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- Changed since v1: - Moved clk_total access to within the irq lock. - Use type u32 for tick counter. --- arch/m68k/hp300/time.c | 37

[RFC PATCH v3 11/14] m68k: mvme147: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- Changed since v1: - Moved clk_total access to within the irq lock. - Use type u32 for tick counter. --- arch/m68k/include/asm/mvme147hw.h | 1 -

[RFC PATCH v3 05/14] m68k: amiga: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- Changed since v2: - Don't check for timer interrupt in amiga_read_clk() when the timer is about to be reloaded. Changed since v1: - Moved clk_total

[RFC PATCH v3 13/14] m68k: mvme16x: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- Changed since v1: - Moved clk_total access to within the irq lock. --- arch/m68k/mvme16x/config.c | 37 +++-- 1 file

[RFC PATCH v3 07/14] m68k: bvme6000: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- Changed since v2: - Don't check for timer interrupt in bvme6000_read_clk() when the timer is about to be reloaded. Changed since v1: - Moved clk_total

[RFC PATCH v3 06/14] m68k: atari: Convert to clocksource API

2018-11-23 Thread Finn Thain
Add a platform clocksource by adapting the existing arch_gettimeoffset implementation. Normally the MFP timer C interrupt flag would be used to check for timer counter wrap-around. Unfortunately, that flag gets cleared by the MFP itself (due to automatic End-of-Interrupt mode). This means that

[RFC PATCH v3 03/14] m68k: apollo, q40, sun3, sun3x: Remove arch_gettimeoffset implementations

2018-11-23 Thread Finn Thain
These dummy implementations are no better than default_arch_gettimeoffset() so remove them. Signed-off-by: Finn Thain --- arch/m68k/apollo/config.c | 7 --- arch/m68k/q40/config.c| 9 - arch/m68k/sun3/config.c | 2 -- arch/m68k/sun3/intersil.c | 7 ---

[RFC PATCH v3 02/14] m68k: mac: Fix VIA timer counter accesses

2018-11-23 Thread Finn Thain
This resolves some bugs that affect VIA timer counter accesses. Avoid lost interrupts caused by reading the counter low byte register. Make allowance for the fact that the counter will be decremented to 0x before being reloaded. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Finn

[RFC PATCH v3 01/14] m68k: Call timer_interrupt() with interrupts disabled

2018-11-23 Thread Finn Thain
Some platforms execute their timer handler with the interrupt priority level set below 6. That means the handler could be interrupted by another driver and this could lead to re-entry of the timer core. Avoid this by use of local_irq_save/restore for timer interrupt dispatch. This provides mutual

[RFC PATCH v3 00/14] m68k: Drop arch_gettimeoffset and adopt clocksource API

2018-11-23 Thread Finn Thain
This series removes "select ARCH_USES_GETTIMEOFFSET" from arch/m68k and converts users of arch_gettimeoffset to the clocksource API. Various bugs are fixed along the way. Those platforms which do not actually implement arch_gettimeoffset (apollo, q40, sun3, sun3x) use the "jiffies" clocksource by

[RFC PATCH v3 12/14] m68k: mvme147: Handle timer counter overflow

2018-11-23 Thread Finn Thain
Reading the timer counter races with timer overflow (and the corresponding interrupt). This is resolved by reading the overflow register and taking this value into account. The interrupt handler must clear the overflow register when it eventually executes. Suggested-by: Thomas Gleixner

[RFC PATCH v3 09/14] m68k: hp300: Handle timer counter overflow

2018-11-23 Thread Finn Thain
Because hp300_read_clk() never checks the timer interrupt flag it may fail to notice that the timer has wrapped, allowing the clock to jump backwards. This is not a new problem. This is resolved by checking the interrupt flag and, if need be, taking wrap-around into account. The interrupt handler

[RFC PATCH v3 04/14] m68k: Drop ARCH_USES_GETTIMEOFFSET

2018-11-23 Thread Finn Thain
The functions that implement arch_gettimeoffset are re-used by new clocksource drivers in subsequent patches. Signed-off-by: Finn Thain Acked-by: Linus Walleij --- arch/m68k/Kconfig | 1 - arch/m68k/amiga/config.c| 3 --- arch/m68k/atari/config.c| 2 --