platform/kernel/linux-rpi.git
5 years agortc: pcf85363: convert to SPDX identifier
Alexandre Belloni [Wed, 10 Apr 2019 20:56:04 +0000 (22:56 +0200)]
rtc: pcf85363: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85363: remove useless forward declaration
Alexandre Belloni [Wed, 10 Apr 2019 20:56:03 +0000 (22:56 +0200)]
rtc: pcf85363: remove useless forward declaration

It is not necessary to forward declare pcf85363_driver as it is not used
before being declared.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85363: remove bogus i2c functionality check
Alexandre Belloni [Wed, 10 Apr 2019 20:56:02 +0000 (22:56 +0200)]
rtc: pcf85363: remove bogus i2c functionality check

regmap is abstracting the i2c functionalities the best it can, there is no
need to check.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85363: set range
Alexandre Belloni [Wed, 10 Apr 2019 20:56:01 +0000 (22:56 +0200)]
rtc: pcf85363: set range

This is a standard BCD RTC that will fail in 2100.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85363: remove unused struct pcf85363 member
Alexandre Belloni [Wed, 10 Apr 2019 20:56:00 +0000 (22:56 +0200)]
rtc: pcf85363: remove unused struct pcf85363 member

pcf85363->dev is unused, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: stmp3xxx: convert to SPDX identifier
Alexandre Belloni [Sun, 7 Apr 2019 21:12:23 +0000 (23:12 +0200)]
rtc: stmp3xxx: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: stmp3xxx: use .set_time
Alexandre Belloni [Sun, 7 Apr 2019 21:12:22 +0000 (23:12 +0200)]
rtc: stmp3xxx: use .set_time

Use .set_time instead of the deprecated .set_mmss.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: stmp3xxx: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Sun, 7 Apr 2019 21:12:21 +0000 (23:12 +0200)]
rtc: stmp3xxx: 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>
5 years agortc: stmp3xxx: set range
Alexandre Belloni [Sun, 7 Apr 2019 21:12:20 +0000 (23:12 +0200)]
rtc: stmp3xxx: set range

From the datasheet: "HW_RTC_SECONDS provides access to the 32-bit real-time
seconds counter."

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: tegra: convert to SPDX identifier
Alexandre Belloni [Sun, 7 Apr 2019 21:16:46 +0000 (23:16 +0200)]
rtc: tegra: convert to SPDX identifier

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

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: tegra: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Sun, 7 Apr 2019 21:16:45 +0000 (23:16 +0200)]
rtc: tegra: 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.

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: tegra: set range
Alexandre Belloni [Sun, 7 Apr 2019 21:16:44 +0000 (23:16 +0200)]
rtc: tegra: set range

The Tegra 20 RTC is a 32bit seconds counter (with an unused millisecond
counter).

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: coh901331: convert to SPDX identifier
Alexandre Belloni [Sun, 7 Apr 2019 21:10:27 +0000 (23:10 +0200)]
rtc: coh901331: convert to SPDX identifier

Use SPDX-License-Identifier instead of the custom license line.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: coh901331: use .set_time
Alexandre Belloni [Sun, 7 Apr 2019 21:10:26 +0000 (23:10 +0200)]
rtc: coh901331: use .set_time

Use .set_time instead of the deprecated .set_mmss.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: coh901331: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Sun, 7 Apr 2019 21:10:25 +0000 (23:10 +0200)]
rtc: coh901331: 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.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: coh901331: set range
Alexandre Belloni [Sun, 7 Apr 2019 21:10:24 +0000 (23:10 +0200)]
rtc: coh901331: set range

The COH 901 331 is a 32bit seconds counter.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: switch debug message to %ptR
Alexandre Belloni [Sun, 7 Apr 2019 21:05:41 +0000 (23:05 +0200)]
rtc: ds1672: switch debug message to %ptR

Use %ptR to simplify debug message.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: convert to SPDX identifier
Alexandre Belloni [Sun, 7 Apr 2019 21:05:40 +0000 (23:05 +0200)]
rtc: ds1672: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: use .set_time
Alexandre Belloni [Sun, 7 Apr 2019 21:05:39 +0000 (23:05 +0200)]
rtc: ds1672: use .set_time

Use .set_time instead of the deprecated .set_mmss.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: use rtc_time64_to_tm
Alexandre Belloni [Sun, 7 Apr 2019 21:05:38 +0000 (23:05 +0200)]
rtc: ds1672: use rtc_time64_to_tm

