History log of /linux-master/drivers/rtc/rtc-imxdi.c
Revision Date Author Comments
# 482ca730 02-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: imxdi: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# e6d44306 02-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: imxdi: Mark driver struct with __refdata to prevent section mismatch warning

As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# bcae59d0 11-May-2021 Martin Kaiser <martin@kaiser.cx>

rtc: imxdi: add wakeup support

The DryIce-based RTC supports alarms that trigger an interrupt.

Configure this interrupt as a wakeup source that wakes the system up
from standby mode.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210511161244.16111-1-martin@kaiser.cx


# 198da7be 15-Mar-2021 Fabio Estevam <festevam@gmail.com>

rtc: imxdi: Convert to a DT-only driver

i.MX has been converted to a DT-only platform, so make the driver
depend on OF, remove the CONFIG_OF ifdefery and remove of_match_ptr().

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210315172029.173250-1-festevam@gmail.com


# fdcfd854 09-Nov-2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>

rtc: rework rtc_register_device() resource management

rtc_register_device() is a managed interface but it doesn't use devres
by itself - instead it marks an rtc_device as "registered" and the devres
callback for devm_rtc_allocate_device() takes care of resource release.

This doesn't correspond with the design behind devres where managed
structures should not be aware of being managed. The correct solution
here is to register a separate devres callback for unregistering the
device.

While at it: rename rtc_register_device() to devm_rtc_register_device()
and add it to the list of managed interfaces in devres.rst. This way we
can avoid any potential confusion of driver developers who may expect
there to exist a corresponding unregister function.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl


# 05513a70 23-Jun-2020 Tales L. da Aparecida <tales.aparecida@gmail.com>

rtc: imxdi: fix trivial typos

Fix typos 'pionter' -> 'pointer' and 'softwere' -> 'software'

Signed-off-by: Tales L. da Aparecida <tales.aparecida@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200624012119.54768-1-tales.aparecida@gmail.com


# f7234a98 17-Jul-2019 Anson Huang <Anson.Huang@nxp.com>

rtc: imxdi: use devm_platform_ioremap_resource() to simplify code

Use the new helper devm_platform_ioremap_resource() which wraps the
platform_get_resource() and devm_ioremap_resource() together, to
simplify the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/20190717081411.30622-1-Anson.Huang@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 557fbf4f 03-May-2019 Anders Roxell <anders.roxell@linaro.org>

rtc: imxdi: remove unused variable

This variable is no longer used and the compiler rightly complains that
it should be removed.

../drivers/rtc/rtc-imxdi.c: In function ‘dryice_rtc_set_alarm’:
../drivers/rtc/rtc-imxdi.c:633:16: warning: unused variable ‘now’ [-Wunused-variable]
unsigned long now;
^~~

Rework to remove the unused variable.

Fixes: 629d488a3eb6 ("rtc: imxdi: remove unnecessary check")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# c8889bb6 16-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: imxdi: convert to SPDX identifier

Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 629d488a 16-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: imxdi: remove unnecessary check

The RTC core already ensures the alarm is set to a time in the future, it
is not necessary to check again in the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# d231d32c 16-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: imxdi: use .set_time

Use .set_time instead of the deprecated .set_mmss.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 93059793 16-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: imxdi: switch to rtc_time64_to_tm/rtc_tm_to_time64

Call the 64bit versions of rtc_tm time conversion now that the range is
enforced by the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 21c9dfda 16-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: imxdi: set range

The RTC Time Counter MSB Register contains the 32 most significant bits
(47:16) of the 47-bit RTC Time Counter. Clocked by a 32.768 KHz clock, this
register is effectively a 32-bit seconds counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 2055da97 19-Jun-2017 Ingo Molnar <mingo@kernel.org>

sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming

So I've noticed a number of instances where it was not obvious from the
code whether ->task_list was for a wait-queue head or a wait-queue entry.

Furthermore, there's a number of wait-queue users where the lists are
not for 'tasks' but other entities (poll tables, etc.), in which case
the 'task_list' name is actively confusing.

