Skip to content

Commit 5f2eac7

Browse files
committed
Merge tag 'rtc-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: - loongson: Loongson-2K0300 support - s35390a: nvmem support - zynqmp: rework calibration * tag 'rtc-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: rtc: ds1390: fix number of bytes read from RTC rtc: class: Remove duplicate check for alarm rtc: optee: simplify OP-TEE context match rtc: interface: Alarm race handling should not discard preceding error rtc: s35390a: implement nvmem support rtc: loongson: Add Loongson-2K0300 support dt-bindings: rtc: loongson: Document Loongson-2K0300 compatible dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property dt-bindings: rtc: renesas,rz-rtca3: Add RZ/V2N support dt-bindings: rtc: cpcap: convert to schema rtc: zynqmp: use dynamic max and min offset ranges rtc: zynqmp: rework set_offset rtc: zynqmp: rework read_offset rtc: zynqmp: check calibration max value rtc: zynqmp: correct frequency value rtc: amlogic-a4: Remove IRQF_ONESHOT rtc: pcf8563: use correct of_node for output clock rtc: max31335: use correct CONFIG symbol in IS_REACHABLE() rtc: nvvrs: Add ARCH_TEGRA to the NV VRS RTC driver
2 parents 1dd4191 + 969c3cc commit 5f2eac7

14 files changed

Lines changed: 178 additions & 88 deletions

File tree

Documentation/devicetree/bindings/rtc/cpcap-rtc.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Documentation/devicetree/bindings/rtc/loongson,rtc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ properties:
2323
- loongson,ls1b-rtc
2424
- loongson,ls1c-rtc
2525
- loongson,ls7a-rtc
26+
- loongson,ls2k0300-rtc
2627
- loongson,ls2k1000-rtc
2728
- items:
2829
- enum:
@@ -42,6 +43,18 @@ required:
4243

4344
unevaluatedProperties: false
4445

46+
if:
47+
properties:
48+
compatible:
49+
contains:
50+
enum:
51+
- loongson,ls1c-rtc
52+
- loongson,ls2k0300-rtc
53+
54+
then:
55+
properties:
56+
interrupts: false
57+
4558
examples:
4659
- |
4760
#include <dt-bindings/interrupt-controller/irq.h>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/rtc/motorola,cpcap-rtc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Motorola CPCAP PMIC RTC
8+
9+
maintainers:
10+
- Svyatoslav Ryhel <clamor95@gmail.com>
11+
12+
description:
13+
This module is part of the Motorola CPCAP MFD device. For more details
14+
see Documentation/devicetree/bindings/mfd/motorola,cpcap.yaml. The
15+
RTC is represented as a sub-node of the PMIC node on the device tree.
16+
17+
properties:
18+
compatible:
19+
const: motorola,cpcap-rtc
20+
21+
interrupts:
22+
items:
23+
- description: alarm interrupt
24+
- description: 1 Hz interrupt
25+
26+
required:
27+
- compatible
28+
- interrupts
29+
30+
additionalProperties: false
31+
32+
...

Documentation/devicetree/bindings/rtc/renesas,rz-rtca3.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ properties:
1414
items:
1515
- enum:
1616
- renesas,r9a08g045-rtca3 # RZ/G3S
17+
- renesas,r9a09g056-rtca3 # RZ/V2N
1718
- renesas,r9a09g057-rtca3 # RZ/V2H
1819
- const: renesas,rz-rtca3
1920

@@ -82,7 +83,9 @@ allOf:
8283
properties:
8384
compatible:
8485
contains:
85-
const: renesas,r9a09g057-rtca3
86+
enum:
87+
- renesas,r9a09g056-rtca3
88+
- renesas,r9a09g057-rtca3
8689
then:
8790
properties:
8891
resets:

drivers/rtc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ config RTC_DRV_SPACEMIT_P1
418418

419419
config RTC_DRV_NVIDIA_VRS10
420420
tristate "NVIDIA VRS10 RTC device"
421+
depends on ARCH_TEGRA || COMPILE_TEST
421422
help
422423
If you say yes here you will get support for the battery backed RTC device
423424
of NVIDIA VRS (Voltage Regulator Specification). The RTC is connected via

drivers/rtc/class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc)
410410

