mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341
@ 2016-01-07  6:17 Andrey Smirnov
  2016-01-07  6:17 ` [PATCH 2/6] rtc: ds1307: Fix a memory leak Andrey Smirnov
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07  6:17 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Port DS1337 specific bits from corresponding Linux driver and add
small changes needed for DS1341.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/rtc/rtc-ds1307.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index d78faa8..2b46ae5 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -31,7 +31,9 @@
  */
 enum ds_type {
 	ds_1307,
+	ds_1337,
 	ds_1338,
+	ds_1341,
 	last_ds_type /* always last */
 };

@@ -62,6 +64,28 @@ enum ds_type {
 #	define DS1307_BIT_SQWE		0x10
 #	define DS1307_BIT_RS1		0x02
 #	define DS1307_BIT_RS0		0x01
+#define DS1337_REG_CONTROL	0x0e
+#	define DS1337_BIT_nEOSC		0x80
+#	define DS1339_BIT_BBSQI		0x20
+#	define DS3231_BIT_BBSQW		0x40 /* same as BBSQI */
+#	define DS1337_BIT_RS2		0x10
+#	define DS1337_BIT_RS1		0x08
+#	define DS1337_BIT_INTCN		0x04
+#	define DS1337_BIT_A2IE		0x02
+#	define DS1337_BIT_A1IE		0x01
+#define DS1340_REG_CONTROL	0x07
+#	define DS1340_BIT_OUT		0x80
+#	define DS1340_BIT_FT		0x40
+#	define DS1340_BIT_CALIB_SIGN	0x20
+#	define DS1340_M_CALIBRATION	0x1f
+#define DS1340_REG_FLAG		0x09
+#	define DS1340_BIT_OSF		0x80
+#define DS1337_REG_STATUS	0x0f
+#	define DS1337_BIT_OSF		0x80
+#	define DS1341_BIT_ECLK		0x04
+#	define DS1337_BIT_A2I		0x02
+#	define DS1337_BIT_A1I		0x01
+

 struct ds1307 {
 	struct rtc_device	rtc;
@@ -78,7 +102,9 @@ struct ds1307 {

 static struct platform_device_id ds1307_id[] = {
 	{ "ds1307", ds_1307 },
+	{ "ds1337", ds_1337 },
 	{ "ds1338", ds_1338 },
+	{ "ds1341", ds_1341 },
 	{ "pt7c4338", ds_1307 },
 	{ }
 };
@@ -224,6 +250,16 @@ static int ds1307_set_time(struct rtc_device *rtcdev, struct rtc_time *t)
 	tmp = t->tm_year - 100;
 	buf[DS1307_REG_YEAR] = bin2bcd(tmp);

+	switch (ds1307->type) {
+	case ds_1337:
+	case ds_1341:
+		buf[DS1307_REG_MONTH] |= DS1337_BIT_CENTURY;
+		break;
+	default:
+		break;
+	}
+
+
 	dev_dbg(dev, "%s: %7ph\n", "write", buf);

 	result = ds1307->write_block_data(ds1307->client,
@@ -263,6 +299,61 @@ static int ds1307_probe(struct device_d *dev)
 	ds1307->read_block_data = ds1307_read_block_data;
 	ds1307->write_block_data = ds1307_write_block_data;

+
+	switch (ds1307->type) {
+	case ds_1337:
+	case ds_1341:
+		/* get registers that the "rtc" read below won't read... */
+		tmp = ds1307->read_block_data(ds1307->client,
+					      DS1337_REG_CONTROL, 2, buf);
+
+		if (tmp != 2) {
+			dev_dbg(&client->dev, "read error %d\n", tmp);
+			err = -EIO;
+			goto exit;
+		}
+
+		/* oscillator off?  turn it on, so clock can tick. */
+		if (ds1307->regs[0] & DS1337_BIT_nEOSC)
+			ds1307->regs[0] &= ~DS1337_BIT_nEOSC;
+
+
+		/*
+		  Make sure no alarm interrupts or square wave signals
+		  are produced by the chip while we are in
+		  bootloader. We do this by configuring the RTC to
+		  generate alarm interrupts (thus disabling square
+		  wave generation), but disabling each individual
+		  alarm interrupt source
+		 */
+		ds1307->regs[0] |= DS1337_BIT_INTCN;
+		ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
+
+		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) {
+			ds1307->regs[1] &= DS1341_BIT_ECLK;
+			i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
+						  ds1307->regs[1]);
+		}
+
+
+		/* oscillator fault?  clear flag, and warn */
+		if (ds1307->regs[1] & DS1337_BIT_OSF) {
+			i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
+				ds1307->regs[1] & ~DS1337_BIT_OSF);
+			dev_warn(&client->dev, "SET TIME!\n");
+		}
+
+	default:
+		break;
+	}
+
 read_rtc:
 	/* read RTC registers */
 	tmp = ds1307->read_block_data(client, ds1307->offset, 8, buf);
--
2.5.0

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/6] rtc: ds1307: Fix a memory leak
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
@ 2016-01-07  6:17 ` Andrey Smirnov
  2016-01-07  6:17 ` [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm() Andrey Smirnov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07  6:17 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Several failure paths would result in control being transfered to
'exit' label, so instead of just returning error codes in those cases
we also need to free the memory allocated for 'ds1307'

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/rtc/rtc-ds1307.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 2b46ae5..e2d561b 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -17,6 +17,7 @@
 #include <init.h>
 #include <driver.h>
 #include <xfuncs.h>
+#include <malloc.h>
 #include <errno.h>
 #include <i2c/i2c.h>
 #include <rtc.h>
@@ -422,6 +423,8 @@ read_rtc:
 	err = rtc_register(&ds1307->rtc);

 exit:
+	if (err)
+		free(ds1307);
 	return err;
 }

--
2.5.0

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm()
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
  2016-01-07  6:17 ` [PATCH 2/6] rtc: ds1307: Fix a memory leak Andrey Smirnov