Use the 64bit version of rtc_time_to_tm.rtc_time_to_tm.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: remove useless indirection
Alexandre Belloni [Sun, 7 Apr 2019 21:05:37 +0000 (23:05 +0200)]
rtc: ds1672: remove useless indirection

ds1672_get_datetime and ds1672_set_mmss are only used after casting dev
to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: remove sysfs debug interface
Alexandre Belloni [Sun, 7 Apr 2019 21:05:36 +0000 (23:05 +0200)]
rtc: ds1672: remove sysfs debug interface

Remove the control sysfs file as it is not documented, read only and was
only used to provide the oscillator state.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: move oscillator handling to .read_time
Alexandre Belloni [Sun, 7 Apr 2019 21:05:35 +0000 (23:05 +0200)]
rtc: ds1672: move oscillator handling to .read_time

Return -EINVAL when trying to read an invalid time instead of just probe
because this is a useful information for userspace.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ds1672: set range
Alexandre Belloni [Sun, 7 Apr 2019 21:05:34 +0000 (23:05 +0200)]
rtc: ds1672: set range

The ds1672 is a 32bit seconds counter.

Also remove erroneous comment claiming that epoch is set to 2000, it was
not.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: test: use .set_time
Alexandre Belloni [Sun, 7 Apr 2019 21:30:12 +0000 (23:30 +0200)]
rtc: test: use .set_time

Use .set_time instead of the deprecated .set_mmss64.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: lib: check whether tm->tm_year in int32 range
Xuefeng Wang [Fri, 15 Feb 2019 03:13:59 +0000 (11:13 +0800)]
rtc: lib: check whether tm->tm_year in int32 range

When setting rtc alarm (RTC_WKALM_SET), the tm_year is not checked if it
is in suiteable range. Use INT_MAX - 1900 to check it.

UBSAN: Undefined behaviour in drivers/rtc/rtc-lib.c:119:30
signed integer overflow:
2147483647 + 1900 cannot be represented in type 'int'
CPU: 1 PID: 20994 Comm: syz-executor0 Not tainted 4.19.18-514.55.6.9.x86_64
+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1
04/01/2014
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xca/0x13e lib/dump_stack.c:113
 ubsan_epilogue+0xe/0x81 lib/ubsan.c:159
 handle_overflow+0x193/0x1e2 lib/ubsan.c:190
 rtc_tm_to_time64+0x267/0x280 drivers/rtc/rtc-lib.c:119
 rtc_tm_to_ktime+0x16/0x70 drivers/rtc/rtc-lib.c:129
 rtc_set_alarm+0x1a9/0x2d0 drivers/rtc/interface.c:466
 rtc_dev_ioctl+0x6db/0x810 drivers/rtc/rtc-dev.c:380
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1a5/0x10b0 fs/ioctl.c:690
 ksys_ioctl+0x89/0xa0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:710
 do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462589
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08
0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8
64 89 01 48
RSP: 002b:00007f5348896c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000072bf00 RCX: 0000000000462589
RDX: 0000000020000000 RSI: 000000004028700f RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f53488976bc
R13: 00000000004bf67e R14: 00000000006f96e0 R15: 00000000ffffffff

==========================================================================

Signed-off-by: Xuefeng Wang <wxf.wang@hisilicon.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: don't reference bogus function pointer in kdoc
Wolfram Sang [Wed, 3 Apr 2019 15:19:52 +0000 (17:19 +0200)]
rtc: don't reference bogus function pointer in kdoc

The mentioned function pointer is long gone since early 2011. Remove the
reference in the comment and reword it slightly.

Fixes: 51ba60c5bb3b ("RTC: Cleanup rtc_class_ops->update_irq_enable()")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: remove unnecessary Kconfig dependencies
Alexandre Belloni [Tue, 2 Apr 2019 21:54:47 +0000 (23:54 +0200)]
rtc: remove unnecessary Kconfig dependencies

Remove the unused "depends on I2C" as the config options are already
guarded by if I2C.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: add RTC_VL_READ/RTC_VL_CLR support
Alexandre Belloni [Mon, 1 Apr 2019 16:08:16 +0000 (18:08 +0200)]
rtc: pcf85063: add RTC_VL_READ/RTC_VL_CLR support

Allow reading the oscillator status bit. Also allow clearing it even if
that makes little sense and can't be done in a race free way.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: add offset correction support
Alexandre Belloni [Mon, 1 Apr 2019 16:08:15 +0000 (18:08 +0200)]
rtc: pcf85063: add offset correction support