411411
/* Check to see if there is an ALARM already set in hw */
412412
err = __rtc_read_alarm(rtc, &alrm);
413-
if (!err && !rtc_valid_tm(&alrm.time))
413+
if (!err)
414414
rtc_initialize_alarm(rtc, &alrm);
415415

416416
rtc_dev_prepare(rtc);

drivers/rtc/interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
457457
* are in, we can return -ETIME to signal that the timer has already
458458
* expired, which is true in both cases.
459459
*/
460-
if ((scheduled - now) <= 1) {
460+
if (!err && (scheduled - now) <= 1) {
461461
err = __rtc_read_time(rtc, &tm);
462462
if (err)
463463
return err;

drivers/rtc/rtc-ds1390.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int ds1390_read_time(struct device *dev, struct rtc_time *dt)
134134
chip->txrx_buf[0] = DS1390_REG_SECONDS;
135135

136136
/* do the i/o */
137-
status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 8);
137+
status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 7);
138138
if (status != 0)
139139
return status;
140140

drivers/rtc/rtc-loongson.c

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
* According to the LS1C manual, RTC_CTRL and alarm-related registers are not defined.
6767
* Accessing the relevant registers will cause the system to hang.
6868
*/
69-
#define LS1C_RTC_CTRL_WORKAROUND BIT(0)
69+
#define LOONGSON_RTC_CTRL_WORKAROUND BIT(0)
70+
#define LOONGSON_RTC_ALARM_WORKAROUND BIT(1)
7071

