Skip to content

Commit

Permalink
Merge tag 'rtc-4.21' 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:
 "Subsystem:
   - new %ptR printk format
   - rename core files
   - allow registration of multiple nvmem devices

  New driver:
   - i.MX system controller RTC

  Driver updates:
   - abx80x: handle voltage ioctls, correct binding doc
   - m41t80: correct month in alarm reads
   - pcf85363: add pcf85263 support
   - pcf8523: properly handle battery low flag
   - s3c: limit alarm to one year in the future as ALMYEAR is broken
   - sun6i: rework clock output binding"

* tag 'rtc-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (54 commits)
  rtc: rename core files
  rtc: nvmem: fix possible use after free
  rtc: add i.MX system controller RTC support
  dt-bindings: fsl: scu: add rtc binding
  rtc: pcf2123: Add Microcrystal rv2123
  rtc: class: reimplement devm_rtc_device_register
  rtc: enforce rtc_timer_init private_data type
  rtc: abx80x: Implement RTC_VL_READ,CLR ioctls
  rtc: pcf85363: Add support for NXP pcf85263 rtc
  dt-bindings: rtc: pcf85363: Document pcf85263 real-time clock
  rtc: pcf8523: don't return invalid date when battery is low
  dt-bindings: rtc: use a generic node name for ds1307
  PM: Switch to use %ptR
  m68k/mac: Switch to use %ptR
  Input: hp_sdc_rtc - Switch to use %ptR
  rtc: tegra: Switch to use %ptR
  rtc: s5m: Switch to use %ptR
  rtc: s3c: Switch to use %ptR
  rtc: rx8025: Switch to use %ptR
  rtc: rx6110: Switch to use %ptR
  ...
  • Loading branch information
torvalds committed Jan 1, 2019
2 parents c9bef4a + 36e14f5 commit 28e8c4b
Show file tree
Hide file tree
Showing 52 changed files with 744 additions and 566 deletions.
18 changes: 18 additions & 0 deletions Documentation/core-api/printk-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,24 @@ Examples::

Passed by reference.

Time and date (struct rtc_time)
-------------------------------

::

%ptR YYYY-mm-ddTHH:MM:SS
%ptRd YYYY-mm-dd
%ptRt HH:MM:SS
%ptR[dt][r]

For printing date and time as represented by struct rtc_time structure in
human readable format.

By default year will be incremented by 1900 and month by 1. Use %ptRr (raw)
to suppress this behaviour.

Passed by reference.

struct clk
----------

Expand Down
10 changes: 10 additions & 0 deletions Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ Required properties for Pinctrl sub nodes:
[2] Documentation/devicetree/bindings/power/power_domain.txt
[3] Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt

RTC bindings based on SCU Message Protocol
------------------------------------------------------------

Required properties:
- compatible: should be "fsl,imx8qxp-sc-rtc";

Example (imx8qxp):
-------------
lsio_mu1: mailbox@5d1c0000 {
Expand Down Expand Up @@ -151,6 +157,10 @@ firmware {
compatible = "fsl,imx8qxp-scu-pd";
#power-domain-cells = <1>;
};

rtc: rtc {
compatible = "fsl,imx8qxp-sc-rtc";
};
};
};

Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ and valid to enable charging:

- "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
- "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
resistor, the other values are in ohm.
resistor, the other values are in kOhm.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/rtc/nxp,rtc-2123.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ NXP PCF2123 SPI Real Time Clock

Required properties:
- compatible: should be: "nxp,rtc-pcf2123"
or "microcrystal,rv2123"
- reg: should be the SPI slave chipselect address

Optional properties:
Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/rtc/pcf85363.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
NXP PCF85363 Real Time Clock
NXP PCF85263/PCF85363 Real Time Clock
============================

Required properties:
- compatible: Should contain "nxp,pcf85363".
- compatible: Should contain "nxp,pcf85263" or "nxp,pcf85363".
- reg: I2C address for chip.

Optional properties:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/rtc/rtc-ds1307.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Optional properties:
Should be given if internal trickle charger diode should be disabled

