History log of /linux-master/drivers/clocksource/timer-imx-gpt.c
Revision Date Author Comments
# bf3159c0 27-Dec-2023 Daniel Lezcano <daniel.lezcano@linaro.org>

clocksource/drivers/imx: Fix -Wunused-but-set-variable warning

All warnings (new ones prefixed by >>):

drivers/clocksource/timer-imx-gpt.c: In function 'mxc_timer_interrupt':
>> drivers/clocksource/timer-imx-gpt.c:279:18: warning: variable 'tstat' set but not used [-Wunused-but-set-variable]
279 | uint32_t tstat;
| ^~~~~

vim +/tstat +279 drivers/clocksource/timer-imx-gpt.c

The change remove the tstats assignment but not the reading of the
register, assuming the register may be a ROR (Reset On Read) which
happens in the driver's interrupt registers.

Fixes: df181e382816 ("clocksource/drivers/imx-gpt: Add support for ARM64")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312231803.XzPddRa5-lkp@intel.com/
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231227143546.2823683-1-daniel.lezcano@linaro.org


# 8051a993 09-Oct-2023 Jacky Bai <ping.bai@nxp.com>

clocksource/drivers/timer-imx-gpt: Fix potential memory leak

Fix coverity Issue CID 250382: Resource leak (RESOURCE_LEAK).
Add kfree when error return.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231009083922.1942971-1-ping.bai@nxp.com


# 281bf6b9 27-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

clocksource/drivers/imx-gpt: Fold <soc/imx/timer.h> into its only user

Only the imx-gpt timer driver makes use of enum imx_gpt_type that is
otherwise unused. Move its definition into the timer-imx-gpt driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230328100531.879485-3-u.kleine-koenig@pengutronix.de


# 95aded1b 28-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

clocksource/drivers/imx-gpt: Use only a single name for functions

When looking at the data structs defining the different behaviours of
the GPT blocks in different SoCs it's not helpful that the same
functions are used with different names.

So drop the cpp defines and use the original names.

This commit was generated using:

perl -i -e 'my %m; while (<>) { if (/^#define (imx[a-zA-Z0-6_]*)\s(imx[a-zA-Z0-6_]*)/) {$m{$1} = $2; } else { foreach my $f (keys %m) {s/$f/$m{$f}/; } print; } }' drivers/clocksource/timer-imx-gpt.c

This patch has no effect on the generated code.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230328091514.874724-1-u.kleine-koenig@pengutronix.de


# f68a40ee 07-Mar-2023 Fabio Estevam <festevam@denx.de>

clocksource/drivers/timer-imx-gpt: Remove non-DT function

mxc_timer_init() was originally only used by non-DT i.MX platforms.

i.MX has already been converted to be a DT-only platform.

Remove the unused mxc_timer_init() function.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230307124313.708255-1-festevam@denx.de


# cc2550b4 27-Feb-2020 afzal mohammed <afzal.mohd.ma@gmail.com>

clocksource: Replace setup_irq() by request_irq()

request_irq() is preferred over setup_irq(). The early boot setup_irq()
invocations happen either via 'init_IRQ()' or 'time_init()', while
memory allocators are ready by 'mm_init()'.

Per tglx[1], setup_irq() existed in olden days when allocators were not
ready by the time early interrupts were initialized.

Hence replace setup_irq() by request_irq().

Seldom remove_irq() usage has been observed coupled with setup_irq(),
wherever that has been found, it too has been replaced by free_irq().

A build error that was reported by kbuild test robot <lkp@intel.com>
in the previous version of the patch also has been fixed.

[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos

Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/91961c77c1cf93d41523f5e1ac52043f32f97077.1582799709.git.afzal.mohd.ma@gmail.com


# ec3372f2 05-Nov-2018 Clément Péron <peron.clem@gmail.com>

clocksource/drivers/imx-gpt: Remove unnecessary irq protection

shutdown and oneshot are already protected against irq interruptions

Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# df181e38 04-Nov-2018 Anson Huang <anson.huang@nxp.com>

clocksource/drivers/imx-gpt: Add support for ARM64

This patch allows building and compile-testing the i.MX GPT driver
also for ARM64. The delay_timer is only supported on ARMv7.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# c53bb605 22-May-2018 Fabio Estevam <fabio.estevam@nxp.com>

clocksource/drivers/timer-imx-gpt: Switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# 377873c1 22-May-2018 Fabio Estevam <fabio.estevam@nxp.com>

clocksource/drivers/timer-imx-gpt: Remove outdated file path

imx gpt timer driver has been moved from arch/arm/mach-imx to
drivers/clocksource/ a long time ago, so remove the reference
to the old file path.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# 17273395 26-May-2017 Daniel Lezcano <daniel.lezcano@linaro.org>

clocksource/drivers: Rename CLOCKSOURCE_OF_DECLARE to TIMER_OF_DECLARE

The CLOCKSOURCE_OF_DECLARE macro is used widely for the timers to declare the
clocksource at early stage. However, this macro is also used to initialize
the clockevent if any, or the clockevent only.

It was originally suggested to declare another macro to initialize a
clockevent, so in order to separate the two entities even they belong to the
same IP. This was not accepted because of the impact on the DT where splitting
a clocksource/clockevent definition does not make sense as it is a Linux
concept not a hardware description.

On the other side, the clocksource has not interrupt declared while the
clockevent has, so it is easy from the driver to know if the description is
for a clockevent or a clocksource, IOW it could be implemented at the driver
level.

So instead of dealing with a named clocksource macro, let's use a more generic
one: TIMER_OF_DECLARE.

The patch has not functional changes.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>


# 177cf6e5 06-Jun-2016 Daniel Lezcano <daniel.lezcano@linaro.org>

clocksources: Switch back to the clksrc table

All the clocksource drivers's init function are now converted to return
an error code. CLOCKSOURCE_OF_DECLARE is no longer used as well as the
clksrc-of table.

Let's convert back the names:
- CLOCKSOURCE_OF_DECLARE_RET => CLOCKSOURCE_OF_DECLARE
- clksrc-of-ret => clksrc-of

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

For exynos_mct and samsung_pwm_timer:
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

For arch/arc:
Acked-by: Vineet Gupta <vgupta@synopsys.com>

For mediatek driver:
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

For the Rockchip-part
Acked-by: Heiko Stuebner <heiko@sntech.de>

For STi :
Acked-by: Patrice Chotard <patrice.chotard@st.com>

For the mps2-timer.c and versatile.c changes:
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>

For the OXNAS part :
Acked-by: Neil Armstrong <narmstrong@baylibre.com>

For LPC32xx driver:
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>

For Broadcom Kona timer change:
Acked-by: Ray Jui <ray.jui@broadcom.com>

For Sun4i and Sun5i:
Acked-by: Chen-Yu Tsai <wens@csie.org>

For Meson6:
Acked-by: Carlo Caione <carlo@caione.org>

For Keystone:
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

For NPS:
Acked-by: Noam Camus <noamca@mellanox.com>

For bcm2835:
Acked-by: Eric Anholt <eric@anholt.net>


# c11cd416 06-Jun-2016 Daniel Lezcano <daniel.lezcano@linaro.org>

clocksource/drivers/imx-gpt: Convert init function to return error

The init functions do not return any error. They behave as the following:

- panic, thus leading to a kernel crash while another timer may work and
make the system boot up correctly

or

- print an error and let the caller unaware if the state of the system

Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.

Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# f1c08c9b 14-Oct-2015 Lucas Stach <l.stach@pengutronix.de>

clocksource/drivers/imx: Allow timer irq affinity change

Allow the timer core to change the smp affinity of the broadcast timer
irq by setting CLOCK_EVT_FEAT_DYNIRQ flag. For this to work the timer
core needs to be told about the used irq.

This reduces interrupt pressure and wakeups on CPU0 as well as vastly
reducing the number of timer broadcast IPIs.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# be3b0f9b 20-Aug-2015 Guenter Roeck <linux@roeck-us.net>

clocksource/imx: Fix boot with non-DT systems

Commit 6dd747825b20 ("ARM: imx: move timer resources into a structure")
moved initialization parameters into a data structure, but neglected to set
the irq field in that data structure for non-DT boots. This causes the system
to hang if a non-DT boot is attempted.

Fixes: 6dd747825b20 ("ARM: imx: move timer resources into a structure")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1440066441-13930-1-git-send-email-linux@roeck-us.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


# 26b91f04 06-Jul-2015 Viresh Kumar <viresh.kumar@linaro.org>

clockevents/drivers/timer-imx-gpt: Migrate to new 'set-state' interface

Migrate timer-imx-gpt driver to the new 'set-state' interface provided
by clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Also drop:
- 'imx_timer.cem': It was caching the last state of the clockevent
device. The same behavior can be achieved by using clockevents state
helpers. These helpers are only required for oneshot mode as
shutdown/resume wouldn't be done twice by the core.

- 'clock_event_mode_label': CLOCK_EVT_MODE_* shouldn't be used anymore
by drivers. The prints are modified to print the set-state functions
name now to debug the driver.

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# 747d34e7 27-Jun-2015 Philippe Reynes <tremyfr@gmail.com>

clocksource/imx: Define clocksource for mx27

The rework of the imx clocksource driver missed to add an entry for
imx27 which results in a boot failure on those machines.

Add the proper CLOCKSOURCE_OF_DECLARE() entry for imx27 and map it to
the imx21 init.

Fixes: bef11c881ba5 'ARM: imx: initialize gpt device type for DT boot'
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: daniel.lezcano@linaro.org
Cc: fabio.estevam@freescale.com
Cc: shawnguo@kernel.org
Cc: kernel@pengutronix.de
Link: http://lkml.kernel.org/r/1435439504-406-1-git-send-email-tremyfr@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


# cc013fa8 29-May-2015 Shawn Guo <shawn.guo@linaro.org>

clocksource: timer-imx-gpt: remove include of <asm/mach/time.h>

The include of <asm/mach/time.h> is not needed at all, and causes build
error in some cases. Remove it.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>


# bea5af41 15-May-2015 Shawn Guo <shawn.guo@linaro.org>

ARM: imx: move timer driver into drivers/clocksource

After the cleanup on imx timer driver, now it's ready to be moved into
drivers/clocksource/. Let's do it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>