Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions Documentation/devicetree/bindings/rtc/rtc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Generic device tree bindings for Real Time Clock devices
========================================================

This document describes generic bindings which can be used to describe Real Time
Clock devices in a device tree.

Required properties
-------------------

- compatible : name of RTC device following generic names recommended practice.

For other required properties e.g. to describe register sets,
clocks, etc. check the binding documentation of the specific driver.

Optional properties
-------------------

- start-year : if provided, the default hardware range supported by the RTC is
shifted so the first usable year is the specified one.

The following properties may not be supported by all drivers. However, if a
driver wants to support one of the below features, it should adapt the bindings
below.
- trickle-resistor-ohms : Selected resistor for trickle charger. Should be given
if trickle charger should be enabled
- trickle-diode-disable : Do not use internal trickle charger diode Should be
given if internal trickle charger diode should be
disabled
- wakeup-source : Enables wake up of host system on alarm
- quartz-load-femtofarads : The capacitive load of the quartz(x-tal),
expressed in femto Farad (fF).
The default value shall be listed (if optional),
and likewise all valid values.

Trivial RTCs
------------

This is a list of trivial RTC devices that have simple device tree
bindings, consisting only of a compatible field, an address and
possibly an interrupt line.


Compatible Vendor / Chip
========== =============
abracon,abb5zes3 AB-RTCMC-32.768kHz-B5ZE-S3: Real Time Clock/Calendar Module with I2C Interface
dallas,ds1374 I2C, 32-Bit Binary Counter Watchdog RTC with Trickle Charger and Reset Input/Output
dallas,ds1672 Dallas DS1672 Real-time Clock
dallas,ds3232 Extremely Accurate I²C RTC with Integrated Crystal and SRAM
epson,rx8010 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
emmicro,em3027 EM Microelectronic EM3027 Real-time Clock
isil,isl1208 Intersil ISL1208 Low Power RTC with Battery Backed SRAM
isil,isl1218 Intersil ISL1218 Low Power RTC with Battery Backed SRAM
isil,isl12022 Intersil ISL12022 Real-time Clock
microcrystal,rv3028 Real Time Clock Module with I2C-Bus
microcrystal,rv3029 Real Time Clock Module with I2C-Bus
microcrystal,rv8523 Real Time Clock
nxp,pcf2127 Real-time clock
nxp,pcf2129 Real-time clock
nxp,pcf8563 Real-time clock/calendar
pericom,pt7c4338 Real-time Clock Module
ricoh,r2025sd I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,r2221tl I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,rs5c372a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,rs5c372b I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,rv5c386 I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,rv5c387a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
sii,s35390a 2-wire CMOS real-time clock
whwave,sd3078 I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
4 changes: 3 additions & 1 deletion arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,8 @@ Params: abx80x Select one of the ABx80x family:

pcf8563 Select the PCF8563 device

rv3028 Select the Micro Crystal RV3028 device

addr Sets the address for the RTC. Note that the
device must be configured to use the specified
address.
Expand All @@ -947,7 +949,7 @@ Params: abx80x Select one of the ABx80x family:
"schottky" (ABx80x only)

trickle-resistor-ohms Resistor value for trickle charge (DS1339,
ABx80x)
ABx80x, RV3028)

wakeup-source Specify that the RTC can be used as a wakeup
source
Expand Down
19 changes: 18 additions & 1 deletion arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@
};
};

fragment@10 {
target = <&i2c_arm>;
__dormant__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

rv3028: rv3028@52 {
compatible = "microcrystal,rv3028";
reg = <0x52>;
status = "okay";
};
};
};