The PCF850363 has an offset correction with two modes:

With mode 0, the correction is triggered once every two hours and then
correction pulses are applied once per minute until the programmed
correction values have been implemented. This gives a step of 4.34 ppm.

With mode 1, the correction is triggered once every four minutes and then
correction pulses are applied once per second up to a maximum of 60 pulses.
When correction values greater than 60 pulses are used, additional
correction pulses are made in the 59 th second. This gives a step of 4.069
ppm.

Use the correction closest to the requested value.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: add nvram support
Alexandre Belloni [Mon, 1 Apr 2019 16:08:14 +0000 (18:08 +0200)]
rtc: pcf85063: add nvram support

The pcf85063 has one byte of nvram.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: add Micro Crystal RV8263 support
Alexandre Belloni [Mon, 1 Apr 2019 16:08:13 +0000 (18:08 +0200)]
rtc: pcf85063: add Micro Crystal RV8263 support

The Micro Crystal RV8263 has the same IC as the pcf85063 but has an on
board crystal. This means that the CAP_SEL bit has to be cleared so the
correct capacitance is selected for the crystal.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: add alarm support
Alexandre Belloni [Mon, 1 Apr 2019 16:08:12 +0000 (18:08 +0200)]
rtc: pcf85063: add alarm support

Add support for the alarms. The match on the weekday is not used as it it
not necessarily properly set.

The tested RTC shows a behaviour where setting an alarm on the second right
after an alarm that fired is not working, probably because of the circuit
that ensures an alarm only fires once. This is why uie_unsupported is set.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: differentiate pcf85063a and pcf85063tp
Alexandre Belloni [Mon, 1 Apr 2019 16:08:11 +0000 (18:08 +0200)]
rtc: pcf85063: differentiate pcf85063a and pcf85063tp

As stated in a comment pcf85063a and pcf85063tp don't have the same number
of registers. Especially, pcf85063tp doesn't have alarm support.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: switch to regmap
Alexandre Belloni [Mon, 1 Apr 2019 16:08:10 +0000 (18:08 +0200)]
rtc: pcf85063: switch to regmap

Switch to regmap to simplify register accesses and remove the need for
pcf85063_stop_clock/pcf85063_start_clock.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: set range
Alexandre Belloni [Mon, 1 Apr 2019 16:08:09 +0000 (18:08 +0200)]
rtc: pcf85063: set range

This is a standard BCD RTC that will fail in 2100.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: convert to devm_rtc_allocate_device
Alexandre Belloni [Mon, 1 Apr 2019 16:08:08 +0000 (18:08 +0200)]
rtc: pcf85063: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: remove bogus i2c functionality check
Alexandre Belloni [Mon, 1 Apr 2019 16:08:07 +0000 (18:08 +0200)]
rtc: pcf85063: remove bogus i2c functionality check

Only smbus reads and write are done in the driver, plain i2c functionality
is not required.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: convert to SPDX identifier
Alexandre Belloni [Mon, 1 Apr 2019 16:33:49 +0000 (18:33 +0200)]
rtc: pcf85063: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: pcf85063: switch to probe_new
Alexandre Belloni [Mon, 1 Apr 2019 16:08:05 +0000 (18:08 +0200)]
rtc: pcf85063: switch to probe_new

struct i2c_device_id argument of probe() is not used, so use probe_new()
instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: snvs: use devm_platform_ioremap_resource() to simplify code
Anson Huang [Mon, 1 Apr 2019 05:29:13 +0000 (05:29 +0000)]
rtc: snvs: 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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: mxc: use devm_platform_ioremap_resource() to simplify code
Anson Huang [Mon, 1 Apr 2019 05:21:43 +0000 (05:21 +0000)]
rtc: mxc: 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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: snvs: use dev_pm_set_wake_irq() to simplify code
Anson Huang [Wed, 27 Mar 2019 06:18:20 +0000 (06:18 +0000)]
rtc: snvs: use dev_pm_set_wake_irq() to simplify code

With calling dev_pm_set_wake_irq() to set SNVS RTC as wakeup
source for suspend, generic wake irq mechanism will automatically
enable it as wakeup source when suspend, then the suspend/resume
callback which are ONLY for enabling/disabling irq wake can be
removed, it simplifies the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: Add ASPEED RTC driver
Joel Stanley [Wed, 27 Mar 2019 01:02:15 +0000 (11:32 +1030)]
rtc: Add ASPEED RTC driver

