Skip to content

Commit

Permalink
Merge tag 'rtc-4.10' 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:
   - non-modular drivers are now explicitly non-modular

  New driver:
    - Epson Toyocom rtc-7301sf/dg

  Drivers:
   - cmos: reject unsupported alarm values wrt the RTC capabilities
   - ds1307: ACPI support
   - jz4740: DT support, jz4780 handling, can now be used as a system
     power controller
   - mcp795: many fixes, in particular proper month handling
   - twl: driver is now DT only"

* tag 'rtc-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (31 commits)
  rtc: mcp795: Fix whitespace and indentation.
  rtc: mcp795: Prefer using the BIT() macro.
  rtc: mcp795: fix month write resetting date to 1.
  rtc: mcp795: fix time range difference between linux and RTC chip.
  rtc: mcp795: fix bitmask value for leap year (LP).
  rtc: mcp795: use bcd2bin/bin2bcd.
  rtc: add support for EPSON TOYOCOM RTC-7301SF/DG
  rtc: ds1307: Add ACPI support
  rtc: imxdi: (trivial) fix a typo
  rtc: ds1374: Merge conditional + WARN_ON()
  rtc: twl: make driver DT only
  rtc: twl: kill static variables
  rtc: fix typos in Kconfig
  rtc: jz4740: make the driver builtin only
  rtc: jz4740: remove unused EXPORT_SYMBOL
  Documentation: bindings: fix twl-rtc documentation
  rtc: Enable compile testing for Maxim and Samsung drivers
  MIPS: jz4740: Remove obsolete code
  MIPS: qi_lb60: Probe RTC driver from DT and use it as power controller
  MIPS: jz4740: DTS: Probe the jz4740-rtc driver from devicetree
  ...
  • Loading branch information
Linus Torvalds committed Dec 19, 2016
2 parents 3be134e + d3e5925 commit b0b3a37
Show file tree
Hide file tree
Showing 24 changed files with 1,055 additions and 257 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
What: Attribute for calibrating ST-Ericsson AB8500 Real Time Clock
What: /sys/class/rtc/rtc0/device/rtc_calibration
Date: Oct 2011
KernelVersion: 3.0
Contact: Mark Godfrey <mark.godfrey@stericsson.com>
Description: The rtc_calibration attribute allows the userspace to
Description: Attribute for calibrating ST-Ericsson AB8500 Real Time Clock
The rtc_calibration attribute allows the userspace to
calibrate the AB8500.s 32KHz Real Time Clock.
Every 60 seconds the AB8500 will correct the RTC's value
by adding to it the value of this attribute.
Expand Down
16 changes: 16 additions & 0 deletions Documentation/devicetree/bindings/rtc/epson,rtc7301.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
EPSON TOYOCOM RTC-7301SF/DG

Required properties:

- compatible: Should be "epson,rtc7301sf" or "epson,rtc7301dg"
- reg: Specifies base physical address and size of the registers.
- interrupts: A single interrupt specifier.

Example:

rtc: rtc@44a00000 {
compatible = "epson,rtc7301dg";
reg = <0x44a00000 0x10000>;
interrupt-parent = <&axi_intc_0>;
interrupts = <3 2>;
};
37 changes: 37 additions & 0 deletions Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
JZ4740 and similar SoCs real-time clock driver

Required properties:

- compatible: One of:
- "ingenic,jz4740-rtc" - for use with the JZ4740 SoC
- "ingenic,jz4780-rtc" - for use with the JZ4780 SoC
- reg: Address range of rtc register set
- interrupts: IRQ number for the alarm interrupt
- clocks: phandle to the "rtc" clock
- clock-names: must be "rtc"

Optional properties:
- system-power-controller: To use this component as the
system power controller
- reset-pin-assert-time-ms: Reset pin low-level assertion
time after wakeup (default 60ms; range 0-125ms if RTC clock
at 32 kHz)
- min-wakeup-pin-assert-time-ms: Minimum wakeup pin assertion
time (default 100ms; range 0-2s if RTC clock at 32 kHz)

Example:

rtc@10003000 {
compatible = "ingenic,jz4740-rtc";
reg = <0x10003000 0x40>;

interrupt-parent = <&intc>;
interrupts = <32>;

clocks = <&rtc_clock>;
clock-names = "rtc";

system-power-controller;
reset-pin-assert-time-ms = <60>;
min-wakeup-pin-assert-time-ms = <100>;
};
19 changes: 9 additions & 10 deletions Documentation/devicetree/bindings/rtc/twl-rtc.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
* TI twl RTC

The TWL family (twl4030/6030) contains a RTC.
* Texas Instruments TWL4030/6030 RTC

Required properties:
- compatible : Should be twl4030-rtc

Examples:

rtc@0 {
compatible = "ti,twl4030-rtc";
};
- compatible : Should be "ti,twl4030-rtc"
- interrupts : Should be the interrupt number.

