Commit graph

560967 commits

Author SHA1 Message Date
Jisheng Zhang
520ddad4e5 clocksource/drivers/dw_apb_timer: Inline apbt_readl and apbt_writel
It seems gcc can automatically inline apbt_writel() for us, but
apbt_real isn't inlined. This patch makes them inline to get a trivial
performance improvement: 4096 rounds of __apbt_read_clocksource() call
spend time on Marvell BG4CT platform:

 before the patch 1275240ns on average
 after the patch 1263240ns on average

so we get 1% performance improvement.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 21:41:28 +01:00
Jisheng Zhang
39d3611f2d clocksource/drivers/dw_apb_timer: Use {readl|writel}_relaxed in critical path
It's safe to use the relaxed version. From another side, the relaxed io
accessor macros are available on all architectures now, so we can use
the relaxed versions to get a trivial system performance improvement,
we measured time the following functions spent on Marvell BG4CT:

4096 rounds of __apbt_read_clocksource() call:

before the patch: 1263240ns on average
after the patch: 1250080ns on average
improved by 1%

4096 rounds of apbt_eoi() call:

before the patch: 1290960ns on average
after the patch: 1248240ns on average

4096 rounds of apbt_next_event() call:

before the patch: 3333660ns on average
after the patch: 1322040ns on average

improved by 60%!

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 21:41:28 +01:00
Jisheng Zhang
9f4165dc4e clocksource/drivers/dw_apb_timer: Fix apbt_readl return types
On Marvell BG4CT platform, we observed the __apbt_read_clocksource()
return wrong value: Let's assume the APBTMR_N_CURRENT_VALUE value is
0xf0000000, we got 0xffffffff0fffffff, but it should be 0xfffffff.

This issue should be common on all 64bit platforms. We fix the issue
by letting aptb_readl() return u32. apbt_writel() is also updated
to write u32 val rather than unsigned long.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 20:44:54 +01:00
Daniel Lezcano
0881841f7e clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init
The current code to initialize, register and read the clocksource is
already factored out in mmio.c via the clocksource_mmio_init function.

Factor out the code with the clocksource_mmio_init function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 10:12:17 +01:00
Daniel Lezcano
46e7c3c6e5 clocksource/drivers/h8300: Increase the compilation test coverage
Add the COMPILE_TEST option so the drivers can be compiled on different
architecture with the 'allyesconfig' kernel configuration.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 10:12:16 +01:00
Daniel Lezcano
751605152b h8300: Rename ctlr_out/in[bwl] to raw_read/write[bwl]
For the sake of consistency, let rename all ctrl_out/in calls to the write/read
calls so we have the same API consistent with the other architectures hence
open the door for the increasing of the test compilation coverage.

The unsigned long coercive cast is removed because all variables are set to
the right type "void __iomem *".

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 10:12:03 +01:00
Daniel Lezcano
97a23beb8d clocksource/drivers/h8300_timer8: Separate the Kconfig option from the arch
The current Kconfig option is the H8300 arch option. In order to comply to the
current rule, let's create a specific option for the timer8 and select it
from the arch's Kconfig.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:43:59 +01:00
Daniel Lezcano
157dfadef8 clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init
The current code to initialize, register and read the clocksource is
already factored out in mmio.c via the clocksource_mmio_init function.

The only difference is the readl vs readl_relaxed.

Factor out the code with the clocksource_mmio_init function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2015-12-15 09:42:30 +01:00
Daniel Lezcano
05de7ed679 clocksource/drivers/h8300_timer16: Remove pointless lock
The lock in the timer16_clocksource_read is not needed, remove it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:28 +01:00
Daniel Lezcano
5019c90232 clocksource/drivers/h8300_timer16: Fix irq return value check
The function irq_of_parse_and_map returns zero in case of failure.

Fix the return code test to check against zero.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:26 +01:00
Daniel Lezcano
903e5fd3f8 clocksource/drivers/h8300_timer16: Remove unused fields in timer16_priv
The fields are not used in the code, remove them.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:25 +01:00
Daniel Lezcano
8b24e8d717 clocksource/drivers/h8300_timer16: Remove unused macros
The macros are no longer used in the code, remove them.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:23 +01:00
Daniel Lezcano
8cbade5271 clocksource/drivers/h8300_timer16: Remove pointless headers
The headers are not needed, remove them.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:21 +01:00
Daniel Lezcano
cce483e0ee clocksource/drivers/h8300_timer8: Retrieve the clock rate at init time
The current code retrieves the rate value when the timer is enabled which
occurs each time a timer is re-armed. Except if the clock frequency has changed
magically I don't see why this should be done each time.

