From 45ef0458fb2b931962f8558e1fd145e63ea990ab Mon Sep 17 00:00:00 2001 From: Jan Kardell Date: Wed, 10 Dec 2014 15:53:34 -0800 Subject: rtc: pcf8563: fix write of invalid bits to ST2 reg The NXP datasheet says: "Bits labeled as N should always be written with logic 0." At least one of those bits is sometime read as a 1, therfore violating this rule. To fix this we mask away those bits. Signed-off-by: Jan Kardell Cc: Alessandro Zummo Cc: Grant Likely Cc: Rob Herring Cc: Vincent Donnefort Cc: Dan Carpenter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/rtc-pcf8563.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/rtc/rtc-pcf8563.c') diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 1a865c9f1127..8c23606ce2cc 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -28,6 +28,7 @@ #define PCF8563_REG_ST2 0x01 #define PCF8563_BIT_AIE (1 << 1) #define PCF8563_BIT_AF (1 << 3) +#define PCF8563_BITS_ST2_N (7 << 5) #define PCF8563_REG_SC 0x02 /* datetime */ #define PCF8563_REG_MN 0x03 @@ -130,7 +131,7 @@ static int pcf8563_set_alarm_mode(struct i2c_client *client, bool on) else buf &= ~PCF8563_BIT_AIE; - buf &= ~PCF8563_BIT_AF; + buf &= ~(PCF8563_BIT_AF | PCF8563_BITS_ST2_N); err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf); if (err < 0) { -- cgit v1.2.3-55-g7522