Skip to content

Commit

Permalink
Merge tag 'rtc-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "Two new drivers this cycle and a significant rework of the CMOS driver
  make the bulk of the changes.

  I also carry powerpc changes with the agreement of Michael.

  New drivers:
   - Sunplus SP7021 RTC
   - Nintendo GameCube, Wii and Wii U RTC

  Driver updates:
   - cmos: refactor UIP handling and presence check, fix century
   - rs5c372: offset correction support, report low voltage
   - rv8803: Epson RX8804 support"

* tag 'rtc-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (33 commits)
  rtc: sunplus: fix return value in sp_rtc_probe()
  rtc: cmos: Evaluate century appropriate
  rtc: gamecube: Fix an IS_ERR() vs NULL check
  rtc: mc146818-lib: fix signedness bug in mc146818_get_time()
  dt-bindings: rtc: qcom-pm8xxx-rtc: update register numbers
  rtc: pxa: fix null pointer dereference
  rtc: ftrtc010: Use platform_get_irq() to get the interrupt
  rtc: Move variable into switch case statement
  rtc: pcf2127: Fix typo in comment
  dt-bindings: rtc: Add Sunplus RTC json-schema
  rtc: Add driver for RTC in Sunplus SP7021
  rtc: rs5c372: fix incorrect oscillation value on r2221tl
  rtc: rs5c372: add offset correction support
  rtc: cmos: avoid UIP when writing alarm time
  rtc: cmos: avoid UIP when reading alarm time
  rtc: mc146818-lib: refactor mc146818_does_rtc_work
  rtc: mc146818-lib: refactor mc146818_get_time
  rtc: mc146818-lib: extract mc146818_avoid_UIP
  rtc: mc146818-lib: fix RTC presence check
  rtc: Check return value from mc146818_get_time()
  ...
  • Loading branch information
torvalds committed Jan 21, 2022
2 parents c2c94b3 + 5ceee54 commit 75242f3
Show file tree
Hide file tree
Showing 25 changed files with 1,390 additions and 191 deletions.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/rtc/epson,rx8900.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ allOf:
properties:
compatible:
enum:
- epson,rx8804
- epson,rx8900
- microcrystal,rv8803

Expand Down
9 changes: 8 additions & 1 deletion Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ properties:
- qcom,pmk8350-rtc

reg:
maxItems: 1
minItems: 1
maxItems: 2

reg-names:
minItems: 1
items:
- const: rtc
- const: alarm

interrupts:
maxItems: 1
Expand Down
56 changes: 56 additions & 0 deletions Documentation/devicetree/bindings/rtc/sunplus,sp7021-rtc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
# Copyright (C) Sunplus Co., Ltd. 2021
%YAML 1.2
---
$id: http://devicetree.org/schemas/rtc/sunplus,sp7021-rtc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Sunplus SP7021 Real Time Clock controller

maintainers:
- Vincent Shih <vincent.sunplus@gmail.com>

properties:
compatible:
const: sunplus,sp7021-rtc

reg:
maxItems: 1

reg-names:
items:
- const: rtc

clocks:
maxItems: 1

resets:
maxItems: 1

interrupts:
maxItems: 1

required:
- compatible
- reg
- reg-names
- clocks
- resets
- interrupts

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
rtc: serial@9c003a00 {
compatible = "sunplus,sp7021-rtc";
reg = <0x9c003a00 0x80>;
reg-names = "rtc";
clocks = <&clkc 0x12>;
resets = <&rstc 0x02>;
interrupt-parent = <&intc>;
interrupts = <163 IRQ_TYPE_EDGE_RISING>;
};
...
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -18491,6 +18491,13 @@ L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/ethernet/dlink/sundance.c

SUNPLUS RTC DRIVER
M: Vincent Shih <vincent.sunplus@gmail.com>
L: linux-rtc@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/rtc/sunplus,sp7021-rtc.yaml
F: drivers/rtc/rtc-sunplus.c

SUPERH
M: Yoshinori Sato <ysato@users.sourceforge.jp>
M: Rich Felker <dalias@libc.org>
Expand Down
7 changes: 6 additions & 1 deletion arch/alpha/kernel/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ init_rtc_epoch(void)
static int
alpha_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
mc146818_get_time(tm);
int ret = mc146818_get_time(tm);

if (ret < 0) {
dev_err_ratelimited(dev, "unable to read current time\n");
return ret;
}

