Skip to contentSkip to conversation

Add support for hym8563 rtcs

PATCH Superseded Heiko Stübner 2 participants 6 messages Dec 1, 2013 – Dec 9, 2013

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add support for hym8563 rtcs

This series adds support for the Haoyu Microelectronics HYM8563 rtc. This chip is often used in designs around the Cortex-A9 SoCs from Rockchip to provide rtc functionality and the 32kHz suspend clock the SoC needs.

changes since v2:
- get size for devm_kzalloc from struct not from pointer changes since v1:
- add haoyu prefix to vendor-prefixes.txt
- use gpio_to_irq to get the alarm interrupt instead of specifying it separately to the gpio itself

Heiko Stuebner (2):
dt-bindings: add hym8563 binding
rtc: add hym8563 rtc-driver

 .../devicetree/bindings/rtc/haoyu,hym8563.txt      |   27 +
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 drivers/rtc/Kconfig                                |   11 +
 drivers/rtc/Makefile                               |    1 +
 drivers/rtc/rtc-hym8563.c                          |  626 ++++++++++++++++++++
 5 files changed, 666 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/haoyu,hym8563.txt
 create mode 100644 drivers/rtc/rtc-hym8563.c
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v3 1/2 dt-bindings: add hym8563 binding

Add binding documentation for the hym8563 rtc chip.

---
 .../devicetree/bindings/rtc/haoyu,hym8563.txt      |   27 ++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 2 files changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/haoyu,hym8563.txt
Documentation/devicetree/bindings/rtc/haoyu,hym8563.txt new file +27 -0
new file mode 100644
index 0000000..5ec0828
@@ -0,0 +1,27 @@
+Haoyu Microelectronics HYM8563 Real Time Clock
+
+The HYM8563 provides basic rtc and alarm functionality
+as well as a clock output of up to 32kHz.
+
+Required properties:
+- compatible: should be: "haoyu,hym8563"
+- reg: i2c address
+- gpios: alarm interrupt gpio
+- #clock-cells: the value should be 0
+
+Example:
+
+hym8563: hym8563@51 {
+	compatible = "haoyu,hym8563";
+	reg = <0x51>;
+
+	gpios = <&gpio0 13 0>;
+
+	#clock-cells = <0>;
+};
+
+device {
+...
+	clocks = <&hym8563>;
+...
+};
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 2956800..3452270 100644
@@ -28,6 +28,7 @@ est	ESTeem Wireless Modems
 fsl	Freescale Semiconductor
 GEFanuc	GE Fanuc Intelligent Platforms Embedded Systems, Inc.
 gef	GE Fanuc Intelligent Platforms Embedded Systems, Inc.
+haoyu	Haoyu Microelectronic Co. Ltd.
 hisilicon	Hisilicon Limited.
 hp	Hewlett Packard
 ibm	International Business Machines (IBM)
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [rtc-linux] [PATCH v3 1/2] dt-bindings: add hym8563 binding

Quoted 4 lines · Heiko Stübner

+Required properties:

+- compatible: should be: "haoyu,hym8563"
+- reg: i2c address
+- gpios: alarm interrupt gpio

Why is this specified as a GPIO and not as an interrupt?

#3 lore raw

Re: [rtc-linux] [PATCH v3 1/2] dt-bindings: add hym8563 binding

Hi Mark,

Am Montag, 2. Dezember 2013, 14:41:10 schrieb Mark Brown:

Quoted 7 lines · Heiko Stübner
Quoted 4 lines

+Required properties:

+- compatible: should be: "haoyu,hym8563"
+- reg: i2c address
+- gpios: alarm interrupt gpio

Why is this specified as a GPIO and not as an interrupt?

sorry for the late reply, but it seems I got somehow droppen from your recipient list, so just found this mail on the mailinglist.

In v1 I specified the interrupt and the gpio. Apart from the resulting duplication of information this also resulted in the gpio only being requested but never used itself, which Mark Rutland did not seem to like this much :-) .

As I'd like to keep the sanity check that really requesting the interrupt gpio provides I did go this way, as the interrupt pin of the chip is of course always provided thru a gpio. As there are other drivers going this route it looked like an ok way to go.

So what would be the real way to go? Specify only the interrupt, only the gpio or both?

Heiko

#4 lore raw

Re: [rtc-linux] [PATCH v3 1/2] dt-bindings: add hym8563 binding

Quoted 8 lines · Heiko Stübner

Am Montag, 2. Dezember 2013, 14:41:10 schrieb Mark Brown:

Quoted 6 lines · Heiko Stübner
Quoted 5 lines

+Required properties:

+- compatible: should be: "haoyu,hym8563"
+- reg: i2c address
+- gpios: alarm interrupt gpio
Quoted 4 lines
Quoted 1 line

Why is this specified as a GPIO and not as an interrupt?

sorry for the late reply, but it seems I got somehow droppen from your recipient list, so just found this mail on the mailinglist.

Your mail had reply to set on it.

Quoted 10 lines

In v1 I specified the interrupt and the gpio. Apart from the resulting duplication of information this also resulted in the gpio only being requested but never used itself, which Mark Rutland did not seem to like this much :-) .

As I'd like to keep the sanity check that really requesting the interrupt gpio always provided thru a gpio. As there are other drivers going this route it looked like an ok way to go.

So what would be the real way to go? Specify only the interrupt, only the gpio or both?

Specify only the interrupt if it's genuinely an interrupt - requiring a GPIO is broken as not all interrupt controllers are also GPIOs. There are some OMAP drivers that are broken in this regard but they shouldn't be doing that. Only use a GPIO specifier if it's used as a GPIO.

#5 lore raw

PATCH v3 2/2 rtc: add hym8563 rtc-driver

In reply to Heiko Stübner

The Haoyu Microelectronics HYM8563 provides rtc- and alarm functions as well as a clock output of up to 32kHz.

---
 drivers/rtc/Kconfig       |   11 +
 drivers/rtc/Makefile      |    1 +
 drivers/rtc/rtc-hym8563.c |  626 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 638 insertions(+)
 create mode 100644 drivers/rtc/rtc-hym8563.c
drivers/rtc/Kconfig +11 -0
index 9654aa3..bf2c572 100644
@@ -202,6 +202,17 @@ config RTC_DRV_DS3232
 	  This driver can also be built as a module.  If so, the module
 	  will be called rtc-ds3232.
 
+config RTC_DRV_HYM8563
+	tristate "Haoyu Microelectronics HYM8563"
+	depends on I2C && OF && GPIOLIB
+	help
+	  Say Y to enable support for the HYM8563 I2C RTC chip. Apart
+	  from the usual rtc functions it provides a clock output of
+	  up to 32kHz.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-hym8563.
+
 config RTC_DRV_LP8788
 	tristate "TI LP8788 RTC driver"
 	depends on MFD_LP8788
drivers/rtc/Makefile +1 -0
index 2dff3d2..92f9d2c 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_RTC_DRV_EP93XX)	+= rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_FM3130)	+= rtc-fm3130.o
 obj-$(CONFIG_RTC_DRV_GENERIC)	+= rtc-generic.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_ISL1208)	+= rtc-isl1208.o
 obj-$(CONFIG_RTC_DRV_ISL12022)	+= rtc-isl12022.o
drivers/rtc/rtc-hym8563.c new file +626 -0

626 lines not on this page · raw message

Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html