ARM: davinci: modernize the timer support
Subsystems (6)
cover ARM: davinci: modernize the timer support
From: Bartosz Golaszewski <[email protected]>
This series removes the legacy timer code from mach-davinci in favor of a new clocksource driver it introduces.
The first patch fixes a device tree bug that's been around for a while. Unfortunately any systems shipped with the buggy device will stop booting once they switch to the new clocksource driver.
Patch 2 adds a new clocksource driver for davinci.
Patch 3 enables the new driver for device-tree based systems.
Patches 4-9 add a WARN() to the machine code of all davinci boards which is triggered if clk_get() for the timer clock fails. This is needed as the new driver expects the clock to be functional and doesn't check it.
Patches 10-11 and 13-16 switch the board files to using the new clocksource driver while patch 12 moves some necessary defines to a different place since we'll be removing the file that contains them.
Patch 17 removes legacy timer code.
Bartosz Golaszewski (17):
ARM: dts: da850: fix interrupt numbers for clocksource
clocksource: davinci-timer: new driver
ARM: davinci: enable the clocksource driver for DT mode
ARM: davinci: da850: WARN() if clk_get() fails
ARM: davinci: da830: WARN() if clk_get() fails
ARM: davinci: dm355: WARN() if clk_get() fails
ARM: davinci: dm365: WARN() if clk_get() fails
ARM: davinci: dm644x: WARN() if clk_get() fails
ARM: davinci: dm646x: WARN() if clk_get() fails
ARM: davinci: da850: switch to using the clocksource driver
ARM: davinci: da830: switch to using the clocksource driver
ARM: davinci: move timer definitions to davinci.h
ARM: davinci: dm355: switch to using the clocksource driver
ARM: davinci: dm365: switch to using the clocksource driver
ARM: davinci: dm644x: switch to using the clocksource driver
ARM: davinci: dm646x: switch to using the clocksource driver
ARM: davinci: remove legacy timer support
arch/arm/Kconfig | 1 + arch/arm/boot/dts/da850.dtsi | 2 +- arch/arm/mach-davinci/Makefile | 3 +- arch/arm/mach-davinci/da830.c | 57 +-- arch/arm/mach-davinci/da850.c | 57 ++- arch/arm/mach-davinci/davinci.h | 3 + arch/arm/mach-davinci/devices-da8xx.c | 1 - arch/arm/mach-davinci/devices.c | 19 - arch/arm/mach-davinci/dm355.c | 37 +- arch/arm/mach-davinci/dm365.c | 31 +- arch/arm/mach-davinci/dm644x.c | 37 +- arch/arm/mach-davinci/dm646x.c | 37 +- arch/arm/mach-davinci/include/mach/common.h | 17 - arch/arm/mach-davinci/include/mach/time.h | 35 -- arch/arm/mach-davinci/time.c | 414 ------------------- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-davinci.c | 415 ++++++++++++++++++++ include/clocksource/timer-davinci.h | 35 ++ 19 files changed, 611 insertions(+), 596 deletions(-) delete mode 100644 arch/arm/mach-davinci/include/mach/time.h delete mode 100644 arch/arm/mach-davinci/time.c create mode 100644 drivers/clocksource/timer-davinci.c create mode 100644 include/clocksource/timer-davinci.h
Signature · 1 line
2.19.1
PATCH 1/17 ARM: dts: da850: fix interrupt numbers for clocksource
From: Bartosz Golaszewski <[email protected]>
The timer interrupts specified in commit 3652e2741f42 ("ARM: dts:
da850: Add clocks") are wrong but since the current timer code hard-codes them, the bug was never spotted.
This patch must go into stable since, once we introduce a proper clocksource driver, devices with buggy device tree will stop booting.
--- arch/arm/boot/dts/da850.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/da850.dtsi +1 -1
@@ -476,7 +476,7 @@ clocksource: timer@20000 { compatible = "ti,da830-timer"; reg = <0x20000 0x1000>; - interrupts = <12>, <13>; + interrupts = <21>, <22>; interrupt-names = "tint12", "tint34"; clocks = <&pll0_auxclk>; };
Signature · 1 line
2.19.1
Re: [PATCH 01/17] ARM: dts: da850: fix interrupt numbers for clocksource
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
The timer interrupts specified in commit
3652e2741f42("ARM: dts:
da850: Add clocks") are wrong but since the current timer code hard-codes them, the bug was never spotted.This patch must go into stable since, once we introduce a proper clocksource driver, devices with buggy device tree will stop booting.
Is this the case where someone uses device-tree from a stable tree and kernel from latest mainline?
I have added it to my fixes branch for v5.0 anyway.
Thanks,
Sekhar
Re: [PATCH 01/17] ARM: dts: da850: fix interrupt numbers for clocksource
czw., 17 sty 2019 o 15:23 Sekhar Nori <[email protected]> napisał(a):
Quoted 8 lines · Bartosz Golaszewski
Quoted 6 lines
From: Bartosz Golaszewski <[email protected]>
The timer interrupts specified in commit
3652e2741f42("ARM: dts:
da850: Add clocks") are wrong but since the current timer code hard-codes them, the bug was never spotted.
Quoted 6 lines
Quoted 2 lines
This patch must go into stable since, once we introduce a proper clocksource driver, devices with buggy device tree will stop booting.
Is this the case where someone uses device-tree from a stable tree and kernel from latest mainline?
Well, if someone wants to use an old device tree and a newer kernel, then it'll be broken anyway. If we get it to stable then at least the fixed device tree will work in the future. That was my reasoning.
Bart
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/17 clocksource: davinci-timer: new driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in davinci_timer_register() as the system won't boot without a timer anyway.
--- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-davinci.c | 415 ++++++++++++++++++++++++++++ include/clocksource/timer-davinci.h | 35 +++ 4 files changed, 456 insertions(+) create mode 100644 drivers/clocksource/timer-davinci.c create mode 100644 include/clocksource/timer-davinci.h
drivers/clocksource/Kconfig +5 -0
@@ -42,6 +42,11 @@ config BCM_KONA_TIMER help Enables the support for the BCM Kona mobile timer driver. +config DAVINCI_TIMER + bool "Texas Instruments DaVinci timer driver" + help + Enables the support for the TI DaVinci timer driver. + config DIGICOLOR_TIMER bool "Digicolor timer driver" if COMPILE_TEST select CLKSRC_MMIO
drivers/clocksource/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o obj-$(CONFIG_EM_TIMER_STI) += em_sti.o obj-$(CONFIG_CLKBLD_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o +obj-$(CONFIG_DAVINCI_TIMER) += timer-davinci.o obj-$(CONFIG_DIGICOLOR_TIMER) += timer-digicolor.o obj-$(CONFIG_OMAP_DM_TIMER) += timer-ti-dm.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o
drivers/clocksource/timer-davinci.c new file +415 -0
415 lines not on this page · raw message
include/clocksource/timer-davinci.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* TI DaVinci clocksource driver +* +* Copyright (C) 2019 Texas Instruments +* Author: Bartosz Golaszewski <[email protected]> +*/ + +#ifndef __TIMER_DAVINCI_H__ +#define __TIMER_DAVINCI_H__ + +#include <linux/clk.h> +#include <linux/ioport.h> + +enum { +DAVINCI_TIMER_TIM12_IRQ =0 , +DAVINCI_TIMER_TIM34_IRQ , +DAVINCI_TIMER_NUM_IRQS , +}; + +struct davinci_timer_cmp_cfg { +struct resource irq; +unsigned int offset; +}; + +struct davinci_timer_cfg { +struct resource reg; +struct resource irq[DAVINCI_TIMER_NUM_IRQS ]; +struct davinci_timer_cmp_cfg cmp; +}; + +int __init davinci_timer_register (struct clk *clk, +const struct davinci_timer_cfg *data); + +#endif /* __TIMER_DAVINCI_H__ */
Signature · 1 line
2.19.1
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.
Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
Some minor comments below from quick look:
drivers/clocksource/timer-davinci.c line 7
Quoted 13 lines
drivers/clocksource/timer-davinci.c new file +7
-0@@ -0,0 +1,415 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* TI DaVinci clocksource driver +* +* Copyright (C) 2019 Texas Instruments +* Author: Bartosz Golaszewski <[email protected]> +* (with some parts adopted from code by Kevin Hilman <[email protected]>)
Did you really intend GPL v2 or later? The original code referred to above is marked 2.0 only.
Quoted 16 lines
drivers/clocksource/timer-davinci.c new file +16
-0+*/ + +#include <linux/clk.h> +#include <linux/clockchips.h> +#include <linux/clocksource.h> +#include <linux/err.h> +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/regmap.h> +#include <linux/sched_clock.h> + +#include <clocksource/timer-davinci.h> + +#define DAVINCI_TIMER_REG_TIM12 0x10
drivers/clocksource/timer-davinci.c line 33
Quoted 10 lines
drivers/clocksource/timer-davinci.c new file +10
-0+#define DAVINCI_TIMER_REG_TIM34 0x14 +#define DAVINCI_TIMER_REG_PRD12 0x18 +#define DAVINCI_TIMER_REG_PRD34 0x1c +#define DAVINCI_TIMER_REG_TCR 0x20 +#define DAVINCI_TIMER_REG_TGCR 0x24 + +#define DAVINCI_TIMER_TIMMODE_MASK 0x0000000c +#define DAVINCI_TIMER_RESET_MASK 0x00000003 +#define DAVINCI_TIMER_TIMMODE_32BIT_UNCHAINED 0x00000004 +#define DAVINCI_TIMER_UNRESET 0x00000003
I think these are more readable if using BIT() and GENMASK()
Thanks,
Sekhar
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 24 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>
Quoted 8 lines
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
I can't boot da850 with the same config as da830 (0x60 compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?
Quoted 19 lines
Some minor comments below from quick look:
drivers/clocksource/timer-davinci.c line 7
Quoted 13 lines
drivers/clocksource/timer-davinci.c new file +7
-0@@ -0,0 +1,415 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* TI DaVinci clocksource driver +* +* Copyright (C) 2019 Texas Instruments +* Author: Bartosz Golaszewski <[email protected]> +* (with some parts adopted from code by Kevin Hilman <[email protected]>) Did you really intend GPL v2 or later? The original code referred to above is marked 2.0 only.
I'm not sure. Should it be GPLv2 only? I'm not well versed with licensing.
Bart
Quoted 31 lines
Quoted 16 lines
drivers/clocksource/timer-davinci.c new file +16
-0+*/ + +#include <linux/clk.h> +#include <linux/clockchips.h> +#include <linux/clocksource.h> +#include <linux/err.h> +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/regmap.h> +#include <linux/sched_clock.h> + +#include <clocksource/timer-davinci.h> + +#define DAVINCI_TIMER_REG_TIM12 0x10drivers/clocksource/timer-davinci.c line 33
Quoted 10 lines
drivers/clocksource/timer-davinci.c new file +10
-0+#define DAVINCI_TIMER_REG_TIM34 0x14 +#define DAVINCI_TIMER_REG_PRD12 0x18 +#define DAVINCI_TIMER_REG_PRD34 0x1c +#define DAVINCI_TIMER_REG_TCR 0x20 +#define DAVINCI_TIMER_REG_TGCR 0x24 + +#define DAVINCI_TIMER_TIMMODE_MASK 0x0000000c +#define DAVINCI_TIMER_RESET_MASK 0x00000003 +#define DAVINCI_TIMER_TIMMODE_32BIT_UNCHAINED 0x00000004 +#define DAVINCI_TIMER_UNRESET 0x00000003I think these are more readable if using
BIT()andGENMASK()Thanks,
Sekhar
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
Quoted 34 lines · Bartosz Golaszewski
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 24 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>Quoted 8 lines
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
Quoted 3 lines
I can't boot da850 with the same config as da830 (
0x60compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?
Yeah, I did check that without the patch DA830 does boot.
Thanks,
Sekhar
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
Quoted 35 lines · Sekhar Nori
Quoted 34 lines · Bartosz Golaszewski
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 32 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
Quoted 5 lines
Quoted 3 lines
I can't boot da850 with the same config as da830 (
0x60compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?Yeah, I did check that without the patch DA830 does boot.
You are right that DA850 lacks compare interrupts for timers 0 and 1. So, yes, it seems like we will have to shift to timer2 to test compare interrupts on DA850.
Just to confirm, DA830 boots fine with the compare section removed:
---8<---
arch/arm/mach-davinci/da830.c +0 -8
@@ -788,14 +788,6 @@ static const struct davinci_timer_cfg da830_timer_cfg = { .flags = IORESOURCE_IRQ, }, }, - .cmp = { - .irq = { - .start = IRQ_DA830_T12CMPINT0_0, - .end = IRQ_DA830_T12CMPINT0_0, - .flags = IORESOURCE_IRQ, - }, - .offset = DA830_CMP12_0, - } }; static const struct davinci_soc_info davinci_soc_info_da830 = {
---8<---
And the low-level debug with your patches shows that its hanging at delay loop calibration.
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 5.0.0-rc1-08699-gc87d386784f3-dirty (a0875516@psplinux063) (gcc v9
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
Machine: DaVinci DA830/OMAP-L137/AM17x EVM
Memory policy: Data cache writethrough
cma: Reserved 16 MiB at 0xc2800000
DaVinci da830/omap-l137 rev2.0 variant 0x9
On node 0 totalpages: 14336
DMA zone: 112 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 14336 pages, LIFO batch:3
random: get_random_bytes called from start_kernel+0x80/0x3ec with crng_init=0
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists, mobility grouping on. Total pages: 14224
Kernel command line: console=ttyS2,115200n8
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 33876K/57344K available (4607K kernel code, 308K rwdata, 1072K rodata, ) Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc4000000 - 0xff800000 ( 952 MB)
lowmem : 0xc0000000 - 0xc3800000 ( 56 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0x(ptrval) - 0x(ptrval) (4609 kB)
.init : 0x(ptrval) - 0x(ptrval) ( 212 kB)
.data : 0x(ptrval) - 0x(ptrval) ( 309 kB)
.bss : 0x(ptrval) - 0x(ptrval) ( 137 kB) SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.NR_IRQS: 245
clocksource: timer0_0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79ssched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Console: colour dummy device 80x30
Calibrating delay loop...
<hangs>
Thanks,
Sekhar
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
czw., 17 sty 2019 o 13:42 Sekhar Nori <[email protected]> napisał(a):
Quoted 41 lines · Sekhar Nori
Quoted 39 lines · Bartosz Golaszewski
Quoted 37 lines
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 24 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>Quoted 8 lines
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
I can't boot da850 with the same config as da830 (
0x60compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?
Quoted 6 lines
Quoted 1 line
Yeah, I did check that without the patch DA830 does boot.
You are right that DA850 lacks compare interrupts for timers 0 and 1. So, yes, it seems like we will have to shift to timer2 to test compare interrupts on DA850.
Timers 2 and 3 are a bit different on da850 - for instance they don't have separate interrupts for bottom and top halfs.
I configured the old code to use timer 2 - bottom half only with compare register 0x60 and compare intterupt 74. It boots although very slowly and something's broken with timekeeping as the clock goes backwards and forward (seemingly) randomly.
Kevin has an OMAP-L137 starter kit - is this the same as da830-evm? If so, then I can get remote access to it and work on this problem. Otherwise, I can prepare something that works on da850 with broken timekeeping and let you see if it works correctly on da830.
Bart
Quoted 69 lines
Just to confirm, DA830 boots fine with the compare section removed:
---8<---
arch/arm/mach-davinci/da830.c +0
-9@@ -788,14 +788,6 @@ static const struct davinci_timer_cfg da830_timer_cfg = { .flags = IORESOURCE_IRQ, }, }, - .cmp = { - .irq = { - .start = IRQ_DA830_T12CMPINT0_0, - .end = IRQ_DA830_T12CMPINT0_0, - .flags = IORESOURCE_IRQ, - }, - .offset = DA830_CMP12_0, - } }; static const struct davinci_soc_info davinci_soc_info_da830 = { ---8<---And the low-level debug with your patches shows that its hanging at delay loop calibration.
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU0x0
Linux version 5.0.0-rc1-08699-gc87d386784f3-dirty (a0875516@psplinux063) (gcc v9
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
Machine: DaVinci DA830/OMAP-L137/AM17x EVM
Memory policy: Data cache writethrough
cma: Reserved 16 MiB at0xc2800000
DaVinci da830/omap-l137 rev2.0 variant0x9
On node 0 totalpages: 14336
DMA zone: 112 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 14336 pages, LIFO batch:3
random:get_random_bytescalled fromstart_kernel+0x80/0x3ecwith crng_init=0
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists, mobility grouping on. Total pages: 14224
Kernel command line: console=ttyS2,115200n8
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 33876K/57344K available (4607K kernel code, 308K rwdata, 1072K rodata, ) Virtual kernel memory layout:vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xc4000000 - 0xff800000 ( 952 MB) lowmem : 0xc0000000 - 0xc3800000 ( 56 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .text : 0x(ptrval) - 0x(ptrval) (4609 kB) .init : 0x(ptrval) - 0x(ptrval) ( 212 kB) .data : 0x(ptrval) - 0x(ptrval) ( 309 kB) .bss : 0x(ptrval) - 0x(ptrval) ( 137 kB)SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.NR_IRQS: 245
clocksource:timer0_0: mask:0xffffffffmax_cycles:0xffffffff,max_idle_ns: 79ssched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Console: colour dummy device 80x30
Calibrating delay loop...
<hangs>
Quoted 2 lines
Thanks,
Sekhar
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
Quoted 44 lines · Bartosz Golaszewski
czw., 17 sty 2019 o 13:42 Sekhar Nori <[email protected]> napisał(a):
Quoted 43 lines · Sekhar Nori
Quoted 40 lines · Bartosz Golaszewski
Quoted 34 lines
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 24 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>Quoted 8 lines
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
Quoted 3 lines
I can't boot da850 with the same config as da830 (
0x60compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?Yeah, I did check that without the patch DA830 does boot.
Quoted 7 lines
Quoted 4 lines
You are right that DA850 lacks compare interrupts for timers 0 and 1. So, yes, it seems like we will have to shift to timer2 to test compare interrupts on DA850.
Timers 2 and 3 are a bit different on da850 - for instance they don't have separate interrupts for bottom and top halfs.
We should only be using the compare feature which has a a separate interrupt (distinct from top and bottom half interrupts). Only timer 2 and 3 of DA850 have the compare interrupts though. So you will have to use those timers to be able to test compare feature on DA850.
Quoted 5 lines
I configured the old code to use timer 2 - bottom half only with compare register
0x60and compare intterupt 74. It boots although very slowly and something's broken with timekeeping as the clock goes backwards and forward (seemingly) randomly.
Ah, okay. Timer 2/3 use ASYNC3 as clock input instead of PLL0_AUXCLK. Did you make adjustment for this too?
Quoted 2 lines
Kevin has an OMAP-L137 starter kit - is this the same as da830-evm? If
Yes.
Quoted 3 lines
so, then I can get remote access to it and work on this problem. Otherwise, I can prepare something that works on da850 with broken timekeeping and let you see if it works correctly on da830.
Alright, happy to test.
Thanks,
Sekhar
Re: [PATCH 02/17] clocksource: davinci-timer: new driver
In reply to Bartosz GolaszewskiQuoted 58 lines · Bartosz Golaszewski
pon., 14 sty 2019 o 13:20 Sekhar Nori <[email protected]> napisał(a):
Quoted 24 lines
Hi Bartosz,
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the clocksource and clockevent support for davinci platforms lives in mach-davinci. It hard-codes many things, used global variables, implements functionalities unused by any platform and has code fragments scattered across many (often unrelated) files.
Implement a new, modern and simplified timer driver and put it into
drivers/clocksource. We still need to support legacy board files so export a config structure and a function that allows machine code to register the timer.Quoted 7 lines
We don't check the return values of regmap reads and writes since with mmio it's only likely to fail due to programmer's errors.
We also don't bother freeing resources on errors in
davinci_timer_register()as the system won't boot without a timer anyway.Signed-off-by Bartosz Golaszewski <[email protected]>Quoted 8 lines
With this series, DA830 fails to boot. Rest of the devices are okay from boot perspective.
DA830 is pretty unique because it uses the same timer-half for both clocksource and clockevent. May be you can set the same configuration on your DA850 to see the same issue? Else, I will enable low-level debug and try to provide more debug data.
I can't boot da850 with the same config as da830 (
0x60compare register, compare irq 74) even with the old timer code. Just to make
sure: does da830 boot fine with mainline v5.0-rc2?Quoted 19 lines
Some minor comments below from quick look:
drivers/clocksource/timer-davinci.c line 7
Quoted 13 lines
drivers/clocksource/timer-davinci.c new file +7
-0@@ -0,0 +1,415 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* TI DaVinci clocksource driver +* +* Copyright (C) 2019 Texas Instruments +* Author: Bartosz Golaszewski <[email protected]> +* (with some parts adopted from code by Kevin Hilman <[email protected]>) Did you really intend GPL v2 or later? The original code referred to above is marked 2.0 only.
Quoted 1 line
I'm not sure. Should it be GPLv2 only? I'm not well versed with licensing.
I guess it's up to you since you're the author of this new, reworked driver, but the original one I wrote was GPLv2 only.
Note however that that the choice of v2 only was not out of objection to v2+ but because I wrote that in 2007, when there was no "+" ;)
Kevin
PATCH 3/17 ARM: davinci: enable the clocksource driver for DT mode
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Switch all davinci boards using device tree to using the new clocksource driver: remove the previous OF_TIMER_DECLARE() from mach-davinci and select davinci-timer to be built for davinci_all_defconfig.
--- arch/arm/Kconfig | 1 + arch/arm/mach-davinci/time.c | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-)
arch/arm/Kconfig +1 -0
@@ -586,6 +586,7 @@ config ARCH_DAVINCI select ARCH_HAS_HOLES_MEMORYMODEL select COMMON_CLK select CPU_ARM926T + select DAVINCI_TIMER select GENERIC_ALLOCATOR select GENERIC_CLOCKEVENTS select GENERIC_IRQ_CHIP
arch/arm/mach-davinci/time.c +0 -14
@@ -398,17 +398,3 @@ void __init davinci_timer_init(struct clk *timer_clk)for (i=0 ; i<ARRAY_SIZE (timers); i++)timer32_config (&timers[i]); } - -static int __init of_davinci_timer_init (struct device_node *np) -{ -struct clk *clk; - - clk =of_clk_get (np,0 ); -if (IS_ERR (clk)) -return PTR_ERR (clk); - -davinci_timer_init (clk); - -return 0 ; -} -TIMER_OF_DECLARE (davinci_timer,"ti,da830-timer" , of_davinci_timer_init);
Signature · 1 line
2.19.1
PATCH 4/17 ARM: davinci: da850: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/da850.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/da850.c +1 -0
@@ -774,6 +774,7 @@ void __init da850_init_time(void)da850_pll0_init (NULL , pll0, cfgchip); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
Re: [PATCH 04/17] ARM: davinci: da850: WARN() if clk_get() fails
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if
clk_get()fails.Signed-off-by Bartosz Golaszewski <[email protected]>
I think 4-9 can be a single patch. They are doing something very similar and its unlikely we will have to patch/revert just one of them.
Thanks,
Sekhar
PATCH 5/17 ARM: davinci: da830: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/da830.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/da830.c +1 -0
@@ -834,6 +834,7 @@ void __init da830_init_time(void)da830_pll_init (NULL , pll,NULL ); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
PATCH 6/17 ARM: davinci: dm355: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/dm355.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/dm355.c +1 -0
@@ -745,6 +745,7 @@ void __init dm355_init_time(void)dm355_psc_init (NULL , psc); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
PATCH 7/17 ARM: davinci: dm365: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/dm365.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/dm365.c +1 -0
@@ -786,6 +786,7 @@ void __init dm365_init_time(void)dm365_psc_init (NULL , psc); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
PATCH 8/17 ARM: davinci: dm644x: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/dm644x.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/dm644x.c +1 -0
@@ -681,6 +681,7 @@ void __init dm644x_init_time(void)dm644x_psc_init (NULL , psc); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
PATCH 9/17 ARM: davinci: dm646x: WARN() if clk_get() fails
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails.
--- arch/arm/mach-davinci/dm646x.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/dm646x.c +1 -0
@@ -665,6 +665,7 @@ void __init dm646x_init_time(unsigned long ref_clk_rate,dm646x_psc_init (NULL , psc); clk =clk_get (NULL ,"timer0" ); +WARN (IS_ERR (clk),"Unable to get the timer clock\n" );davinci_timer_init (clk); }
Signature · 1 line
2.19.1
PATCH 10/17 ARM: davinci: da850: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/da850.c | 56 ++++++++++++++--------------------- 1 file changed, 22 insertions(+), 34 deletions(-)
arch/arm/mach-davinci/da850.c +22 -34
@@ -34,7 +34,8 @@#include <mach/da8xx.h> #include <mach/irqs.h> #include <mach/pm.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "mux.h"
@@ -436,38 +437,24 @@ static struct davinci_id da850_ids[] = { }, }; -static struct davinci_timer_instance da850_timer_instance[4 ] = { - { - .base =DA8XX_TIMER64P0_BASE , - .bottom_irq =IRQ_DA8XX_TINT12_0 , - .top_irq =IRQ_DA8XX_TINT34_0 , - }, - { - .base =DA8XX_TIMER64P1_BASE , - .bottom_irq =IRQ_DA8XX_TINT12_1 , - .top_irq =IRQ_DA8XX_TINT34_1 , - }, - { - .base =DA850_TIMER64P2_BASE , - .bottom_irq =IRQ_DA850_TINT12_2 , - .top_irq =IRQ_DA850_TINT34_2 , - }, - { - .base =DA850_TIMER64P3_BASE , - .bottom_irq =IRQ_DA850_TINT12_3 , - .top_irq =IRQ_DA850_TINT34_3 , +static const struct davinci_timer_cfg da850_timer_cfg = { + .reg = { + .start =DA8XX_TIMER64P0_BASE , + .end =DA8XX_TIMER64P0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , }, -}; - -/* -* T0_BOT: Timer 0, bottom : Used for clock_event -* T0_TOP: Timer 0, top : Used for clocksource -* T1_BOT, T1_TOP: Timer 1, bottom & top: Used for watchdog timer -*/ -static struct davinci_timer_info da850_timer_info = { - .timers = da850_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_TOP , + .irq = { + { + .start =IRQ_DA8XX_TINT12_0 , + .end =IRQ_DA8XX_TINT12_0 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_DA8XX_TINT34_0 , + .end =IRQ_DA8XX_TINT34_0 , + .flags =IORESOURCE_IRQ , + } + } };#ifdef CONFIG_CPU_FREQ
@@ -742,7 +729,6 @@ static const struct davinci_soc_info davinci_soc_info_da850 = { .intc_type = DAVINCI_INTC_TYPE_CP_INTC, .intc_irq_prios = da850_default_priorities, .intc_irq_num = DA850_N_CP_INTC_IRQ, - .timer_info = &da850_timer_info, .emac_pdata = &da8xx_emac_pdata, .sram_dma = DA8XX_SHARED_RAM_BASE, .sram_len = SZ_128K,
@@ -765,6 +751,7 @@ void __init da850_init_time(void)void __iomem *pll0;struct regmap *cfgchip;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 ,DA850_REF_FREQ );
@@ -776,7 +763,8 @@ void __init da850_init_time(void) clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &da850_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }static struct resource da850_pll1_resources[] = {
Signature · 1 line
2.19.1
PATCH 11/17 ARM: davinci: da830: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/da830.c | 56 ++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 27 deletions(-)
arch/arm/mach-davinci/da830.c +29 -27
@@ -20,7 +20,8 @@#include <mach/cputype.h> #include <mach/da8xx.h> #include <mach/irqs.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "mux.h"
@@ -769,32 +770,32 @@ int __init da830_register_gpio(void)return da8xx_register_gpio (&da830_gpio_platform_data); } -static struct davinci_timer_instance da830_timer_instance[2 ] = { - { - .base =DA8XX_TIMER64P0_BASE , - .bottom_irq =IRQ_DA8XX_TINT12_0 , - .top_irq =IRQ_DA8XX_TINT34_0 , - .cmp_off =DA830_CMP12_0 , - .cmp_irq =IRQ_DA830_T12CMPINT0_0 , +static const struct davinci_timer_cfg da830_timer_cfg = { + .reg = { + .start =DA8XX_TIMER64P0_BASE , + .end =DA8XX_TIMER64P0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , }, - { - .base =DA8XX_TIMER64P1_BASE , - .bottom_irq =IRQ_DA8XX_TINT12_1 , - .top_irq =IRQ_DA8XX_TINT34_1 , - .cmp_off =DA830_CMP12_0 , - .cmp_irq =IRQ_DA830_T12CMPINT0_1 , + .irq = { + { + .start =IRQ_DA8XX_TINT12_0 , + .end =IRQ_DA8XX_TINT12_0 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_DA8XX_TINT34_0 , + .end =IRQ_DA8XX_TINT34_0 , + .flags =IORESOURCE_IRQ , + }, }, -}; - -/* -* T0_BOT: Timer 0, bottom : Used for clock_event & clocksource -* T0_TOP: Timer 0, top : Used by DSP -* T1_BOT, T1_TOP: Timer 1, bottom & top: Used for watchdog timer -*/ -static struct davinci_timer_info da830_timer_info = { - .timers = da830_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_BOT , + .cmp = { + .irq = { + .start =IRQ_DA830_T12CMPINT0_0 , + .end =IRQ_DA830_T12CMPINT0_0 , + .flags =IORESOURCE_IRQ , + }, + .offset =DA830_CMP12_0 , + } };static const struct davinci_soc_info davinci_soc_info_da830 = {
@@ -810,7 +811,6 @@ static const struct davinci_soc_info davinci_soc_info_da830 = { .intc_type = DAVINCI_INTC_TYPE_CP_INTC, .intc_irq_prios = da830_default_priorities, .intc_irq_num = DA830_N_CP_INTC_IRQ, - .timer_info = &da830_timer_info, .emac_pdata = &da8xx_emac_pdata, };
@@ -826,6 +826,7 @@ void __init da830_init_time(void) {void __iomem *pll;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 ,DA830_REF_FREQ );
@@ -836,7 +837,8 @@ void __init da830_init_time(void) clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &da830_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }static struct resource da830_psc0_resources[] = {
Signature · 1 line
2.19.1
PATCH 12/17 ARM: davinci: move timer definitions to davinci.h
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Boards from the dm* family rely on register offset definitions from arch/arm/mach-davinci/include/mach/time.h. We'll be removing this file soon, so move the required defines to davinci.h where the rest of such constants live.
--- arch/arm/mach-davinci/davinci.h | 3 +++ arch/arm/mach-davinci/include/mach/time.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/davinci.h +3 -0
@@ -60,6 +60,9 @@ void davinci_map_sysmod(void);#define DAVINCI_GPIO_BASE 0x01C67000int davinci_gpio_register (struct resource *res,int size,void *pdata); +#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400) +#define DAVINCI_WDOG_BASE (IO_PHYS + 0x21C00) +/* DM355 base addresses */ #define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
arch/arm/mach-davinci/include/mach/time.h +0 -2
@@ -11,9 +11,7 @@#ifndef __ARCH_ARM_MACH_DAVINCI_TIME_H#define __ARCH_ARM_MACH_DAVINCI_TIME_H -#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400)#define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800) -#define DAVINCI_WDOG_BASE (IO_PHYS + 0x21C00)enum { T0_BOT,
Signature · 1 line
2.19.1
PATCH 13/17 ARM: davinci: dm355: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/dm355.c | 36 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
arch/arm/mach-davinci/dm355.c +23 -13
@@ -29,7 +29,8 @@#include <mach/irqs.h> #include <mach/mux.h> #include <mach/serial.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "asp.h" #include "davinci.h"
@@ -617,16 +618,24 @@ static struct davinci_id dm355_ids[] = { }, }; -/* -* T0_BOT: Timer 0, bottom: clockevent source for hrtimers -* T0_TOP: Timer 0, top : clocksource for generic timekeeping -* T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) -* T1_TOP: Timer 1, top : <unused> -*/ -static struct davinci_timer_info dm355_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_TOP , +static const struct davinci_timer_cfg dm355_timer_cfg = { + .reg = { + .start =DAVINCI_TIMER0_BASE , + .end =DAVINCI_TIMER0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , + }, + .irq = { + { + .start =IRQ_TINT0_TINT12 , + .end =IRQ_TINT0_TINT12 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_TINT0_TINT34 , + .end =IRQ_TINT0_TINT34 , + .flags =IORESOURCE_IRQ , + } + } };static struct plat_serial8250_port dm355_serial0_platform_data[] = {
@@ -708,7 +717,6 @@ static const struct davinci_soc_info davinci_soc_info_dm355 = { .intc_type = DAVINCI_INTC_TYPE_AINTC, .intc_irq_prios = dm355_default_priorities, .intc_irq_num = DAVINCI_N_AINTC_IRQ, - .timer_info = &dm355_timer_info, .sram_dma = 0x00010000, .sram_len = SZ_32K, };
@@ -735,6 +743,7 @@ void __init dm355_init_time(void) {void __iomem *pll1, *psc;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 ,DM355_REF_FREQ );
@@ -747,7 +756,8 @@ void __init dm355_init_time(void) clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &dm355_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }static struct resource dm355_pll2_resources[] = {
Signature · 1 line
2.19.1
PATCH 14/17 ARM: davinci: dm365: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/dm365.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
arch/arm/mach-davinci/dm365.c +23 -7
@@ -34,7 +34,8 @@#include <mach/irqs.h> #include <mach/mux.h> #include <mach/serial.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "asp.h" #include "davinci.h"
@@ -658,10 +659,24 @@ static struct davinci_id dm365_ids[] = { }, }; -static struct davinci_timer_info dm365_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_TOP , +static const struct davinci_timer_cfg dm365_timer_cfg = { + .reg = { + .start =DAVINCI_TIMER0_BASE , + .end =DAVINCI_TIMER0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , + }, + .irq = { + { + .start =IRQ_TINT0_TINT12 , + .end =IRQ_TINT0_TINT12 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_TINT0_TINT34 , + .end =IRQ_TINT0_TINT34 , + .flags =IORESOURCE_IRQ , + } + } };#define DM365_UART1_BASE (IO_PHYS + 0x106000)
@@ -725,7 +740,6 @@ static const struct davinci_soc_info davinci_soc_info_dm365 = { .intc_type = DAVINCI_INTC_TYPE_AINTC, .intc_irq_prios = dm365_default_priorities, .intc_irq_num = DAVINCI_N_AINTC_IRQ, - .timer_info = &dm365_timer_info, .emac_pdata = &dm365_emac_pdata, .sram_dma = 0x00010000, .sram_len = SZ_32K,
@@ -773,6 +787,7 @@ void __init dm365_init_time(void) {void __iomem *pll1, *pll2, *psc;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 ,DM365_REF_FREQ );
@@ -788,7 +803,8 @@ void __init dm365_init_time(void) clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &dm365_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }void __init dm365_register_clocks (void )
Signature · 1 line
2.19.1
PATCH 15/17 ARM: davinci: dm644x: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/dm644x.c | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-)
arch/arm/mach-davinci/dm644x.c +23 -13
@@ -26,7 +26,8 @@#include <mach/irqs.h> #include <mach/mux.h> #include <mach/serial.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "asp.h" #include "davinci.h"
@@ -558,16 +559,24 @@ static struct davinci_id dm644x_ids[] = { }, }; -/* -* T0_BOT: Timer 0, bottom: clockevent source for hrtimers -* T0_TOP: Timer 0, top : clocksource for generic timekeeping -* T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) -* T1_TOP: Timer 1, top : <unused> -*/ -static struct davinci_timer_info dm644x_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_TOP , +static const struct davinci_timer_cfg dm644x_timer_cfg = { + .reg = { + .start =DAVINCI_TIMER0_BASE , + .end =DAVINCI_TIMER0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , + }, + .irq = { + { + .start =IRQ_TINT0_TINT12 , + .end =IRQ_TINT0_TINT12 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_TINT0_TINT34 , + .end =IRQ_TINT0_TINT34 , + .flags =IORESOURCE_IRQ , + } + } };static struct plat_serial8250_port dm644x_serial0_platform_data[] = {
@@ -649,7 +658,6 @@ static const struct davinci_soc_info davinci_soc_info_dm644x = { .intc_type = DAVINCI_INTC_TYPE_AINTC, .intc_irq_prios = dm644x_default_priorities, .intc_irq_num = DAVINCI_N_AINTC_IRQ, - .timer_info = &dm644x_timer_info, .emac_pdata = &dm644x_emac_pdata, .sram_dma = 0x00008000, .sram_len = SZ_16K,
@@ -671,6 +679,7 @@ void __init dm644x_init_time(void) {void __iomem *pll1, *psc;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 ,DM644X_REF_FREQ );
@@ -683,7 +692,8 @@ void __init dm644x_init_time(void) clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &dm644x_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }static struct resource dm644x_pll2_resources[] = {
Signature · 1 line
2.19.1
PATCH 16/17 ARM: davinci: dm646x: switch to using the clocksource driver
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We now have a proper clocksource driver for davinci. Switch the platform to using it.
--- arch/arm/mach-davinci/dm646x.c | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-)
arch/arm/mach-davinci/dm646x.c +23 -13
@@ -27,7 +27,8 @@#include <mach/irqs.h> #include <mach/mux.h> #include <mach/serial.h> -#include <mach/time.h> + +#include <clocksource/timer-davinci.h> #include "asp.h" #include "davinci.h"
@@ -498,16 +499,24 @@ static struct davinci_id dm646x_ids[] = { }, }; -/* -* T0_BOT: Timer 0, bottom: clockevent source for hrtimers -* T0_TOP: Timer 0, top : clocksource for generic timekeeping -* T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) -* T1_TOP: Timer 1, top : <unused> -*/ -static struct davinci_timer_info dm646x_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id =T0_BOT , - .clocksource_id =T0_TOP , +static const struct davinci_timer_cfg dm646x_timer_cfg = { + .reg = { + .start =DAVINCI_TIMER0_BASE , + .end =DAVINCI_TIMER0_BASE +SZ_4K , + .flags =IORESOURCE_MEM , + }, + .irq = { + { + .start =IRQ_TINT0_TINT12 , + .end =IRQ_TINT0_TINT12 , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_TINT0_TINT34 , + .end =IRQ_TINT0_TINT34 , + .flags =IORESOURCE_IRQ , + } + } };static struct plat_serial8250_port dm646x_serial0_platform_data[] = {
@@ -589,7 +598,6 @@ static const struct davinci_soc_info davinci_soc_info_dm646x = { .intc_type = DAVINCI_INTC_TYPE_AINTC, .intc_irq_prios = dm646x_default_priorities, .intc_irq_num = DAVINCI_N_AINTC_IRQ, - .timer_info = &dm646x_timer_info, .emac_pdata = &dm646x_emac_pdata, .sram_dma = 0x10010000, .sram_len = SZ_32K,
@@ -654,6 +662,7 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, {void __iomem *pll1, *psc;struct clk *clk; +int rv;clk_register_fixed_rate (NULL ,"ref_clk" ,NULL ,0 , ref_clk_rate);clk_register_fixed_rate (NULL ,"aux_clkin" ,NULL ,0 , aux_clkin_rate);
@@ -667,7 +676,8 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, clk =clk_get (NULL ,"timer0" );WARN (IS_ERR (clk),"Unable to get the timer clock\n" ); -davinci_timer_init (clk); + rv =davinci_timer_register (clk, &dm646x_timer_cfg); +WARN (rv,"Unable to register the timer: %d\n" , rv); }static struct resource dm646x_pll2_resources[] = {
Signature · 1 line
2.19.1
PATCH 17/17 ARM: davinci: remove legacy timer support
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
All platforms have now been switched to the new clocksource driver. Remove the old code and various no longer needed bits and pieces.
--- arch/arm/mach-davinci/Makefile | 3 +- arch/arm/mach-davinci/devices-da8xx.c | 1 - arch/arm/mach-davinci/devices.c | 19 - arch/arm/mach-davinci/include/mach/common.h | 17 - arch/arm/mach-davinci/include/mach/time.h | 33 -- arch/arm/mach-davinci/time.c | 400 -------------------- 6 files changed, 1 insertion(+), 472 deletions(-) delete mode 100644 arch/arm/mach-davinci/include/mach/time.h delete mode 100644 arch/arm/mach-davinci/time.c
arch/arm/mach-davinci/Makefile +1 -2
@@ -5,8 +5,7 @@ # # Common objects -obj-y := time.o serial.o usb.o \ - common.o sram.o +obj-y := serial.o usb.o common.o sram.o obj-$(CONFIG_DAVINCI_MUX) += mux.o
arch/arm/mach-davinci/devices-da8xx.c +0 -1
@@ -24,7 +24,6 @@#include <mach/common.h> #include <mach/cputype.h> #include <mach/da8xx.h> -#include <mach/time.h> #include "asp.h" #include "cpuidle.h"
arch/arm/mach-davinci/devices.c +0 -19
@@ -21,7 +21,6 @@#include <mach/cputype.h> #include <mach/mux.h> #include <linux/platform_data/mmc-davinci.h> -#include <mach/time.h> #include <linux/platform_data/edma.h>
@@ -305,21 +304,3 @@ int davinci_gpio_register(struct resource *res, int size, void *pdata) davinci_gpio_device.dev.platform_data = pdata;return platform_device_register (&davinci_gpio_device); } - -/*-------------------------------------------------------------------------*/ - -/*-------------------------------------------------------------------------*/ - -struct davinci_timer_instance davinci_timer_instance[2 ] = { - { - .base =DAVINCI_TIMER0_BASE , - .bottom_irq =IRQ_TINT0_TINT12 , - .top_irq =IRQ_TINT0_TINT34 , - }, - { - .base =DAVINCI_TIMER1_BASE , - .bottom_irq =IRQ_TINT1_TINT12 , - .top_irq =IRQ_TINT1_TINT34 , - }, -}; -
arch/arm/mach-davinci/include/mach/common.h +0 -17
@@ -17,26 +17,10 @@#include <linux/types.h> #include <linux/reboot.h> -void davinci_timer_init (struct clk *clk); -extern void davinci_irq_init (void );extern void __iomem *davinci_intc_base;extern int davinci_intc_type; -struct davinci_timer_instance { -u32 base; -u32 bottom_irq; -u32 top_irq; -unsigned long cmp_off; -unsigned int cmp_irq; -}; - -struct davinci_timer_info { -struct davinci_timer_instance *timers; -unsigned int clockevent_id; -unsigned int clocksource_id; -}; -struct davinci_gpio_controller ;/*
@@ -62,7 +46,6 @@ struct davinci_soc_info {u8 *intc_irq_prios;unsigned long intc_irq_num;u32 *intc_host_map; -struct davinci_timer_info *timer_info;int gpio_type;u32 gpio_base;unsigned gpio_num;
arch/arm/mach-davinci/include/mach/time.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* -* Local header file for DaVinci time code. -* -* Author: Kevin Hilman, MontaVista Software, Inc. <[email protected]> -* -* 2007 (c) MontaVista Software, Inc. This file is licensed under -* the terms of the GNU General Public License version 2. This program -* is licensed "as is" without any warranty of any kind, whether express -* or implied. -*/ -#ifndef __ARCH_ARM_MACH_DAVINCI_TIME_H -#define __ARCH_ARM_MACH_DAVINCI_TIME_H - -#define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800) - -enum { -T0_BOT , -T0_TOP , -T1_BOT , -T1_TOP , -NUM_TIMERS -}; - -#define IS_TIMER1 (id) (id & 0x2) -#define IS_TIMER0 (id) (!IS_TIMER1(id)) -#define IS_TIMER_TOP (id) ((id & 0x1)) -#define IS_TIMER_BOT (id) (!IS_TIMER_TOP(id)) - -#define ID_TO_TIMER (id) (IS_TIMER1(id) != 0) - -extern struct davinci_timer_instance davinci_timer_instance[]; - -#endif /* __ARCH_ARM_MACH_DAVINCI_TIME_H */
arch/arm/mach-davinci/time.c deleted +0 -400
400 lines not on this page · raw message
Signature · 1 line
2.19.1