All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: busses: i2c-bcm2835: S-Register clear reserved bits
@ 2015-06-16 15:40 Silvan Wicki
       [not found] ` <1434469259-6474-1-git-send-email-linux_wi-ADq4ffItWIY@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Silvan Wicki @ 2015-06-16 15:40 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux_wi-ADq4ffItWIY

The Datasheet mentions on page 31 that the bits 10-31 must be read as
don't care and written as 0.
https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf

We cannot guarantee that we reed bits 10-31 as always 0 (becuase the
datasheet says read as don't care). We clear the bits with a bitmask to
prevent writing back unknown data at the reserved bits.

Signed-off-by: Silvan Wicki <linux_wi-ADq4ffItWIY@public.gmane.org>
---
 drivers/i2c/busses/i2c-bcm2835.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index c9336a3..aa06da1 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -50,6 +50,8 @@
 #define BCM2835_I2C_S_CLKT	BIT(9)
 #define BCM2835_I2C_S_LEN	BIT(10) /* Fake bit for SW error reporting */
 
+#define BCM2835_I2C_BITMSK_S	0x03FF
+
 #define BCM2835_I2C_TIMEOUT (msecs_to_jiffies(1000))
 
 struct bcm2835_i2c_dev {
@@ -111,6 +113,7 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data)
 	u32 val, err;
 
 	val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S);
+	val &= BCM2835_I2C_BITMSK_S;
 	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, val);
 
 	err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR);
-- 
2.1.4

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

* Re: [PATCH] i2c: busses: i2c-bcm2835: S-Register clear reserved bits
       [not found] ` <1434469259-6474-1-git-send-email-linux_wi-ADq4ffItWIY@public.gmane.org>
@ 2015-06-17  1:34   ` Stephen Warren
  2015-06-17 12:10   ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2015-06-17  1:34 UTC (permalink / raw)
  To: Silvan Wicki, wsa-z923LK4zBo2bacvFa/9K2g
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 06/16/2015 09:40 AM, Silvan Wicki wrote:
> The Datasheet mentions on page 31 that the bits 10-31 must be read as
> don't care and written as 0.
> https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
> 
> We cannot guarantee that we reed bits 10-31 as always 0 (becuase the
> datasheet says read as don't care). We clear the bits with a bitmask to
> prevent writing back unknown data at the reserved bits.

I guess that's true.
Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

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

* Re: [PATCH] i2c: busses: i2c-bcm2835: S-Register clear reserved bits
       [not found] ` <1434469259-6474-1-git-send-email-linux_wi-ADq4ffItWIY@public.gmane.org>
  2015-06-17  1:34   ` Stephen Warren
@ 2015-06-17 12:10   ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2015-06-17 12:10 UTC (permalink / raw)
  To: Silvan Wicki
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

On Tue, Jun 16, 2015 at 05:40:59PM +0200, Silvan Wicki wrote:
> The Datasheet mentions on page 31 that the bits 10-31 must be read as
> don't care and written as 0.
> https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
> 
> We cannot guarantee that we reed bits 10-31 as always 0 (becuase the
> datasheet says read as don't care). We clear the bits with a bitmask to
> prevent writing back unknown data at the reserved bits.
> 
> Signed-off-by: Silvan Wicki <linux_wi-ADq4ffItWIY@public.gmane.org>

Applied to for-next, thanks!

If possible, use a spell checker on your commit message.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-06-17 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16 15:40 [PATCH] i2c: busses: i2c-bcm2835: S-Register clear reserved bits Silvan Wicki
     [not found] ` <1434469259-6474-1-git-send-email-linux_wi-ADq4ffItWIY@public.gmane.org>
2015-06-17  1:34   ` Stephen Warren
2015-06-17 12:10   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.