Skip to content

Commit 4dbfb5f

Browse files
cornaWolfram Sang
authored andcommitted
i2c: bcm2835: add I2C_AQ_NO_CLK_STRETCH
As reported in the links given below. the BCM2835 has a hardware bug in its i2c module which prevents a correct clock stretching. This patch adds the I2C_AQ_NO_CLK_STRETCH quirk flag to i2c-bcm2835. Signed-off-by: Nicola Corna <nicola@corna.info> [wsa: put the links into the code as comments] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent a94d306 commit 4dbfb5f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/i2c/busses/i2c-bcm2835.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ static const struct i2c_algorithm bcm2835_i2c_algo = {
222222
.functionality = bcm2835_i2c_func,
223223
};
224224

225+
/*
226+
* This HW was reported to have problems with clock stretching:
227+
* http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html
228+
* https://www.raspberrypi.org/forums/viewtopic.php?p=146272
229+
*/
230+
static const struct i2c_adapter_quirks bcm2835_i2c_quirks = {
231+
.flags = I2C_AQ_NO_CLK_STRETCH,
232+
};
233+
225234
static int bcm2835_i2c_probe(struct platform_device *pdev)
226235
{
227236
struct bcm2835_i2c_dev *i2c_dev;
@@ -293,6 +302,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
293302
adap->algo = &bcm2835_i2c_algo;
294303
adap->dev.parent = &pdev->dev;
295304
adap->dev.of_node = pdev->dev.of_node;
305+
adap->quirks = &bcm2835_i2c_quirks;
296306

297307
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);
298308

0 commit comments

Comments
 (0)