To clear this all up, name the wait-queue head and entry list structure
fields unambiguously:

struct wait_queue_head::task_list => ::head
struct wait_queue_entry::task_list => ::entry

For example, this code:

rqw->wait.task_list.next != &wait->task_list

... is was pretty unclear (to me) what it's doing, while now it's written this way:

rqw->wait.head.next != &wait->entry

... which makes it pretty clear that we are iterating a list until we see the head.

Other examples are:

list_for_each_entry_safe(pos, next, &x->task_list, task_list) {
list_for_each_entry(wq, &fence->wait.task_list, task_list) {

... where it's unclear (to me) what we are iterating, and during review it's
hard to tell whether it's trying to walk a wait-queue entry (which would be
a bug), while now it's written as:

list_for_each_entry_safe(pos, next, &x->head, entry) {
list_for_each_entry(wq, &fence->wait.head, entry) {

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# 8bc57e7f 05-Jan-2017 Bhumika Goyal <bhumirks@gmail.com>

rtc: constify rtc_class_ops structures

Declare rtc_class_ops structures as const as they are only passed
as an argument to the function devm_rtc_device_register. This argument
is of type const struct rtc_class_ops *, so rtc_class_ops structures
having this property can be declared const.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct rtc_class_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
devm_rtc_device_register(...,&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct rtc_class_ops i;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# fef1eeb1 03-Jan-2017 Martin Kaiser <martin@kaiser.cx>

rtc: imxdi: use the security violation interrupt

The DryIce chipset has a dedicated security violation interrupt that is
triggered for security violations (if configured to do so). According
to the publicly available imx258 reference manual, irq 56 is used for
this interrupt.

If an irq number is provided for the security violation interrupt,
install the same handler that we're already using for the "normal"
interrupt.

imxdi->irq is used only in the probe function, make it a local variable.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# b88e0ae9 19-Nov-2016 Martin Kaiser <martin@kaiser.cx>

rtc: imxdi: (trivial) fix a typo

Fix a typo

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# d5878a86 28-Nov-2015 Colin Ian King <colin.king@canonical.com>

rtc: imxdi: fix spelling mistake in warning message

Minor issue, fix spelling mistake, happend -> happened

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 9bb698c6 27-Apr-2015 Juergen Borleis <jbe@pengutronix.de>

rtc: imxdi: when locked, do not fail silently

If the DryICE unit is locked it is impossible to set the time. Provide an
error message for this case.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Robert Schwebel <rsc@pengutronix.de>
[rsc: got NDA clearance from Freescale]
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# a7c535e3 27-Apr-2015 Juergen Borleis <jbe@pengutronix.de>

rtc: imxdi: monitor a security violation at runtime

Maybe the unit enters the hardware related state at runtime and not at
system boot time (after a power cycle).

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Robert Schwebel <rsc@pengutronix.de>
[rsc: got NDA clearance from Freescale]
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# c7e9bbe0 27-Apr-2015 Juergen Borleis <jbe@pengutronix.de>

rtc: imxdi: add the unit recovery code

This code is required to recover the unit from a security violation.
Hopefully this code can recover the unit from a hardware related invalid
state as well.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Robert Schwebel <rsc@pengutronix.de>
[rsc: got NDA clearance from Freescale]
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 3ba3fab7 27-Apr-2015 Juergen Borleis <jbe@pengutronix.de>

rtc: imxdi: add some background info about the states the machine can be in

Document the i.MX DryIce machine states.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Robert Schwebel <rsc@pengutronix.de>
[rsc: got NDA clearance from Freescale]
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# e30d3131 27-Apr-2015 Juergen Borleis <jbe@pengutronix.de>

rtc: imxdi: avoid the __raw* register access functions

Be independent of the endianness of the kernel.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 46edeffa 13-Feb-2015 Juergen Borleis <jbe@pengutronix.de>

drivers/rtc/rtc-imxdi.c: add more known register bits

Intended for monitoring and controlling the security features. These bits
are required to bring this unit back to live after a security violation
event was detected. The code to bring it back to live will follow after a
vendor clearance.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 6df17a65 13-Feb-2015 Juergen Borleis <jbe@pengutronix.de>

drivers/rtc/rtc-imxdi.c: trivial clean up code

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 0929ae37 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

rtc: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 3378f73d 03-Apr-2014 Fabio Estevam <fabio.estevam@freescale.com>

drivers/rtc/rtc-imxdi.c: check the return value from clk_prepare_enable()

clk_prepare_enable() may fail, so let's check its return value and
propagate it in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 7c1d69ee 11-Sep-2013 Julia Lawall <Julia.Lawall@lip6.fr>

rtc: simplify devm_request_mem_region/devm_ioremap

Convert the composition of devm_request_mem_region and devm_ioremap to a
single call to devm_ioremap_resource. The associated call to
platform_get_resource is also simplified and moved next to the new call
to devm_ioremap_resource.

This was done using a combination of the semantic patches
devm_ioremap_resource.cocci and devm_request_and_ioremap.cocci, found in
the scripts/coccinelle/api directory.

In rtc-lpc32xx.c and rtc-mv.c, the local variable size is no longer needed.

In rtc-ds1511.c the size field of the local structure is not useful any
more, and is deleted.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 04f70e4c 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-imxdi: use devm_rtc_device_register()

devm_rtc_device_register() is device managed and makes cleanup
paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 61534342 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-imxdi: use module_platform_driver_probe()

Use module_platform_driver_probe() macro which makes the code smaller and
simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5073cba6 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-imxdi: add __init/__exit annotation

When platform_driver_probe() is used, bind/unbind via sysfs is disabled.
Thus, __init/__exit annotations can be added to probe()/remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 9510853c 21-Feb-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-imxdi: use devm_clk_get()

Use devm_clk_get() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5a167f45 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Drivers: rtc: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ba3f7a17 20-Dec-2012 Jean Delvare <khali@linux-fr.org>

drivers/rtc/rtc-imxdi.c: must include <linux/spinlock.h>

Add the missing header include for spinlocks, to avoid potential build
failures on specific architectures or configurations.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 968d21c2 17-Dec-2012 Roland Stigge <stigge@antcom.de>

drivers/rtc/rtc-imxdi.c: add devicetree support

Add device tree support to the rtc-imxdi driver.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# fee0de77 25-Oct-2012 Jan Luebbe <jlu@pengutronix.de>

drivers/rtc/rtc-imxdi.c: add missing spin lock initialization

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Roland Stigge <stigge@antcom.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Roland Stigge <stigge@antcom.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 4ec8c7f5 25-Apr-2012 Sascha Hauer <s.hauer@pengutronix.de>

rtc: imx dryice: Add missing clk_prepare

prepare the clock before enabling it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>


# d4c32f35 14-Sep-2011 Axel Lin <axel.lin@gmail.com>

drivers/rtc/rtc-imxdi.c needs linux/sched.h

Include linux/sched.h to fix below build error.

CC drivers/rtc/rtc-imxdi.o
drivers/rtc/rtc-imxdi.c: In function 'di_write_wait':
drivers/rtc/rtc-imxdi.c:168: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
drivers/rtc/rtc-imxdi.c:168: error: (Each undeclared identifier is reported only once
drivers/rtc/rtc-imxdi.c:168: error: for each function it appears in.)
drivers/rtc/rtc-imxdi.c:168: error: implicit declaration of function 'signal_pending'
drivers/rtc/rtc-imxdi.c:168: error: implicit declaration of function 'schedule_timeout'
drivers/rtc/rtc-imxdi.c: In function 'dryice_norm_irq':
drivers/rtc/rtc-imxdi.c:329: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# eba54546 10-Aug-2010 Baruch Siach <baruch@tkos.co.il>

rtc: driver for the DryIce block found in i.MX25 chips

This driver is based on code from Freescale which accompanies their i.MX25
PDK board, with some cleanup.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sascha Hauer <kernel@pengutronix.de>
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>