Example:
rtc {
compatible = "ti,twl4030-rtc";
interrupts = <11>;
};
11 changes: 11 additions & 0 deletions arch/mips/boot/dts/ingenic/jz4740.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
#clock-cells = <1>;
};

rtc_dev: rtc@10003000 {
compatible = "ingenic,jz4740-rtc";
reg = <0x10003000 0x40>;

interrupt-parent = <&intc>;
interrupts = <15>;

clocks = <&cgu JZ4740_CLK_RTC>;
clock-names = "rtc";
};

uart0: serial@10030000 {
compatible = "ingenic,jz4740-uart";
reg = <0x10030000 0x100>;
Expand Down
4 changes: 4 additions & 0 deletions arch/mips/boot/dts/ingenic/qi_lb60.dts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
&ext {
clock-frequency = <12000000>;
};

&rtc_dev {
system-power-controller;
};
1 change: 0 additions & 1 deletion arch/mips/include/asm/mach-jz4740/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
extern struct platform_device jz4740_udc_device;
extern struct platform_device jz4740_udc_xceiv_device;
extern struct platform_device jz4740_mmc_device;
extern struct platform_device jz4740_rtc_device;
extern struct platform_device jz4740_i2c_device;
extern struct platform_device jz4740_nand_device;
extern struct platform_device jz4740_framebuffer_device;
Expand Down
1 change: 0 additions & 1 deletion arch/mips/jz4740/board-qi_lb60.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ static struct platform_device *jz_platform_devices[] __initdata = {
&jz4740_pcm_device,
&jz4740_i2s_device,
&jz4740_codec_device,
&jz4740_rtc_device,
&jz4740_adc_device,
&jz4740_pwm_device,
&jz4740_dma_device,
Expand Down
21 changes: 0 additions & 21 deletions arch/mips/jz4740/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,6 @@ struct platform_device jz4740_mmc_device = {
.resource = jz4740_mmc_resources,
};

/* RTC controller */
static struct resource jz4740_rtc_resources[] = {
{
.start = JZ4740_RTC_BASE_ADDR,
.end = JZ4740_RTC_BASE_ADDR + 0x38 - 1,
.flags = IORESOURCE_MEM,
},
{
.start = JZ4740_IRQ_RTC,
.end = JZ4740_IRQ_RTC,
.flags = IORESOURCE_IRQ,
},
};

struct platform_device jz4740_rtc_device = {
.name = "jz4740-rtc",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_rtc_resources),
.resource = jz4740_rtc_resources,
};

/* I2C controller */
static struct resource jz4740_i2c_resources[] = {
{
Expand Down
63 changes: 0 additions & 63 deletions arch/mips/jz4740/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,71 +57,8 @@ static void jz4740_restart(char *command)
jz4740_halt();
}

#define JZ_REG_RTC_CTRL 0x00
#define JZ_REG_RTC_HIBERNATE 0x20
#define JZ_REG_RTC_WAKEUP_FILTER 0x24
#define JZ_REG_RTC_RESET_COUNTER 0x28

#define JZ_RTC_CTRL_WRDY BIT(7)
#define JZ_RTC_WAKEUP_FILTER_MASK 0x0000FFE0
#define JZ_RTC_RESET_COUNTER_MASK 0x00000FE0

static inline void jz4740_rtc_wait_ready(void __iomem *rtc_base)
{
uint32_t ctrl;

do {
ctrl = readl(rtc_base + JZ_REG_RTC_CTRL);
} while (!(ctrl & JZ_RTC_CTRL_WRDY));
}

static void jz4740_power_off(void)
{
void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38);
unsigned long wakeup_filter_ticks;
unsigned long reset_counter_ticks;
struct clk *rtc_clk;
unsigned long rtc_rate;

rtc_clk = clk_get(NULL, "rtc");
if (IS_ERR(rtc_clk))
panic("unable to get RTC clock");
rtc_rate = clk_get_rate(rtc_clk);
clk_put(rtc_clk);

/*
* Set minimum wakeup pin assertion time: 100 ms.
* Range is 0 to 2 sec if RTC is clocked at 32 kHz.
*/
wakeup_filter_ticks = (100 * rtc_rate) / 1000;
if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK)
wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK;
else
wakeup_filter_ticks = JZ_RTC_WAKEUP_FILTER_MASK;
jz4740_rtc_wait_ready(rtc_base);
writel(wakeup_filter_ticks, rtc_base + JZ_REG_RTC_WAKEUP_FILTER);

/*
* Set reset pin low-level assertion time after wakeup: 60 ms.
* Range is 0 to 125 ms if RTC is clocked at 32 kHz.
*/
reset_counter_ticks = (60 * rtc_rate) / 1000;
if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK)
reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK;
else
reset_counter_ticks = JZ_RTC_RESET_COUNTER_MASK;
jz4740_rtc_wait_ready(rtc_base);
writel(reset_counter_ticks, rtc_base + JZ_REG_RTC_RESET_COUNTER);