Read and writes the time to the non-battery backed RTC in the ASPEED BMC
system on chip families.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agodt-bindings: rtc: Add on-chip ASPEED RTC documentation
Joel Stanley [Wed, 27 Mar 2019 01:02:14 +0000 (11:32 +1030)]
dt-bindings: rtc: Add on-chip ASPEED RTC documentation

Describe the RTC as used in the ASPEED BMC SoCs.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: brcmstb-waketimer: switch to rtc_time64_to_tm
Alexandre Belloni [Mon, 25 Mar 2019 17:17:19 +0000 (18:17 +0100)]
rtc: brcmstb-waketimer: switch to rtc_time64_to_tm

Call the 64bit version of rtc_time_to_tm as the range is enforced by the
core.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: mt6397: Don't call irq_dispose_mapping.
Pi-Hsun Shih [Mon, 11 Mar 2019 07:55:40 +0000 (15:55 +0800)]
rtc: mt6397: Don't call irq_dispose_mapping.

The IRQ mapping was changed to not being created in the rtc-mt6397
driver, so the irq_dispose_mapping is no longer needed.
Also the dev_id passed to free_irq should be the same as the last
argument passed to request_threaded_irq.
This prevents a "Trying to free already-free IRQ 274" warning when
unbinding the driver.

Fixes: e695d3a0b3b3 ("mfd: mt6397: Create irq mappings in mfd core driver")
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: opal: Make opal_tpo_alarm_irq_enable static
YueHaibing [Tue, 19 Mar 2019 15:25:31 +0000 (23:25 +0800)]
rtc: opal: Make opal_tpo_alarm_irq_enable static

Fix sparse warning:

drivers/rtc/rtc-opal.c:227:5:
 warning: symbol 'opal_tpo_alarm_irq_enable' was not declared. Should it be static?

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900
Geert Uytterhoeven [Fri, 22 Mar 2019 07:26:12 +0000 (08:26 +0100)]
rtc: Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900

Printing "mktime64(1900, 1, 1, 0, 0, 0)" gives -2208988800.

Fixes: 83bbc5ac63326433 ("rtc: Add useful timestamp definitions")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: wm831x: convert to SPDX identifier
Alexandre Belloni [Fri, 22 Mar 2019 07:16:11 +0000 (08:16 +0100)]
rtc: wm831x: convert to SPDX identifier

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

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Fri, 22 Mar 2019 07:16:10 +0000 (08:16 +0100)]
rtc: wm831x: 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.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: wm831x: remove unnecessary goto
Alexandre Belloni [Fri, 22 Mar 2019 07:16:09 +0000 (08:16 +0100)]
rtc: wm831x: remove unnecessary goto

There is no specific handling in the error path of wm831x_rtc_probe, remove
the unnecessary goto and label.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: wm831x: set range
Alexandre Belloni [Fri, 22 Mar 2019 07:16:08 +0000 (08:16 +0100)]
rtc: wm831x: set range

The wm831x has a 32bit second counter.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: da9063: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Thu, 21 Mar 2019 10:15:57 +0000 (11:15 +0100)]
rtc: da9063: 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.

Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: da9063: set range
Alexandre Belloni [Thu, 21 Mar 2019 10:15:56 +0000 (11:15 +0100)]
rtc: da9063: set range

The DA9062 and DA9063 have a year register that can go up to 0x3F.

Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sun4v: switch to SPDX identifier
Alexandre Belloni [Fri, 22 Mar 2019 07:22:56 +0000 (08:22 +0100)]
rtc: sun4v: switch to SPDX identifier

Use SPDX-License-Identifier to be clearer on the license. Choose the v2
only as this is the default Linux license.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sun4v: set range
Alexandre Belloni [Fri, 22 Mar 2019 07:22:55 +0000 (08:22 +0100)]
rtc: sun4v: set range

The Sun4v Hypervisor Core API Specification states:
Time is described by a single unsigned 64-bit word equivalent to a time_t
for the POSIX time(2) system call. The word contains the time since the
Epoch (00:00:00 UTC, January 1, 1970), measured in seconds.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sun4v: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Fri, 22 Mar 2019 07:22:54 +0000 (08:22 +0100)]
rtc: sun4v: switch to rtc_time64_to_tm/rtc_tm_to_time64

