From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bues.ch (bues.ch. [2a01:138:9005::1:4]) by gmr-mx.google.com with ESMTPS id w10si22783wmw.3.2016.03.04.13.44.31 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 04 Mar 2016 13:44:31 -0800 (PST) Date: Fri, 4 Mar 2016 22:39:49 +0100 From: Michael =?UTF-8?B?QsO8c2No?= To: Alexandre Belloni Cc: Gregory Hermant , rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH v3 3/6] rtc-rv3029: Add missing register definitions Message-ID: <20160304223949.0856aff9@wiggum> In-Reply-To: <20160304195544.6b6297df@wiggum> References: <20160301213322.661fe771@wiggum> <20160301213655.GG23985@piout.net> <20160301225401.3f0aeabb@wiggum> <20160301230745.GJ23985@piout.net> <20160302072627.14e53e94@wiggum> <20160302120045.GO23985@piout.net> <20160304195337.51439645@wiggum> <20160304195544.6b6297df@wiggum> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/nHohxg7TqG_D4O5ka0g/9AT"; protocol="application/pgp-signature" Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , --Sig_/nHohxg7TqG_D4O5ka0g/9AT Content-Type: text/plain; charset=UTF-8 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 --- 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. --Sig_/nHohxg7TqG_D4O5ka0g/9AT Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW2gClAAoJEPUyvh2QjYsOl7kP/0d395qf2zEBh/sm4gYenver 5Z96sgs+wydCy6OILkM1pgrrzjTwJLjP2KszhWwfGUSw53EJI5QqN6MxtLPrKkoF eSfqtiELIsGvASyzIgRRy9A3Zyayz8Y5HKyqa9PTkltSAqel83SoaRrEDbd0hCZp aLWq99o9jK496duxOgIA5kqM2r+8JBIvNM/bGeTdn9xNBAtBji9jsaf4EMwpLKND 3kNgIQWFsSuHow2zIfZkuTN8lSZvUyLtXmJhkBbmnnxsDb0Dw2NnF05GyuTFTZfA SLGyAef3QGs/DrMc6tCe2qo/gD81pfam2o29H8Lu8eRoDcevUoNvcNkdr1C6Kp1P JM0Qlp2PVBxpq6k2HdtagI1vdey5ryrsm7EIe5y+18NlDj67tI/yx397gjvyU7MR IuKpVTUvOc+hQdD8joOrDXvuQfdsYi3QTcCUBFx3wJ5nUCq6CmNASZwrTIiYoPnb 1NQQDgzvJQE25iTuNaNnkC/MJ6TPzKzPH0KluL2ljgDblfmi25BlVMZiOuakDpGJ Ch9A4YillWWvu8qLK9XXMTut6bCswnoh0OZX7SREbmLcRmzPjLzAj8fEjE61zA9U 7E/GWemHvsDu5XuPGlpKxhifhWv/JlJkOPdeUxUT3N9VwImDPgoXvPjhAv3zUqNK Tf1aMooZwjHLkzzBbFHf =RYKV -----END PGP SIGNATURE----- --Sig_/nHohxg7TqG_D4O5ka0g/9AT--