/* Adjust for non-default epochs. It's easier to depend on the
generic __get_rtc_time and adjust the epoch here than create
Expand Down
5 changes: 5 additions & 0 deletions arch/powerpc/boot/dts/wii.dts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
interrupts = <14>;
};

srnprot@d800060 {
compatible = "nintendo,hollywood-srnprot";
reg = <0x0d800060 0x4>;
};

GPIO: gpio@d8000c0 {
#gpio-cells = <2>;
compatible = "nintendo,hollywood-gpio";
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/configs/gamecube_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQUENCER_OSS=y
# CONFIG_USB_SUPPORT is not set
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_GENERIC=y
CONFIG_RTC_DRV_GAMECUBE=y
CONFIG_EXT2_FS=y
CONFIG_EXT4_FS=y
CONFIG_ISO9660_FS=y
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/configs/wii_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_GENERIC=y
CONFIG_RTC_DRV_GAMECUBE=y
CONFIG_NVMEM_NINTENDO_OTP=y
CONFIG_EXT2_FS=y
CONFIG_EXT4_FS=y
Expand Down
8 changes: 6 additions & 2 deletions arch/x86/kernel/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,12 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
hpet_rtc_timer_reinit();
memset(&curr_time, 0, sizeof(struct rtc_time));

if (hpet_rtc_flags & (RTC_UIE | RTC_AIE))
mc146818_get_time(&curr_time);
if (hpet_rtc_flags & (RTC_UIE | RTC_AIE)) {
if (unlikely(mc146818_get_time(&curr_time) < 0)) {
pr_err_ratelimited("unable to read current time from RTC\n");
return IRQ_HANDLED;
}
}

if (hpet_rtc_flags & RTC_UIE &&
curr_time.tm_sec != hpet_prev_update_sec) {
Expand Down
6 changes: 5 additions & 1 deletion drivers/base/power/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ static unsigned int read_magic_time(void)
struct rtc_time time;
unsigned int val;

mc146818_get_time(&time);
if (mc146818_get_time(&time) < 0) {
pr_err("Unable to read current time from RTC\n");
return 0;
}

pr_info("RTC time: %ptRt, date: %ptRd\n", &time, &time);
val = time.tm_year; /* 100 years */
if (val > 100)
Expand Down
24 changes: 24 additions & 0 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,17 @@ config RTC_DRV_V3020
This driver can also be built as a module. If so, the module
will be called rtc-v3020.

config RTC_DRV_GAMECUBE
tristate "Nintendo GameCube, Wii and Wii U RTC"
depends on GAMECUBE || WII || COMPILE_TEST
select REGMAP
help
If you say yes here you will get support for the RTC subsystem
of the Nintendo GameCube, Wii and Wii U.

This driver can also be built as a module. If so, the module
will be called "rtc-gamecube".

config RTC_DRV_WM831X
tristate "Wolfson Microelectronics WM831x RTC"
depends on MFD_WM831X
Expand Down Expand Up @@ -1444,6 +1455,19 @@ config RTC_DRV_SH
To compile this driver as a module, choose M here: the
module will be called rtc-sh.

config RTC_DRV_SUNPLUS
tristate "Sunplus SP7021 RTC"
depends on SOC_SP7021
help
Say 'yes' to get support for the real-time clock present in
Sunplus SP7021 - a SoC for industrial applications. It provides
RTC status check, timer/alarm functionalities, user data
reservation with the battery over 2.5V, RTC power status check
and battery charge.

This driver can also be built as a module. If so, the module
will be called rtc-sunplus.

config RTC_DRV_VR41XX
tristate "NEC VR41XX"
depends on CPU_VR41XX || COMPILE_TEST
Expand Down
2 changes: 2 additions & 0 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ obj-$(CONFIG_RTC_DRV_MT7622) += rtc-mt7622.o
obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o
obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o
obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o
obj-$(CONFIG_RTC_DRV_GAMECUBE) += rtc-gamecube.o
obj-$(CONFIG_RTC_DRV_NTXEC) += rtc-ntxec.o
obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o
Expand Down Expand Up @@ -165,6 +166,7 @@ obj-$(CONFIG_RTC_DRV_STM32) += rtc-stm32.o
obj-$(CONFIG_RTC_DRV_STMP) += rtc-stmp3xxx.o
obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o
obj-$(CONFIG_RTC_DRV_SUN6I) += rtc-sun6i.o
obj-$(CONFIG_RTC_DRV_SUNPLUS) += rtc-sunplus.o
obj-$(CONFIG_RTC_DRV_SUNXI) += rtc-sunxi.o
obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o
obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o
Expand Down
6 changes: 3 additions & 3 deletions drivers/rtc/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,14 @@ static long rtc_dev_ioctl(struct file *file,
}

switch(param.param) {
long offset;
case RTC_PARAM_FEATURES:
if (param.index != 0)
err = -EINVAL;
param.uvalue = rtc->features[0];
break;

case RTC_PARAM_CORRECTION:
case RTC_PARAM_CORRECTION: {
long offset;
mutex_unlock(&rtc->ops_lock);
if (param.index != 0)
return -EINVAL;
Expand All @@ -407,7 +407,7 @@ static long rtc_dev_ioctl(struct file *file,
if (err == 0)
param.svalue = offset;
break;

}
default:
if (rtc->ops->param_get)
err = rtc->ops->param_get(rtc->dev.parent, &param);
Expand Down
Loading

0 comments on commit 75242f3

Please sign in to comment.