Call the 64bit versions of rtc_tm time conversion as the hypervisor handles
64bit values.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: omap: convert to SPDX identifier
Alexandre Belloni [Mon, 18 Mar 2019 13:22:55 +0000 (14:22 +0100)]
rtc: omap: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: omap: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Mon, 18 Mar 2019 13:26:08 +0000 (14:26 +0100)]
rtc: omap: switch to rtc_time64_to_tm/rtc_tm_to_time64

Call the 64bit versions of rtc_time_to_tm now that the range is enforced by
the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ps3: set range
Alexandre Belloni [Wed, 20 Mar 2019 12:44:28 +0000 (13:44 +0100)]
rtc: ps3: set range

The PS3 has a 64bit second counter from 2000. While this exceeds the 64bit
UNIX timestamp, there is not doubt that non of them will still be working
by then.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ps3: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 20 Mar 2019 12:44:27 +0000 (13:44 +0100)]
rtc: ps3: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ps3: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:44:26 +0000 (13:44 +0100)]
rtc: ps3: convert to SPDX identifier

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

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 20 Mar 2019 12:44:25 +0000 (13:44 +0100)]
rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64

Call the 64bit versions of rtc_tm time conversion as the PS3 handles 64bit
values.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: correct trivial checkpatch warnings
Alexandre Belloni [Wed, 20 Mar 2019 12:40:42 +0000 (13:40 +0100)]
rtc: at91sam9: correct trivial checkpatch warnings

Correct trivial checkpatch warnings, mostly whitespace issues and
unbalanced braces.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:40:41 +0000 (13:40 +0100)]
rtc: at91sam9: convert to SPDX identifier

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

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 20 Mar 2019 12:40:40 +0000 (13:40 +0100)]
rtc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64

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

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: set range
Alexandre Belloni [Wed, 20 Mar 2019 12:40:39 +0000 (13:40 +0100)]
rtc: at91sam9: set range

The AT91 RTT is a 32bit second counter that is saved in a 32bit global
purpose register.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 20 Mar 2019 12:40:38 +0000 (13:40 +0100)]
rtc: at91sam9: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: at91sam9: drop platform_data support
Alexandre Belloni [Wed, 20 Mar 2019 12:40:37 +0000 (13:40 +0100)]
rtc: at91sam9: drop platform_data support

ARCH_AT91 is DT only for a while, drop platform data support.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sh: set range
Alexandre Belloni [Wed, 20 Mar 2019 11:30:10 +0000 (12:30 +0100)]
rtc: sh: set range

The SH RTC is a BCD RTC with some version having 4 digits for the year.

The range for the RTCs with only 2 digits for the year was unfortunately
shifted to handle 1999 to 2098.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sh: fix possible race condition
Alexandre Belloni [Wed, 20 Mar 2019 11:30:09 +0000 (12:30 +0100)]
rtc: sh: fix possible race condition

The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: sh: stop resetting time to epoch
Alexandre Belloni [Wed, 20 Mar 2019 11:30:08 +0000 (12:30 +0100)]
rtc: sh: stop resetting time to epoch

There is no point in resetting the time to epoch as this means that
userspace will never get the valuable information that time is actually
invalid.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
[Anders Roxell <anders.roxell@linaro.org>: remove unused variable r]
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: dm355evm: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:43:35 +0000 (13:43 +0100)]
rtc: dm355evm: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: dm355evm: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 20 Mar 2019 12:43:34 +0000 (13:43 +0100)]
rtc: dm355evm: switch to rtc_time64_to_tm/rtc_tm_to_time64

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: dm355evm: set range
Alexandre Belloni [Wed, 20 Mar 2019 12:43:33 +0000 (13:43 +0100)]
rtc: dm355evm: set range

The MSP430 has a 32bit second counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: dm355evm: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 20 Mar 2019 12:43:32 +0000 (13:43 +0100)]
rtc: dm355evm: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:34:17 +0000 (13:34 +0100)]
rtc: goldfish: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 20 Mar 2019 12:34:16 +0000 (13:34 +0100)]
rtc: goldfish: switch to rtc_time64_to_tm/rtc_tm_to_time64

This RTC handles dates after 2106 (up to July 2554), call the 64bit
versions of rtc_tm time conversion.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: allow building on more than MIPS
Alexandre Belloni [Wed, 20 Mar 2019 12:34:15 +0000 (13:34 +0100)]
rtc: goldfish: allow building on more than MIPS

Goldfish can be ARM or x86, allow building the driver for more than just
MIPS.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: sort headers
Alexandre Belloni [Wed, 20 Mar 2019 12:34:14 +0000 (13:34 +0100)]
rtc: goldfish: sort headers