7172
struct loongson_rtc_config {
7273
u32 pm_offset; /* Offset of PM domain, for RTC alarm wakeup */
@@ -89,14 +90,19 @@ static const struct loongson_rtc_config ls1b_rtc_config = {
8990

9091
static const struct loongson_rtc_config ls1c_rtc_config = {
9192
.pm_offset = 0,
92-
.flags = LS1C_RTC_CTRL_WORKAROUND,
93+
.flags = LOONGSON_RTC_CTRL_WORKAROUND | LOONGSON_RTC_ALARM_WORKAROUND,
9394
};
9495

9596
static const struct loongson_rtc_config generic_rtc_config = {
9697
.pm_offset = 0x100,
9798
.flags = 0,
9899
};
99100

101+
static const struct loongson_rtc_config ls2k0300_rtc_config = {
102+
.pm_offset = 0x0,
103+
.flags = LOONGSON_RTC_ALARM_WORKAROUND,
104+
};
105+
100106
static const struct loongson_rtc_config ls2k1000_rtc_config = {
101107
.pm_offset = 0x800,
102108
.flags = 0,
@@ -153,7 +159,7 @@ static int loongson_rtc_set_enabled(struct device *dev)
153159
{
154160
struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
155161

156-
if (priv->config->flags & LS1C_RTC_CTRL_WORKAROUND)
162+
if (priv->config->flags & LOONGSON_RTC_CTRL_WORKAROUND)
157163
return 0;
158164

159165
/* Enable RTC TOY counters and crystal */
@@ -167,7 +173,7 @@ static bool loongson_rtc_get_enabled(struct device *dev)
167173
u32 ctrl_data;
168174
struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
169175

170-
if (priv->config->flags & LS1C_RTC_CTRL_WORKAROUND)
176+
if (priv->config->flags & LOONGSON_RTC_CTRL_WORKAROUND)
171177
return true;
172178

173179
ret = regmap_read(priv->regmap, RTC_CTRL_REG, &ctrl_data);
@@ -299,9 +305,41 @@ static const struct rtc_class_ops loongson_rtc_ops = {
299305
.alarm_irq_enable = loongson_rtc_alarm_irq_enable,
300306
};
301307

308+
static int loongson_rtc_alarm_setting(struct platform_device *pdev, void __iomem *regs)
309+
{
310+
int ret = 0, alarm_irq;
311+
struct device *dev = &pdev->dev;
312+
struct loongson_rtc_priv *priv = dev_get_drvdata(dev);
313+
314+
if (priv->config->flags & LOONGSON_RTC_ALARM_WORKAROUND) {
315+
/* Loongson-1C/Loongson-2K0300 RTC does not support alarm */
316+
clear_bit(RTC_FEATURE_ALARM, priv->rtcdev->features);
317+
return 0;
318+
}
319+
320+
/* Get RTC alarm irq */
321+
alarm_irq = platform_get_irq(pdev, 0);
322+
if (alarm_irq < 0)
323+
return alarm_irq;
324+
325+
ret = devm_request_irq(dev, alarm_irq, loongson_rtc_isr, 0, "loongson-alarm",
326+
priv);
327+
if (ret < 0)
328+
return ret;
329+
330+
priv->pm_base = regs - priv->config->pm_offset;
331+
device_init_wakeup(dev, true);
332+
333+
if (has_acpi_companion(dev))
334+
acpi_install_fixed_event_handler(ACPI_EVENT_RTC,
335+
loongson_rtc_handler, priv);
336+
337+
return ret;
338+
}
339+
302340
static int loongson_rtc_probe(struct platform_device *pdev)
303341
{
304-
int ret, alarm_irq;
342+
int ret;
305343
void __iomem *regs;
306344
struct loongson_rtc_priv *priv;
307345
struct device *dev = &pdev->dev;
@@ -330,25 +368,9 @@ static int loongson_rtc_probe(struct platform_device *pdev)
330368
return dev_err_probe(dev, PTR_ERR(priv->rtcdev),
331369
"devm_rtc_allocate_device failed\n");
332370

333-
/* Get RTC alarm irq */
334-
alarm_irq = platform_get_irq(pdev, 0);
335-
if (alarm_irq > 0) {
336-
ret = devm_request_irq(dev, alarm_irq, loongson_rtc_isr,
337-
0, "loongson-alarm", priv);
338-
if (ret < 0)
339-
return dev_err_probe(dev, ret, "Unable to request irq %d\n",
340-
alarm_irq);
341-
342-
priv->pm_base = regs - priv->config->pm_offset;
343-
device_init_wakeup(dev, true);
344-
345-
if (has_acpi_companion(dev))
346-
acpi_install_fixed_event_handler(ACPI_EVENT_RTC,
347-
loongson_rtc_handler, priv);
348-
} else {
349-
/* Loongson-1C RTC does not support alarm */
350-
clear_bit(RTC_FEATURE_ALARM, priv->rtcdev->features);
351-
}
371+
ret = loongson_rtc_alarm_setting(pdev, regs);
372+
if (ret)
373+
return ret;
352374

353375
/* Loongson RTC does not support UIE */
354376
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, priv->rtcdev->features);
@@ -379,6 +401,7 @@ static const struct of_device_id loongson_rtc_of_match[] = {
379401
{ .compatible = "loongson,ls1b-rtc", .data = &ls1b_rtc_config },
380402
{ .compatible = "loongson,ls1c-rtc", .data = &ls1c_rtc_config },
381403
{ .compatible = "loongson,ls7a-rtc", .data = &generic_rtc_config },
404+
{ .compatible = "loongson,ls2k0300-rtc", .data = &ls2k0300_rtc_config },
382405
{ .compatible = "loongson,ls2k1000-rtc", .data = &ls2k1000_rtc_config },
383406
{ /* sentinel */ }
384407
};

drivers/rtc/rtc-max31335.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static struct nvmem_config max31335_nvmem_cfg = {
591591
.size = MAX31335_RAM_SIZE,
592592
};
593593

594-
#if IS_REACHABLE(HWMON)
594+
#if IS_REACHABLE(CONFIG_HWMON)
595595
static int max31335_read_temp(struct device *dev, enum hwmon_sensor_types type,
596596
u32 attr, int channel, long *val)
597597
{
@@ -672,7 +672,7 @@ static int max31335_clkout_register(struct device *dev)
672672
static int max31335_probe(struct i2c_client *client)
673673
{
674674
struct max31335_data *max31335;
675-
#if IS_REACHABLE(HWMON)
675+
#if IS_REACHABLE(CONFIG_HWMON)
676676
struct device *hwmon;
677677
#endif
678678
const struct chip_desc *match;
@@ -727,7 +727,7 @@ static int max31335_probe(struct i2c_client *client)
727727
return dev_err_probe(&client->dev, ret,
728728
"cannot register rtc nvmem\n");
729729

730-
#if IS_REACHABLE(HWMON)
730+
#if IS_REACHABLE(CONFIG_HWMON)
731731
if (max31335->chip->temp_reg) {
732732
hwmon = devm_hwmon_device_register_with_info(&client->dev, client->name, max31335,
733733
&max31335_chip_info, NULL);

0 commit comments

Comments
 (0)