From: "Michael Büsch" <m@bues.ch>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Gregory Hermant <gregory.hermant@calao-systems.com>,
rtc-linux@googlegroups.com
Subject: [rtc-linux] [PATCH v3 3/6] rtc-rv3029: Add missing register definitions
Date: Fri, 4 Mar 2016 22:39:49 +0100 [thread overview]
Message-ID: <20160304223949.0856aff9@wiggum> (raw)
In-Reply-To: <20160304195544.6b6297df@wiggum>
[-- Attachment #1: Type: text/plain, Size: 4509 bytes --]
This adds all (according to the data sheet) missing register and bit
definitions.
It also fixes the definition of the trickle charger bit masks.
Signed-off-by: Michael Buesch <m@bues.ch>
---
drivers/rtc/rtc-rv3029c2.c | 61 ++++++++++++++++++++++++++++++++++------------
1 file changed, 45 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index fc0dbc4..29cc871 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -22,25 +22,42 @@
/* Register map */
/* control section */
#define RV3029_ONOFF_CTRL 0x00
+#define RV3029_ONOFF_CTRL_WE BIT(0)
+#define RV3029_ONOFF_CTRL_TE BIT(1)
+#define RV3029_ONOFF_CTRL_TAR BIT(2)
+#define RV3029_ONOFF_CTRL_EERE BIT(3)
+#define RV3029_ONOFF_CTRL_SRON BIT(4)
+#define RV3029_ONOFF_CTRL_TD0 BIT(5)
+#define RV3029_ONOFF_CTRL_TD1 BIT(6)
+#define RV3029_ONOFF_CTRL_CLKINT BIT(7)
#define RV3029_IRQ_CTRL 0x01
-#define RV3029_IRQ_CTRL_AIE (1 << 0)
+#define RV3029_IRQ_CTRL_AIE BIT(0)
+#define RV3029_IRQ_CTRL_TIE BIT(1)
+#define RV3029_IRQ_CTRL_V1IE BIT(2)
+#define RV3029_IRQ_CTRL_V2IE BIT(3)
+#define RV3029_IRQ_CTRL_SRIE BIT(4)
#define RV3029_IRQ_FLAGS 0x02
-#define RV3029_IRQ_FLAGS_AF (1 << 0)
+#define RV3029_IRQ_FLAGS_AF BIT(0)
+#define RV3029_IRQ_FLAGS_TF BIT(1)
+#define RV3029_IRQ_FLAGS_V1IF BIT(2)
+#define RV3029_IRQ_FLAGS_V2IF BIT(3)
+#define RV3029_IRQ_FLAGS_SRF BIT(4)
#define RV3029_STATUS 0x03
-#define RV3029_STATUS_VLOW1 (1 << 2)
-#define RV3029_STATUS_VLOW2 (1 << 3)
-#define RV3029_STATUS_SR (1 << 4)
-#define RV3029_STATUS_PON (1 << 5)
-#define RV3029_STATUS_EEBUSY (1 << 7)
+#define RV3029_STATUS_VLOW1 BIT(2)
+#define RV3029_STATUS_VLOW2 BIT(3)
+#define RV3029_STATUS_SR BIT(4)
+#define RV3029_STATUS_PON BIT(5)
+#define RV3029_STATUS_EEBUSY BIT(7)
#define RV3029_RST_CTRL 0x04
+#define RV3029_RST_CTRL_SYSR BIT(4)
#define RV3029_CONTROL_SECTION_LEN 0x05
/* watch section */
#define RV3029_W_SEC 0x08
#define RV3029_W_MINUTES 0x09
#define RV3029_W_HOURS 0x0A
-#define RV3029_REG_HR_12_24 (1<<6) /* 24h/12h mode */
-#define RV3029_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */
+#define RV3029_REG_HR_12_24 BIT(6) /* 24h/12h mode */
+#define RV3029_REG_HR_PM BIT(5) /* PM/AM bit in 12h mode */
#define RV3029_W_DATE 0x0B
#define RV3029_W_DAYS 0x0C
#define RV3029_W_MONTHS 0x0D
@@ -67,16 +84,28 @@
/* eeprom data section */
#define RV3029_E2P_EEDATA1 0x28
#define RV3029_E2P_EEDATA2 0x29
+#define RV3029_E2PDATA_SECTION_LEN 0x02
/* eeprom control section */
#define RV3029_CONTROL_E2P_EECTRL 0x30
-#define RV3029_TRICKLE_1K (1<<0) /* 1K resistance */
-#define RV3029_TRICKLE_5K (1<<1) /* 5K resistance */
-#define RV3029_TRICKLE_20K (1<<2) /* 20K resistance */
-#define RV3029_TRICKLE_80K (1<<3) /* 80K resistance */
-#define RV3029_CONTROL_E2P_XTALOFFSET 0x31
-#define RV3029_CONTROL_E2P_QCOEF 0x32
-#define RV3029_CONTROL_E2P_TURNOVER 0x33
+#define RV3029_EECTRL_THP BIT(0) /* temp scan interval */
+#define RV3029_EECTRL_THE BIT(1) /* thermometer enable */
+#define RV3029_EECTRL_FD0 BIT(2) /* CLKOUT */
+#define RV3029_EECTRL_FD1 BIT(3) /* CLKOUT */
+#define RV3029_TRICKLE_1K BIT(4) /* 1.5K resistance */
+#define RV3029_TRICKLE_5K BIT(5) /* 5K resistance */
+#define RV3029_TRICKLE_20K BIT(6) /* 20K resistance */
+#define RV3029_TRICKLE_80K BIT(7) /* 80K resistance */
+#define RV3029_TRICKLE_MASK (RV3029_TRICKLE_1K |\
+ RV3029_TRICKLE_5K |\
+ RV3029_TRICKLE_20K |\
+ RV3029_TRICKLE_80K)
+#define RV3029_TRICKLE_SHIFT 4
+#define RV3029_CONTROL_E2P_XOFFS 0x31 /* XTAL offset */
+#define RV3029_CONTROL_E2P_XOFFS_SIGN BIT(7) /* Sign: 1->pos, 0->neg */
+#define RV3029_CONTROL_E2P_QCOEF 0x32 /* XTAL temp drift coef */
+#define RV3029_CONTROL_E2P_TURNOVER 0x33 /* XTAL turnover temp (in *C) */
+#define RV3029_CONTROL_E2P_TOV_MASK 0x3F /* XTAL turnover temp mask */
/* user ram section */
#define RV3029_USR1_RAM_PAGE 0x38
--
2.7.0
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-03-04 21:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 20:33 [rtc-linux] [PATCH] rtc-rv3029c2: Add trickle charger Michael Büsch
2016-03-01 21:36 ` [rtc-linux] " Alexandre Belloni
2016-03-01 21:54 ` Michael Büsch
2016-03-01 23:07 ` Alexandre Belloni
2016-03-02 6:26 ` Michael Büsch
2016-03-02 12:00 ` Alexandre Belloni
[not found] ` <20160304195337.51439645@wiggum>
2016-03-04 18:54 ` [rtc-linux] [PATCH 1/6] rtc-rv3029: Remove all 'C2' suffixes from identifiers Michael Büsch
2016-03-04 21:38 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-04 18:55 ` [rtc-linux] [PATCH 2/6] rtc-rv3029: Add "rv3029" I2C device id Michael Büsch
2016-03-04 21:39 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-04 18:55 ` [rtc-linux] [PATCH 3/6] rtc-rv3029: Add missing register definitions Michael Büsch
2016-03-04 21:39 ` Michael Büsch [this message]
2016-03-04 18:56 ` [rtc-linux] [PATCH 4/6] rtc-rv3029: Add i2c register update-bits helper Michael Büsch
2016-03-04 19:42 ` [rtc-linux] " Alexandre Belloni
2016-03-04 19:46 ` Michael Büsch
2016-03-04 21:40 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-04 18:56 ` [rtc-linux] [PATCH 5/6] rtc-rv3029: Add functions for EEPROM access Michael Büsch
2016-03-04 21:40 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-04 18:56 ` [rtc-linux] [PATCH 6/6] rtc-rv3029: Add device tree property for trickle charger Michael Büsch
2016-03-04 19:43 ` [rtc-linux] " Alexandre Belloni
2016-03-04 19:49 ` Michael Büsch
2016-03-04 19:58 ` Alexandre Belloni
2016-03-04 21:41 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-04 19:02 ` [rtc-linux] [PATCH 0/6] rtc-rv3029: Add " Michael Büsch
2016-03-04 19:39 ` [rtc-linux] " Alexandre Belloni
2016-03-04 21:36 ` [rtc-linux] [PATCH v3 " Michael Büsch
2016-03-05 5:23 ` [rtc-linux] " Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160304223949.0856aff9@wiggum \
--to=m@bues.ch \
--cc=alexandre.belloni@free-electrons.com \
--cc=gregory.hermant@calao-systems.com \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.