Skip to contentSkip to conversation

i2c: busses: i2c-bcm2835: S-Register clear reserved bits

PATCH Applied Silvan Wicki 3 participants 3 messages Jun 16, 2015 – Jun 17, 2015 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: busses: i2c-bcm2835: S-Register clear reserved bits

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.

---
 drivers/i2c/busses/i2c-bcm2835.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-bcm2835.c +3 -0
index c9336a3..aa06da1 100644
@@ -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);
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): 1434469259-6474-1-git-send-email-linux_wi-ADq4ffItWIY@public.gmane.org

#2 lore raw
Quoted 7 lines · Silvan Wicki

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.

Applied
#3 lore raw
In reply to a message not in the archive
Quoted 9 lines · Silvan Wicki

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.

Applied to for-next, thanks!

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