@ 2016-01-07  6:17 ` Andrey Smirnov
  2016-01-07  6:57   ` Antony Pavlov
  2016-01-07  6:17 ` [PATCH 5/6] common/date.c: Fix off-by-one error Andrey Smirnov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07  6:17 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus
values from uninitialized HW registers get passed to the uppper layers.

A somewhat contrived way to reproduce this problem with DS1307 RTC
would be to do the following:

> rtc_write -b <bus> -a <addr> -r 3 0x00
> hwclock

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/rtc/rtc-lib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index 1b23458..83d8045 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -90,6 +90,8 @@ int rtc_valid_tm(struct rtc_time *tm)
 {
 	if (tm->tm_year < 70
 		|| ((unsigned)tm->tm_mon) >= 12
+		|| tm->tm_wday < 0
+		|| tm->tm_wday > 6
 		|| tm->tm_mday < 1
 		|| tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900)
 		|| ((unsigned)tm->tm_hour) >= 24
--
2.5.0

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/6] common/date.c: Fix off-by-one error
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
  2016-01-07  6:17 ` [PATCH 2/6] rtc: ds1307: Fix a memory leak Andrey Smirnov
  2016-01-07  6:17 ` [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm() Andrey Smirnov
@ 2016-01-07  6:17 ` Andrey Smirnov
  2016-01-07  7:50   ` Sascha Hauer
  2016-01-07  6:17 ` [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time() Andrey Smirnov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07  6:17 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
'tm_wday' is zero indexed with zero representing Sunday, this is also
corroborated by the code in rtc_time_to_tm() which used 4 to represent
Thursday.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 common/date.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/date.c b/common/date.c
index 2f23463..129192e 100644
--- a/common/date.c
+++ b/common/date.c
@@ -151,13 +151,13 @@ mktime (unsigned int year, unsigned int mon,

 const char *time_str(struct rtc_time *tm)
 {
-	const char *weekdays[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+	const char *weekdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
 	const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
 				 "Sep", "Oct", "Nov", "Dec" };
 	static char buf[128];

 	sprintf(buf, "%s %02d %s %4d %02d:%02d:%02d",
-			weekdays[tm->tm_wday - 1],
+			weekdays[tm->tm_wday],
 			tm->tm_mday,
 			months[tm->tm_mon],
 			tm->tm_year + 1900,
--
2.5.0

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time()
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
                   ` (2 preceding siblings ...)
  2016-01-07  6:17 ` [PATCH 5/6] common/date.c: Fix off-by-one error Andrey Smirnov
@ 2016-01-07  6:17 ` Andrey Smirnov
  2016-01-07  6:58   ` Antony Pavlov
  2016-01-07  6:51 ` [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Antony Pavlov
  2016-01-07  7:48 ` Sascha Hauer
  5 siblings, 1 reply; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07  6:17 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

It is possible for rtc_read_time() to fill struct rtc_time it returns
with invalid values, so we have to check for its return value before
using returned time.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 commands/hwclock.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/commands/hwclock.c b/commands/hwclock.c
index 7633132..737df11 100644
--- a/commands/hwclock.c
+++ b/commands/hwclock.c
@@ -93,11 +93,12 @@ static int do_hwclock(int argc, char *argv[])
 	char *env_name = NULL;
 	int opt;
 	int set = 0;
+	int ret;
 	int ntp_to_hw = 0;
 	char *ntpserver = NULL;

 	while ((opt = getopt(argc, argv, "f:s:e:n:")) > 0) {
-		int ret;
+

 		switch (opt) {
 		case 'f':
@@ -151,7 +152,9 @@ static int do_hwclock(int argc, char *argv[])
 		return rtc_set_time(r, &stm);
 	}

-	rtc_read_time(r, &tm);
+	ret = rtc_read_time(r, &tm);
+	if (ret < 0)
+		return ret;

 	if (env_name) {
 		unsigned long time;
--
2.5.0

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
                   ` (3 preceding siblings ...)
  2016-01-07  6:17 ` [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time() Andrey Smirnov
@ 2016-01-07  6:51 ` Antony Pavlov
  2016-01-07  7:48 ` Sascha Hauer
  5 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2016-01-07  6:51 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed,  6 Jan 2016 22:17:30 -0800
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> Port DS1337 specific bits from corresponding Linux driver and add
> small changes needed for DS1341.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/rtc/rtc-ds1307.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 91 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index d78faa8..2b46ae5 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
...
> @@ -263,6 +299,61 @@ static int ds1307_probe(struct device_d *dev)
>  	ds1307->read_block_data = ds1307_read_block_data;
>  	ds1307->write_block_data = ds1307_write_block_data;
> 
> +

Extra empty line here.

> +	switch (ds1307->type) {
> +	case ds_1337:
> +	case ds_1341:

...

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm()
  2016-01-07  6:17 ` [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm() Andrey Smirnov
@ 2016-01-07  6:57   ` Antony Pavlov
  2016-01-07 16:54     ` Andrey Smirnov
  0 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2016-01-07  6:57 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed,  6 Jan 2016 22:17:32 -0800
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus
> values from uninitialized HW registers get passed to the uppper layers.
> 
> A somewhat contrived way to reproduce this problem with DS1307 RTC
> would be to do the following:
> 
> > rtc_write -b <bus> -a <addr> -r 3 0x00

    rtc_write? Do you mean i2c_write here?

> > hwclock
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/rtc/rtc-lib.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
> index 1b23458..83d8045 100644
> --- a/drivers/rtc/rtc-lib.c
> +++ b/drivers/rtc/rtc-lib.c
> @@ -90,6 +90,8 @@ int rtc_valid_tm(struct rtc_time *tm)
>  {
>  	if (tm->tm_year < 70
>  		|| ((unsigned)tm->tm_mon) >= 12
> +		|| tm->tm_wday < 0
> +		|| tm->tm_wday > 6
>  		|| tm->tm_mday < 1
>  		|| tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900)
>  		|| ((unsigned)tm->tm_hour) >= 24
> --
> 2.5.0
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time()
  2016-01-07  6:17 ` [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time() Andrey Smirnov
@ 2016-01-07  6:58   ` Antony Pavlov
  0 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2016-01-07  6:58 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed,  6 Jan 2016 22:17:35 -0800
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> It is possible for rtc_read_time() to fill struct rtc_time it returns
> with invalid values, so we have to check for its return value before
> using returned time.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  commands/hwclock.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/hwclock.c b/commands/hwclock.c
> index 7633132..737df11 100644
> --- a/commands/hwclock.c
> +++ b/commands/hwclock.c
> @@ -93,11 +93,12 @@ static int do_hwclock(int argc, char *argv[])
>  	char *env_name = NULL;
>  	int opt;
>  	int set = 0;
> +	int ret;
>  	int ntp_to_hw = 0;
>  	char *ntpserver = NULL;
> 
>  	while ((opt = getopt(argc, argv, "f:s:e:n:")) > 0) {
> -		int ret;
> +
> 

Extra empty line here.

>  		switch (opt) {
>  		case 'f':
> @@ -151,7 +152,9 @@ static int do_hwclock(int argc, char *argv[])
>  		return rtc_set_time(r, &stm);
>  	}
> 
> -	rtc_read_time(r, &tm);
> +	ret = rtc_read_time(r, &tm);
> +	if (ret < 0)
> +		return ret;
> 
>  	if (env_name) {
>  		unsigned long time;
> --
> 2.5.0
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341
  2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
                   ` (4 preceding siblings ...)
  2016-01-07  6:51 ` [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Antony Pavlov
@ 2016-01-07  7:48 ` Sascha Hauer
  5 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2016-01-07  7:48 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed, Jan 06, 2016 at 10:17:30PM -0800, Andrey Smirnov wrote:
> Port DS1337 specific bits from corresponding Linux driver and add
> small changes needed for DS1341.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/rtc/rtc-ds1307.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 91 insertions(+)

Applied with Antonys remarks fixed.

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] 11+ messages in thread

* Re: [PATCH 5/6] common/date.c: Fix off-by-one error
  2016-01-07  6:17 ` [PATCH 5/6] common/date.c: Fix off-by-one error Andrey Smirnov
@ 2016-01-07  7:50   ` Sascha Hauer
  0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2016-01-07  7:50 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed, Jan 06, 2016 at 10:17:34PM -0800, Andrey Smirnov wrote:
> As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
> 'tm_wday' is zero indexed with zero representing Sunday, this is also
> corroborated by the code in rtc_time_to_tm() which used 4 to represent
> Thursday.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  common/date.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I squashed this into the original commit introducing this bug.

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] 11+ messages in thread

* Re: [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm()
  2016-01-07  6:57   ` Antony Pavlov
@ 2016-01-07 16:54     ` Andrey Smirnov
  0 siblings, 0 replies; 11+ messages in thread
From: Andrey Smirnov @ 2016-01-07 16:54 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Wed, Jan 6, 2016 at 10:57 PM, Antony Pavlov <antonynpavlov@gmail.com> wrote:
> On Wed,  6 Jan 2016 22:17:32 -0800
> Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
>
>> RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus
>> values from uninitialized HW registers get passed to the uppper layers.
>>
>> A somewhat contrived way to reproduce this problem with DS1307 RTC
>> would be to do the following:
>>
>> > rtc_write -b <bus> -a <addr> -r 3 0x00
>
>     rtc_write? Do you mean i2c_write here?

Yeah, that's a typo

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-01-07 16:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07  6:17 [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Andrey Smirnov
2016-01-07  6:17 ` [PATCH 2/6] rtc: ds1307: Fix a memory leak Andrey Smirnov
2016-01-07  6:17 ` [PATCH 3/6] rtc-lib: Check tm_wday for validity in rtc_valid_tm() Andrey Smirnov
2016-01-07  6:57   ` Antony Pavlov
2016-01-07 16:54     ` Andrey Smirnov
2016-01-07  6:17 ` [PATCH 5/6] common/date.c: Fix off-by-one error Andrey Smirnov
2016-01-07  7:50   ` Sascha Hauer
2016-01-07  6:17 ` [PATCH 6/6] commands/hwclock: Check return value of rtc_read_time() Andrey Smirnov
2016-01-07  6:58   ` Antony Pavlov
2016-01-07  6:51 ` [PATCH 1/6] rtc: ds1307: Add code to support ds1337/1341 Antony Pavlov
2016-01-07  7:48 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox