diff options
author | Jan Kardell <jan.kardell@telliq.com> | 2014-12-10 18:53:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:15 -0500 |
commit | 45ef0458fb2b931962f8558e1fd145e63ea990ab (patch) | |
tree | 855096740546378aafbed1b89a7e3eb2964e70f7 /drivers/rtc | |
parent | 17a1e5e830723f18eeb4ec00fa5a1032e378f06e (diff) |
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 <jan.kardell@telliq.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Vincent Donnefort <vdonnefort@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-pcf8563.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 @@ | |||
28 | #define PCF8563_REG_ST2 0x01 | 28 | #define PCF8563_REG_ST2 0x01 |
29 | #define PCF8563_BIT_AIE (1 << 1) | 29 | #define PCF8563_BIT_AIE (1 << 1) |
30 | #define PCF8563_BIT_AF (1 << 3) | 30 | #define PCF8563_BIT_AF (1 << 3) |
31 | #define PCF8563_BITS_ST2_N (7 << 5) | ||
31 | 32 | ||
32 | #define PCF8563_REG_SC 0x02 /* datetime */ | 33 | #define PCF8563_REG_SC 0x02 /* datetime */ |
33 | #define PCF8563_REG_MN 0x03 | 34 | #define PCF8563_REG_MN 0x03 |
@@ -130,7 +131,7 @@ static int pcf8563_set_alarm_mode(struct i2c_client *client, bool on) | |||
130 | else | 131 | else |
131 | buf &= ~PCF8563_BIT_AIE; | 132 | buf &= ~PCF8563_BIT_AIE; |
132 | 133 | ||
133 | buf &= ~PCF8563_BIT_AF; | 134 | buf &= ~(PCF8563_BIT_AF | PCF8563_BITS_ST2_N); |
134 | 135 | ||
135 | err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf); | 136 | err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf); |
136 | if (err < 0) { | 137 | if (err < 0) { |