Sort headers alphabetically.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: add range
Alexandre Belloni [Wed, 20 Mar 2019 12:34:13 +0000 (13:34 +0100)]
rtc: goldfish: add range

This RTC has a 64bit nanosecond counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: goldfish: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 20 Mar 2019 12:34:12 +0000 (13:34 +0100)]
rtc: goldfish: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: use .set_time
Alexandre Belloni [Wed, 20 Mar 2019 12:32:33 +0000 (13:32 +0100)]
rtc: xgene: use .set_time

Use .set_time instead of the deprecated .set_mmss.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 20 Mar 2019 12:32:32 +0000 (13:32 +0100)]
rtc: xgene: switch to rtc_time64_to_tm/rtc_tm_to_time64

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: stop caching alarm_time
Alexandre Belloni [Wed, 20 Mar 2019 12:32:31 +0000 (13:32 +0100)]
rtc: xgene: stop caching alarm_time

There is no point in caching alarm_time for .read_alarm because
.read_alarm is only called at boo time and thus alarm_time is always 0.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: correct checkpatch issues
Alexandre Belloni [Wed, 20 Mar 2019 12:32:30 +0000 (13:32 +0100)]
rtc: xgene: correct checkpatch issues

Correct trivial whitespace issues. Also sort the headers.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:32:29 +0000 (13:32 +0100)]
rtc: xgene: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: set range
Alexandre Belloni [Wed, 20 Mar 2019 12:32:28 +0000 (13:32 +0100)]
rtc: xgene: set range

CCVR is a 32bit second counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: xgene: fix possible race condition
Alexandre Belloni [Wed, 20 Mar 2019 12:32:27 +0000 (13:32 +0100)]
rtc: xgene: fix possible race condition

The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: test: do not use assignment in if condition
Alexandre Belloni [Wed, 20 Mar 2019 12:03:12 +0000 (13:03 +0100)]
rtc: test: do not use assignment in if condition

Fix checkpatch error:
drivers/rtc/rtc-test.c:155: ERROR: do not use assignment in if condition

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: 88pm80x: convert to SPDX identifier
Alexandre Belloni [Wed, 20 Mar 2019 12:02:57 +0000 (13:02 +0100)]
rtc: 88pm80x: convert to SPDX identifier

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

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: ab-b5ze-s3: correct checkpatch issues
Alexandre Belloni [Wed, 20 Mar 2019 11:59:59 +0000 (12:59 +0100)]
rtc: ab-b5ze-s3: correct checkpatch issues

Correct trivial whitespace and split strings issues.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: core: correct trivial checkpatch warnings
Alexandre Belloni [Wed, 20 Mar 2019 11:59:09 +0000 (12:59 +0100)]
rtc: core: correct trivial checkpatch warnings

Correct trivial checkpatch warnings, mostly whitespace issues and
unbalanced braces.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: x1205: Add DT probing support
Linus Walleij [Tue, 19 Mar 2019 07:40:14 +0000 (08:40 +0100)]
rtc: x1205: Add DT probing support

This makes it possible to probe the X1205 RTC from the
device tree. This is needed when adding device tree boot
support for the IXP4xx-based NSLU2 which has this RTC.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: x1205: Add DT bindings
Linus Walleij [Tue, 19 Mar 2019 07:40:13 +0000 (08:40 +0100)]
rtc: x1205: Add DT bindings

This adds device tree bindings for the Xircom X1205 RTC found
in the Linksys NSLU2.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[alexandre.belloni@bootlin.com: move doc to rtc.txt]
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: da9063: convert header to SPDX
Wolfram Sang [Mon, 18 Mar 2019 15:57:27 +0000 (16:57 +0100)]
rtc: da9063: convert header to SPDX

Covnert the header of the source file to SPDX.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: omap: let the core handle range
Alexandre Belloni [Mon, 18 Mar 2019 12:44:38 +0000 (13:44 +0100)]
rtc: omap: let the core handle range

Let the core handle the RTC range instead of open coding it.

Tested-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: mv: add range
Alexandre Belloni [Fri, 15 Mar 2019 13:35:10 +0000 (14:35 +0100)]
rtc: mv: add range

This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with
a weird rollover to 2000-06-23 00:00:00.

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agortc: mv: convert to devm_rtc_allocate_device
Alexandre Belloni [Fri, 15 Mar 2019 13:35:09 +0000 (14:35 +0100)]
rtc: mv: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>