Example:
rtc1: ds1339@68 {
ds1339: rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
interrupt-parent = <&gpio4>;
Expand Down
33 changes: 26 additions & 7 deletions Documentation/devicetree/bindings/rtc/sun6i-rtc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@
RTC controller for the Allwinner A31

Required properties:
- compatible : Should be "allwinner,sun6i-a31-rtc"
- compatible : Should be one of the following combinations:
- "allwinner,sun6i-a31-rtc"
- "allwinner,sun8i-a23-rtc"
- "allwinner,sun8i-h3-rtc"
- "allwinner,sun8i-r40-rtc", "allwinner,sun8i-h3-rtc"
- "allwinner,sun8i-v3-rtc"
- "allwinner,sun50i-a64-rtc", "allwinner,sun8i-h3-rtc"
- "allwinner,sun50i-h5-rtc"

Where there are two or more compatible strings, this
denotes the hardware covered by the most specific one
is backward-compatible with the latter ones, and the
implementation for the latter ones can be used, albeit
with reduced functionality.

- reg : physical base address of the controller and length of
memory mapped region.
- interrupts : IRQ lines for the RTC alarm 0 and alarm 1, in that order.

Required properties for new device trees
- clocks : phandle to the 32kHz external oscillator
- clock-output-names : names of the LOSC and its external output clocks created
- #clock-cells : must be equals to 1. The RTC provides two clocks: the
LOSC and its external output, with index 0 and 1
respectively.
- clock-output-names : names of up to three clock outputs. See below.
- #clock-cells : must be equal to 1.

The RTC provides the following clocks at the given indices:
- 0: LOSC
- 1: LOSC external output, known as X32KFOUT in the datasheet.
This clock is not available on the A31 and is deprecated for old
device trees still using the "allwinner,sun6i-a31-rtc" compatible.
- 2: InternalOSC, or internal RC oscillator (A64/H3/H5 only)

Example:

rtc: rtc@1f00000 {
compatible = "allwinner,sun6i-a31-rtc";
reg = <0x01f00000 0x54>;
reg = <0x01f00000 0x400>;
interrupts = <0 40 4>, <0 41 4>;
clock-output-names = "osc32k", "osc32k-out";
clock-output-names = "osc32k";
clocks = <&ext_osc32k>;
#clock-cells = <1>;
};
8 changes: 2 additions & 6 deletions arch/m68k/mac/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,9 @@ int mac_hwclk(int op, struct rtc_time *t)
unmktime(now, 0,
&t->tm_year, &t->tm_mon, &t->tm_mday,
&t->tm_hour, &t->tm_min, &t->tm_sec);
pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n",
__func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
pr_debug("%s: read %ptR\n", __func__, t);
} else { /* write */
pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
__func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
pr_debug("%s: tried to write %ptR\n", __func__, t);

switch (macintosh_config->adb_type) {
case MAC_ADB_IOP:
Expand Down
4 changes: 1 addition & 3 deletions drivers/base/power/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ static unsigned int read_magic_time(void)
unsigned int val;

mc146818_get_time(&time);
pr_info("RTC time: %2d:%02d:%02d, date: %02d/%02d/%02d\n",
time.tm_hour, time.tm_min, time.tm_sec,
time.tm_mon + 1, time.tm_mday, time.tm_year % 100);
pr_info("RTC time: %ptRt, date: %ptRd\n", &time, &time);
val = time.tm_year; /* 100 years */
if (val > 100)
val -= 100;
Expand Down
7 changes: 3 additions & 4 deletions drivers/char/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,11 +1125,10 @@ static int rtc_proc_show(struct seq_file *seq, void *v)
* time or for Universal Standard Time (GMT). Probably local though.
*/
seq_printf(seq,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_time\t: %ptRt\n"
"rtc_date\t: %ptRd\n"
"rtc_epoch\t: %04lu\n",
tm.tm_hour, tm.tm_min, tm.tm_sec,
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
&tm, &tm, epoch);

get_rtc_alm_time(&tm);

Expand Down
8 changes: 3 additions & 5 deletions drivers/input/misc/hp_sdc_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,10 @@ static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v)
seq_puts(m, "BBRTC\t\t: READ FAILED!\n");
} else {
seq_printf(m,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_time\t: %ptRt\n"
"rtc_date\t: %ptRd\n"
"rtc_epoch\t: %04lu\n",
tm.tm_hour, tm.tm_min, tm.tm_sec,
tm.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday, epoch);
&tm, &tm, epoch);
}

if (hp_sdc_rtc_read_rt(&tv)) {
Expand Down
7 changes: 7 additions & 0 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,13 @@ config RTC_DRV_SNVS
This driver can also be built as a module, if so, the module
will be called "rtc-snvs".

config RTC_DRV_IMX_SC
depends on IMX_SCU
tristate "NXP i.MX System Controller RTC support"
help
If you say yes here you get support for the NXP i.MX System
Controller RTC module.

config RTC_DRV_SIRFSOC
tristate "SiRFSOC RTC"
depends on ARCH_SIRF
Expand Down
9 changes: 5 additions & 4 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

ccflags-$(CONFIG_RTC_DEBUG) := -DDEBUG

obj-$(CONFIG_RTC_LIB) += rtc-lib.o
obj-$(CONFIG_RTC_LIB) += lib.o
obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o
obj-$(CONFIG_RTC_SYSTOHC) += systohc.o
obj-$(CONFIG_RTC_CLASS) += rtc-core.o
Expand All @@ -17,9 +17,9 @@ rtc-core-y += rtc-efi-platform.o
endif

rtc-core-$(CONFIG_RTC_NVMEM) += nvmem.o
rtc-core-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o
rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o
rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o
rtc-core-$(CONFIG_RTC_INTF_DEV) += dev.o
rtc-core-$(CONFIG_RTC_INTF_PROC) += proc.o
rtc-core-$(CONFIG_RTC_INTF_SYSFS) += sysfs.o

# Keep the list ordered.

Expand Down Expand Up @@ -75,6 +75,7 @@ obj-$(CONFIG_RTC_DRV_GOLDFISH) += rtc-goldfish.o
obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
obj-$(CONFIG_RTC_DRV_HYM8563) += rtc-hym8563.o
obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o
obj-$(CONFIG_RTC_DRV_IMX_SC) += rtc-imx-sc.o
obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o
obj-$(CONFIG_RTC_DRV_ISL12026) += rtc-isl12026.o
obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
Expand Down
Loading

0 comments on commit 28e8c4b

Please sign in to comment.