Retrieve the clock rate value at init time only.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:20 +01:00
Daniel Lezcano
254d8b5d59 clocksource/drivers/h8300_timer8: Remove irq and lock legacy code
The time framawork takes care of disabling the interrupts and takes a lock
to prevent races.

Remove the legacy code in the driver taking care of the races.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:18 +01:00
Daniel Lezcano
7053fdac76 clocksource/drivers/h8300_timer8: Remove pointless irq re-entrant safe code
The current code assumes the interrupt function is re-entrant.

That is not correct. An interrupt handler is never invoked concurrently. The
interrupt line is masked on all processors.

Remove the chewing flags in the code.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:16 +01:00
Daniel Lezcano
54a0cd5a7e clocksource/drivers/h8300_timer8: Fix irq return value check
The value returned in case of error for the 'irq_of_parse_and_map' function is
zero in case of error. Fix the check in the init code.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:14 +01:00
Daniel Lezcano
1f058d52b3 clocksource/drivers/h8300_timer8: Remove PERIODIC and ONESHOT macro
Specify the delta as parameter for the timer8_clock_event_start function
instead of using a macro to tell PERIODIC or ONESHOT.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:13 +01:00
Daniel Lezcano
7116ae437f clocksource/drivers/h8300_timer8: Remove unused macros
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:11 +01:00
Daniel Lezcano
d1f9db13e3 clocksource/drivers/h8300_timer8: Remove unused headers
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:09 +01:00
Daniel Lezcano
31221a4bfb clocksource/drivers/h8300_tpu: Remove pointless headers for TPU
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:08 +01:00
Daniel Lezcano
9471f1d954 clocksource/drivers/h8300_tpu: Remove unused macros
Some macros are unused, delete them.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:06 +01:00
Daniel Lezcano
8c09b7d6ba clocksource/drivers/h8300_timer8: Fix compilation error with dev_warn
The dev_warn is using the platform driver which was removed in the previous
patch.

Let's replace dev_warn by pr_warn.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:04 +01:00
Yoshinori Sato
4633f4cac8 clocksource/drivers/h8300: Cleanup startup and remove module code.
Remove some legacy code and replace it by the clksrc-of code.

Do some cleanup and code consolidation.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:02 +01:00
Jisheng Zhang
9115df89d1 clocksource/drivers/dw_apb_timer_of: Implement ARM delay timer
Implement an ARM delay timer to be used for udelay(). This allows us to
skip the delay loop calibration at boot on Marvell BG2, BG2Q, BG2CD
platforms. And after this patch, udelay() will be unaffected by CPU
frequency changes.

Note: Although in case there are several possible delay timers, we may
not select the "best" delay timer. Take one Marvell Berlin platform for
example: we have arch timer and dw-apb timer. The arch timer freq is
25MHZ while the dw-apb timer freq is 100MHZ, current selection would
choose the dw-apb timer. But the dw apb timer is on the APB bus while
arch timer sits in CPU, the cost of accessing the apb timer is higher
than the arch timer. We could introduce "rating" concept to delay
timer, but this approach "brings a lot of complexity and workarounds
in the code for a small benefit" as pointed out by Daniel.

Later, Arnd pointed out "However, we could argue that this actually
doesn't matter at all, because the entire point of the ndelay()/
udelay()/mdelay() functions is to waste CPU cycles doing not much at
all, so we can just as well waste them reading the timer register
than spinning on the CPU reading the arch timer more often.", so we
just simply register the dw apb base delay timer.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:42:00 +01:00
Daniel Lezcano
0901f18432 clocksource/drivers/Kconfig: Add missing GENERIC_CLOCKEVENTS dependency
In order to compile on all arch without error with 'allyesconfig' make
sure the platform selected the GENERIC_CLOCKEVENTS. Without this patch
the new added drivers will prevent the kernel to compile on PARISC.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:58 +01:00
Daniel Lezcano
ef49336bbd clocksource/drivers/fsl-ftm: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:56 +01:00
Daniel Lezcano
778c5696b9 clocksource/drivers/samsung-pwm: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:54 +01:00
Daniel Lezcano
39366ef421 clocksource/drivers/exynos_mct: Fix Kconfig and add COMPILE_TEST option
Let the platform's Kconfig to select the clock instead of having a reverse
dependency from the driver to the platform options.

