* [PATCH 1/3] rtc: abracon: Check obtianed time for validity
@ 2016-04-04 1:06 Andrey Smirnov
2016-04-04 1:06 ` [PATCH 2/3] ds1307: Fix a bug in probe() Andrey Smirnov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrey Smirnov @ 2016-04-04 1:06 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Check obtianed time for validity before returning it to the caller
the same way other RTC drivers do.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/rtc/rtc-abracon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-abracon.c b/drivers/rtc/rtc-abracon.c
index b3af990..02de2f1 100644
--- a/drivers/rtc/rtc-abracon.c
+++ b/drivers/rtc/rtc-abracon.c
@@ -59,7 +59,7 @@ static int abracon_get_time(struct rtc_device *rtcdev, struct rtc_time *t)
t->tm_mon = bcd2bin(cp[5]);
t->tm_year = bcd2bin(cp[6]) + 100;
- return 0;
+ return rtc_valid_tm(t);
}
static int abracon_set_time(struct rtc_device *rtcdev, struct rtc_time *t)
@@ -123,4 +123,4 @@ static int __init abracon_init(void)
{
return i2c_driver_register(&abracon_driver);
}
-device_initcall(abracon_init);
\ No newline at end of file
+device_initcall(abracon_init);
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] ds1307: Fix a bug in probe()
2016-04-04 1:06 [PATCH 1/3] rtc: abracon: Check obtianed time for validity Andrey Smirnov
@ 2016-04-04 1:06 ` Andrey Smirnov
2016-04-04 1:06 ` [PATCH 3/3] ds1307: Configure ds1341 for lowest power mode Andrey Smirnov
2016-04-05 6:43 ` [PATCH 1/3] rtc: abracon: Check obtianed time for validity Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2016-04-04 1:06 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add missing "~" to bit clearing operation.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/rtc/rtc-ds1307.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index e2d561b..a1cfed6 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -338,7 +338,7 @@ static int ds1307_probe(struct device_d *dev)
ECLK bit set to 0
*/
if (ds1307->type == ds_1341) {
- ds1307->regs[1] &= DS1341_BIT_ECLK;
+ ds1307->regs[1] &= ~DS1341_BIT_ECLK;
i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
ds1307->regs[1]);
}
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] ds1307: Configure ds1341 for lowest power mode
2016-04-04 1:06 [PATCH 1/3] rtc: abracon: Check obtianed time for validity Andrey Smirnov
2016-04-04 1:06 ` [PATCH 2/3] ds1307: Fix a bug in probe() Andrey Smirnov
@ 2016-04-04 1:06 ` Andrey Smirnov
2016-04-05 6:43 ` [PATCH 1/3] rtc: abracon: Check obtianed time for validity Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2016-04-04 1:06 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Empirical observations show that configuring INTCN=1, ECLK=0, EGFIL=0,
DOSF=1 on DS1341 put the chip in the mode where it draws the least
amount fo current.
Add code to configure DS1341 in such a way in case Barebox is the last
code that runs on the processor before being shut down.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/rtc/rtc-ds1307.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index a1cfed6..4720964 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -68,6 +68,7 @@ enum ds_type {
#define DS1337_REG_CONTROL 0x0e
# define DS1337_BIT_nEOSC 0x80
# define DS1339_BIT_BBSQI 0x20
+# define DS1341_BIT_EGFIL 0x20
# define DS3231_BIT_BBSQW 0x40 /* same as BBSQI */
# define DS1337_BIT_RS2 0x10
# define DS1337_BIT_RS1 0x08
@@ -83,6 +84,7 @@ enum ds_type {
# define DS1340_BIT_OSF 0x80
#define DS1337_REG_STATUS 0x0f
# define DS1337_BIT_OSF 0x80
+# define DS1341_BIT_DOSF 0x40
# define DS1341_BIT_ECLK 0x04
# define DS1337_BIT_A2I 0x02
# define DS1337_BIT_A1I 0x01
@@ -333,12 +335,22 @@ static int ds1307_probe(struct device_d *dev)
i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
ds1307->regs[0]);
- /*
- For the above to be true, DS1341 also has to have
- ECLK bit set to 0
- */
if (ds1307->type == ds_1341) {
+ /*
+ For the above to be true, DS1341 also has to have
+ ECLK bit set to 0
+ */
ds1307->regs[1] &= ~DS1341_BIT_ECLK;
+
+ /*
+ * Let's set additionale RTC bits to
+ * facilitate maximum power saving.
+ */
+ ds1307->regs[0] |= DS1341_BIT_DOSF;
+ ds1307->regs[0] &= ~DS1341_BIT_EGFIL;
+
+ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
+ ds1307->regs[0]);
i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
ds1307->regs[1]);
}
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] rtc: abracon: Check obtianed time for validity
2016-04-04 1:06 [PATCH 1/3] rtc: abracon: Check obtianed time for validity Andrey Smirnov
2016-04-04 1:06 ` [PATCH 2/3] ds1307: Fix a bug in probe() Andrey Smirnov
2016-04-04 1:06 ` [PATCH 3/3] ds1307: Configure ds1341 for lowest power mode Andrey Smirnov
@ 2016-04-05 6:43 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2016-04-05 6:43 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Sun, Apr 03, 2016 at 06:06:31PM -0700, Andrey Smirnov wrote:
> Check obtianed time for validity before returning it to the caller
> the same way other RTC drivers do.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/rtc/rtc-abracon.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-05 6:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 1:06 [PATCH 1/3] rtc: abracon: Check obtianed time for validity Andrey Smirnov
2016-04-04 1:06 ` [PATCH 2/3] ds1307: Fix a bug in probe() Andrey Smirnov
2016-04-04 1:06 ` [PATCH 3/3] ds1307: Configure ds1341 for lowest power mode Andrey Smirnov
2016-04-05 6:43 ` [PATCH 1/3] rtc: abracon: Check obtianed time for validity Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox