Commit graph

900414 commits

Author SHA1 Message Date
Alexandre Belloni
ccf1441db9 rtc: 88pm860x: remove platform data support
There is no users of the rtc platform data left, remove its support.

Link: https://lore.kernel.org/r/20200316102537.180398-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:56 +01:00
Alexandre Belloni
b2a2aa63f9 rtc: 88pm860x: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200311223956.51352-6-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:56 +01:00
Alexandre Belloni
3b45cc522e rtc: 88pm860x: stop mangling alarm time
The RTC core always passes a valid alarm time there is no need to modify
it.

Link: https://lore.kernel.org/r/20200311223956.51352-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:56 +01:00
Alexandre Belloni
a3e4937112 rtc: 88pm860x: set range
The 88pm860x RTC is a 32bit read only seconds counter with a 32bit offset.

Link: https://lore.kernel.org/r/20200311223956.51352-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:56 +01:00
Alexandre Belloni
1c9fe6d6d2 rtc: 88pm860x: stop calling unused callback
pdata->sync is not defined by any platform, stop calling it.

Link: https://lore.kernel.org/r/20200311223956.51352-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:55 +01:00
Alexandre Belloni
b773f2a97f rtc: 88pm860x: stop setting a default time
It doesn't make sense to set the RTC to a default value at probe time. Let
the core handle invalid date and time.

Link: https://lore.kernel.org/r/20200311223956.51352-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:55 +01:00
Alexandre Belloni
9cf4789e6e rtc: 88pm860x: fix possible race condition
The RTC IRQ is requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in the IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Also remove the unnecessary error message as the core already prints the
info.

Link: https://lore.kernel.org/r/20200311223956.51352-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:55 +01:00
Anson Huang
7863bd076b rtc: snvs: Use devm_add_action_or_reset() for calls to clk_disable_unprepare()
Use devm_add_action_or_reset() for calls to clk_disable_unprepare(),
which can simplify the error handling.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/1584109849-21402-1-git-send-email-Anson.Huang@nxp.com
Link: https://lore.kernel.org/r/1584233264-26025-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:55 +01:00
Ran Bi
21cbe81094 MAINTAINERS: add MT2712 RTC files
This patch add MT2712 RTC related files to MAINTAINERS file.

Signed-off-by: Ran Bi <ran.bi@mediatek.com>
Link: https://lore.kernel.org/r/20200226051303.22560-5-ran.bi@mediatek.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:55 +01:00
Ran Bi
64823360a8 rtc: add support for the MediaTek MT2712 RTC
This add support for the MediaTek MT2712 RTC. It was SoC based RTC, but
had different architecture compared with MT7622 RTC.

Signed-off-by: Ran Bi <ran.bi@mediatek.com>
Link: https://lore.kernel.org/r/20200226051303.22560-3-ran.bi@mediatek.com
Link: https://lore.kernel.org/r/20200316104701.209293-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:55:40 +01:00
Ran Bi
bfb8c3b464 dt-bindings: rtc: add bindings for MT2712 RTC
Document the binding for MT2712 RTC implemented by rtc-mt2712.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Ran Bi <ran.bi@mediatek.com>
Link: https://lore.kernel.org/r/20200226051303.22560-2-ran.bi@mediatek.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:13:47 +01:00
Thomas Bogendoerfer
eac1c3fc55 rtc: m48t35: remove SGI-IP27 kludge
With the IOC3 MFD driver it's no longer necessary to special case SGI-IP27.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Link: https://lore.kernel.org/r/20200309123514.15543-1-tsbogend@alpha.franken.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Jernej Skrabec
ec98a87509 rtc: sun6i: Make external 32k oscillator optional
Some boards, like OrangePi PC2 (H5), OrangePi Plus 2E (H3) and Tanix TX6
(H6) don't have external 32kHz oscillator. Till H6, it didn't really
matter if external oscillator was enabled because HW detected error and
fall back to internal one. H6 has same functionality but it's the first
SoC which have "auto switch bypass" bit documented and always enabled in
driver. This prevents RTC to work correctly if external crystal is not
present on board. There are other side effects - all peripherals which
depends on this clock also don't work (HDMI CEC for example).

Make clocks property optional. If it is present, select external
oscillator. If not, stay on internal.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20200308135849.106333-2-jernej.skrabec@siol.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
0155b54774 rtc: puv3: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306010240.40056-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
a04b3b965f rtc: puv3: set range
This RTC is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306010240.40056-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
a5965a3101 rtc: ab8500: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200306010101.39517-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
c8ff5841a9 rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion to allow extending
support after 2106 and properly supporting the STv2 range.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200306005809.38530-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
03f2a0e45f rtc: pl031: set range
The PL031 and ST v1 RTC are 32bit seconds counters. STv2 is a BCD RTC
apparently going from 0000 to 9999, hopefully handling the leap days
properly until then.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200306005809.38530-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
61c9fbff9d rtc: pl031: remove useless invalid alarm handling
The core will never pass an invalid alarm to .set_alarm, it is not
necessary to check for its validity.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200306005809.38530-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:11 +01:00
Alexandre Belloni
7098f53682 rtc: fsl-ftm-alarm: allow COMPILE_TEST
Allow building building the driver with COMPILE_TEST.