Add the COMPILE_TEST option for the compilation test coverage. Due to the
non portable 'delay' code, this driver is only compilable on ARM.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-12-15 09:41:52 +01:00
Daniel Lezcano
1becd6edea clocksource/drivers/prcmu: Fix Kconfig and add COMPILE_TEST option
Let the platform's Kconfig to select the clock instead of having a reverse
dependency from the driver to the platform options.

Add the COMPILE_TEST option for the compilation test coverage.

This change is debatable as the option itself in the Kconfig allows to
select the driver for the platform or not. This change will make the prcmu
timer always selected.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2015-12-15 09:41:50 +01:00
Daniel Lezcano
7032965306 clocksource/drivers/nomadik_mtu: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Due to the non portable code for the delay timer, this option is only
available for the ARM architecture.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:49 +01:00
Daniel Lezcano
ddcf48c776 clocksource/drivers/lpc32xx: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:47 +01:00
Daniel Lezcano
b9755841e7 clocksource/drivers/asm9260: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:45 +01:00
Daniel Lezcano
57f49318f9 clocksource/drivers/cadence_ttc: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

The driver depends on the common clock framework, thus the dependency added
on COMMON_CLK.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:44 +01:00
Daniel Lezcano
b4bdf7ef30 clocksource/drivers/vt8500: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:42 +01:00
Daniel Lezcano
351bb99b71 clocksource/drivers/vt8500: Remove unneeded header
Remove the <asm/time.h> header inclusion which is pointless.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:40 +01:00
Daniel Lezcano
adce4bc831 clocksource/drivers/tegra2: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Due to the non portable code for the delay timer, this option is only
available for the ARM architecture.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:39 +01:00
Daniel Lezcano
f0c5afb787 clocksource/drivers/sun5i: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

The driver depends on the common clock framework, thus the dependency added
on COMMON_CLK.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:37 +01:00
Daniel Lezcano
b4fcd48b88 clocksource/drivers/sun4i: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:35 +01:00
Daniel Lezcano
5b097f6ba5 clocksource/drivers/dw_apb: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:34 +01:00
Daniel Lezcano
e6c1db13f9 clocksource/drivers/digicolor: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:32 +01:00
Daniel Lezcano
c916554971 clocksource/drivers/orion: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

The driver is using the atomic_io API which is not portable, so the
compilation is restricted to ARM only.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:30 +01:00
Daniel Lezcano
0b7a7bb705 clocksource/drivers/meson6: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:29 +01:00
Daniel Lezcano
9519e80c75 clocksource/drivers/armada-370-xp: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Due to the non portable 'delay' code, the compilation is restricted to the
ARM architecture only.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:27 +01:00
Daniel Lezcano
40ada2aac5 clocksource/drivers/rockchip: Add COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Due to the dsb() usage in the driver, this driver is only compilable on
ARM and ARM64.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:25 +01:00
Daniel Lezcano
fbca9eabe9 clocksource/drivers/mediatek: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:24 +01:00
Daniel Lezcano
dfdb16525b clocksource/drivers/pistachio: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:22 +01:00
Daniel Lezcano
5a7351f0e1 clocksource/drivers/tango: Add COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:20 +01:00
Daniel Lezcano
5ae996cbee clocksource/drivers/pxa_timer: Add the COMPILE_TEST option
Increase the compilation test coverage by adding the COMPILE_TEST option.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:19 +01:00
Daniel Lezcano
389d9b5841 clocksource/drivers/pxa_timer: Move the Kconfig rule
Instead of having the clocksource's Kconfig depending on the arch, let the
arch to select the timer it needs.

The CLKSRC_OF dependency is removed because already selected by the
ARCH_PXA, and it is added for SA1100.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2015-12-15 09:41:17 +01:00