jz4740_rtc_wait_ready(rtc_base);
writel(1, rtc_base + JZ_REG_RTC_HIBERNATE);

jz4740_halt();
}

void jz4740_reset_init(void)
{
_machine_restart = jz4740_restart;
_machine_halt = jz4740_halt;
pm_power_off = jz4740_power_off;
}
38 changes: 24 additions & 14 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ config RTC_DRV_MAX6900

config RTC_DRV_MAX8907
tristate "Maxim MAX8907"
depends on MFD_MAX8907
depends on MFD_MAX8907 || COMPILE_TEST
help
If you say yes here you will get support for the
RTC of Maxim MAX8907 PMIC.
Expand Down Expand Up @@ -343,7 +343,7 @@ config RTC_DRV_MAX8997

config RTC_DRV_MAX77686
tristate "Maxim MAX77686"
depends on MFD_MAX77686 || MFD_MAX77620
depends on MFD_MAX77686 || MFD_MAX77620 || COMPILE_TEST
help
If you say yes here you will get support for the
RTC of Maxim MAX77686/MAX77620/MAX77802 PMIC.
Expand Down Expand Up @@ -481,6 +481,7 @@ config RTC_DRV_TWL92330
config RTC_DRV_TWL4030
tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
depends on TWL4030_CORE
depends on OF
help
If you say yes here you get support for the RTC on the
TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
Expand Down Expand Up @@ -602,7 +603,8 @@ config RTC_DRV_RV8803

config RTC_DRV_S5M
tristate "Samsung S2M/S5M series"
depends on MFD_SEC_CORE
depends on MFD_SEC_CORE || COMPILE_TEST
select REGMAP_IRQ
help
If you say yes here you will get support for the
RTC of Samsung S2MPS14 and S5M PMIC series.
Expand Down Expand Up @@ -820,8 +822,8 @@ config RTC_DRV_RV3029_HWMON

comment "Platform RTC drivers"

# this 'CMOS' RTC driver is arch dependent because <asm-generic/rtc.h>
# requires <asm/mc146818rtc.h> defining CMOS_READ/CMOS_WRITE, and a
# this 'CMOS' RTC driver is arch dependent because it requires
# <asm/mc146818rtc.h> defining CMOS_READ/CMOS_WRITE, and a
# global rtc_lock ... it's not yet just another platform_device.

config RTC_DRV_CMOS
Expand Down Expand Up @@ -1549,14 +1551,11 @@ config RTC_DRV_MPC5121
will be called rtc-mpc5121.

config RTC_DRV_JZ4740
tristate "Ingenic JZ4740 SoC"
depends on MACH_JZ4740 || COMPILE_TEST
bool "Ingenic JZ4740 SoC"
depends on MACH_INGENIC || COMPILE_TEST
help
If you say yes here you get support for the Ingenic JZ4740 SoC RTC
controller.

This driver can also be buillt as a module. If so, the module
will be called rtc-jz4740.
If you say yes here you get support for the Ingenic JZ47xx SoCs RTC
controllers.

config RTC_DRV_LPC24XX
tristate "NXP RTC for LPC178x/18xx/408x/43xx"
Expand All @@ -1567,7 +1566,7 @@ config RTC_DRV_LPC24XX
NXP LPC178x/18xx/408x/43xx devices.

If you have one of the devices above enable this driver to use
the hardware RTC. This driver can also be buillt as a module. If
the hardware RTC. This driver can also be built as a module. If
so, the module will be called rtc-lpc24xx.

config RTC_DRV_LPC32XX
Expand All @@ -1576,7 +1575,7 @@ config RTC_DRV_LPC32XX
help
This enables support for the NXP RTC in the LPC32XX

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

config RTC_DRV_PM8XXX
Expand Down Expand Up @@ -1706,6 +1705,17 @@ config RTC_DRV_PIC32
This driver can also be built as a module. If so, the module
will be called rtc-pic32

config RTC_DRV_R7301
tristate "EPSON TOYOCOM RTC-7301SF/DG"
select REGMAP_MMIO
depends on OF && HAS_IOMEM
help
If you say yes here you get support for the EPSON TOYOCOM
RTC-7301SF/DG chips.

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

comment "HID Sensor RTC drivers"

config RTC_DRV_HID_SENSOR_TIME
Expand Down
1 change: 1 addition & 0 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o
obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o
obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o
obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o
obj-$(CONFIG_RTC_DRV_R7301) += rtc-r7301.o
obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
obj-$(CONFIG_RTC_DRV_RC5T583) += rtc-rc5t583.o
obj-$(CONFIG_RTC_DRV_RK808) += rtc-rk808.o
Expand Down
Loading

0 comments on commit b0b3a37

Please sign in to comment.