__overrides__ {
abx80x = <0>,"+0";
ds1307 = <0>,"+1";
Expand All @@ -169,6 +184,7 @@
pcf8523 = <0>,"+7";
pcf8563 = <0>,"+8";
m41t62 = <0>,"+9";
rv3028 = <0>,"+10";

addr = <&abx80x>, "reg:0",
<&ds1307>, "reg:0",
Expand All @@ -182,7 +198,8 @@
<&m41t62>, "reg:0";
trickle-diode-type = <&abx80x>,"abracon,tc-diode";
trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
<&abx80x>,"abracon,tc-resistor";
<&abx80x>,"abracon,tc-resistor",
<&rv3028>,"trickle-resistor-ohms:0";
wakeup-source = <&ds1339>,"wakeup-source?",
<&ds3231>,"wakeup-source?",
<&mcp7940x>,"wakeup-source?",
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2709_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ CONFIG_RTC_DRV_FM3130=m
CONFIG_RTC_DRV_RX8581=m
CONFIG_RTC_DRV_RX8025=m
CONFIG_RTC_DRV_EM3027=m
CONFIG_RTC_DRV_RV3028=m
CONFIG_RTC_DRV_M41T93=m
CONFIG_RTC_DRV_M41T94=m
CONFIG_RTC_DRV_DS1302=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ CONFIG_RTC_DRV_FM3130=m
CONFIG_RTC_DRV_RX8581=m
CONFIG_RTC_DRV_RX8025=m
CONFIG_RTC_DRV_EM3027=m
CONFIG_RTC_DRV_RV3028=m
CONFIG_RTC_DRV_M41T93=m
CONFIG_RTC_DRV_M41T94=m
CONFIG_RTC_DRV_DS1302=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/bcmrpi3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ CONFIG_RTC_DRV_FM3130=m
CONFIG_RTC_DRV_RX8581=m
CONFIG_RTC_DRV_RX8025=m
CONFIG_RTC_DRV_EM3027=m
CONFIG_RTC_DRV_RV3028=m
CONFIG_RTC_DRV_M41T93=m
CONFIG_RTC_DRV_M41T94=m
CONFIG_RTC_DRV_DS1302=m
Expand Down
21 changes: 21 additions & 0 deletions drivers/nvmem/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct nvmem_device {
size_t size;
bool read_only;
int flags;
enum nvmem_type type;
struct bin_attribute eeprom;
struct device *base_dev;
nvmem_reg_read_t reg_read;
Expand Down Expand Up @@ -84,6 +85,21 @@ static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset,
return -EINVAL;
}

static ssize_t type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct nvmem_device *nvmem = to_nvmem_device(dev);

return sprintf(buf, "%s\n", nvmem_type_str[nvmem->type]);
}

static DEVICE_ATTR_RO(type);

static struct attribute *nvmem_attrs[] = {
&dev_attr_type.attr,
NULL,
};

static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t pos, size_t count)
Expand Down Expand Up @@ -169,6 +185,7 @@ static struct bin_attribute *nvmem_bin_rw_attributes[] = {

static const struct attribute_group nvmem_bin_rw_group = {
.bin_attrs = nvmem_bin_rw_attributes,
.attrs = nvmem_attrs,
};

static const struct attribute_group *nvmem_rw_dev_groups[] = {
Expand All @@ -192,6 +209,7 @@ static struct bin_attribute *nvmem_bin_ro_attributes[] = {

static const struct attribute_group nvmem_bin_ro_group = {
.bin_attrs = nvmem_bin_ro_attributes,
.attrs = nvmem_attrs,
};

static const struct attribute_group *nvmem_ro_dev_groups[] = {
Expand All @@ -216,6 +234,7 @@ static struct bin_attribute *nvmem_bin_rw_root_attributes[] = {

static const struct attribute_group nvmem_bin_rw_root_group = {
.bin_attrs = nvmem_bin_rw_root_attributes,
.attrs = nvmem_attrs,
};

static const struct attribute_group *nvmem_rw_root_dev_groups[] = {
Expand All @@ -239,6 +258,7 @@ static struct bin_attribute *nvmem_bin_ro_root_attributes[] = {

static const struct attribute_group nvmem_bin_ro_root_group = {
.bin_attrs = nvmem_bin_ro_root_attributes,
.attrs = nvmem_attrs,
};

static const struct attribute_group *nvmem_ro_root_dev_groups[] = {
Expand Down Expand Up @@ -478,6 +498,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->dev.bus = &nvmem_bus_type;
nvmem->dev.parent = config->dev;
nvmem->priv = config->priv;
nvmem->type = config->type;
nvmem->reg_read = config->reg_read;
nvmem->reg_write = config->reg_write;
nvmem->dev.of_node = config->dev->of_node;
Expand Down
9 changes: 9 additions & 0 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,15 @@ config RTC_DRV_EM3027
This driver can also be built as a module. If so, the module
will be called rtc-em3027.

config RTC_DRV_RV3028
tristate "Micro Crystal RV3028"
help
If you say yes here you get support for the Micro Crystal
RV3028.

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

config RTC_DRV_RV8803
tristate "Micro Crystal RV8803, Epson RX8900"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o
obj-$(CONFIG_RTC_DRV_RTD119X) += rtc-rtd119x.o
obj-$(CONFIG_RTC_DRV_RV3028) += rtc-rv3028.o
obj-$(CONFIG_RTC_DRV_RV3029C2) += rtc-rv3029c2.o
obj-$(CONFIG_RTC_DRV_RV8803) += rtc-rv8803.o
obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o
Expand Down
Loading