Link: https://lore.kernel.org/r/20200306131629.18837-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
3d5a49545a rtc: mpc5121: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306074404.58909-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
3905d1c02d rtc: mpc5121: set range
The datasheet states that 4052 is the maximum value for year. However, the
mpc5121 read_time and set_time function abuse the target time register
instead of using the broken down time so it is limited to 2106.

Link: https://lore.kernel.org/r/20200306074404.58909-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
fffbe10e2f rtc: mpc5121: convert to devm_rtc_allocate_device
This simplifies the path for the rtc_ops selection.

Link: https://lore.kernel.org/r/20200306074404.58909-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
d53d4ae981 rtc: mpc5121: simplify probe
Use devm managed function to simplify probe and remove.

Link: https://lore.kernel.org/r/20200306074404.58909-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
c47cf9d6bb rtc: pm8xxx: stop validating valid alarm time
rtc_time64_to_tm never generates an invalid rtc_tm, stop validating it.

Link: https://lore.kernel.org/r/20200306073758.58050-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
4c470b2f12 rtc: pm8xxx: : switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306073758.58050-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
3cfe526077 rtc: pm8xxx: set range
The pm8xxx are 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306073758.58050-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
d5d55b7098 rtc: pm8xxx: convert to devm_rtc_allocate_device
This allows further improvement of the driver. Also remove the unnecessary
error string as the core will already display error messages.

Link: https://lore.kernel.org/r/20200306073758.58050-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
f2adcb9c3a rtc: ds1305: switch to rtc_tm_to_time64
Call the 64bit version of rtc_tm to time conversion.

Link: https://lore.kernel.org/r/20200306073459.57197-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
9869a93c82 rtc: ds1305: set range
The ds1305 is a BCD rtc valid from 2000 to 2099.

Link: https://lore.kernel.org/r/20200306073459.57197-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
ca824be9b3 rtc: ds1374: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306073404.56921-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
4136ff3a51 rtc: ds1374: set range
The ds1374 is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306073404.56921-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
c11af8131a rtc: ds1374: fix possible race condition
The RTC IRQ is requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in the IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Link: https://lore.kernel.org/r/20200306073404.56921-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
d238df15e5 rtc: cpcap: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306015703.42101-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
d2377f8cc5 rtc: cpcap: set range
The CPCAP rtc is a 14bit day counter plus a 17bit seconds counter.

Note that this failed on Nov 10 2014 so it is very likely this driver as
never been used since.

Link: https://lore.kernel.org/r/20200306015703.42101-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
05b38d182c rtc: cpcap: convert to devm_rtc_allocate_device
This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20200306015703.42101-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:10 +01:00
Alexandre Belloni
eb8d942032 rtc: sa1100: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306010146.39762-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
e877ab7302 rtc: sa1100: set range
The SA1100 RTC is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306010146.39762-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
f2997775b1 rtc: sa1100: fix possible race condition
Both RTC IRQs are requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in the IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the IRQs using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Link: https://lore.kernel.org/r/20200306010146.39762-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
0a22bd6fe4 rtc: au1xxx: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306005958.39203-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
b1b686e4b0 rtc: au1xxx: set range
The Alchemy counter0 is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306005958.39203-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
9cf71edb02 rtc: au1xxx: remove goto label
Simplify the driver by removing the goto label as it only does return ret.

Link: https://lore.kernel.org/r/20200306005958.39203-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
7fc9790aa3 rtc: au1xxx: convert to devm_rtc_allocate_device
This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20200306005958.39203-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
326bce078a rtc: starfire: switch to rtc_time64_to_tm
Call the 64bit version of rtc_tm time conversion.

Link: https://lore.kernel.org/r/20200306005910.38939-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
166b13325c rtc: starfire: set range
The starfire RTC is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306005910.38939-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
c33c4713cd rtc: pl030: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion to avoid the y2106 issue.

Link: https://lore.kernel.org/r/20200306005730.38268-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
b303b2fe5d rtc: pl030: remove useless invalid alarm handling
The core will never pass an invalid alarm to .set_alarm, it is not
necessary to check for its validity.

Link: https://lore.kernel.org/r/20200306005730.38268-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
9896169a12 rtc: pl030: set range
This RTC is a 32bit seconds counter.

Link: https://lore.kernel.org/r/20200306005730.38268-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
6a5bbad586 rtc: davinci: remove useless error handling
convertfromdays and convert2days never return errors, stop handling non
existent errors.

Link: https://lore.kernel.org/r/20200305215022.32533-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00
Alexandre Belloni
b6d8f58920 rtc: davinci: let the core handle rtc range
Let the core handle offsetting and windowing the RTC range.

This rtc has hours, minutes, seconds and 16bit days. As the driver has the
RTC epoch set to year 2000, this means that the end of the range is 2^16
days minus one second later. This is Sun Jun  6 23:59:59 UTC 2179. This
is better than the currently set year 2099.

Link: https://lore.kernel.org/r/20200305215022.32533-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-16 11:12:09 +01:00