Skip to content
Permalink
Browse files

i2c: bcm2835: Clear the clock stretching timeout at boot.

The register at poweron contains 0x40, which at our typical 100khz bus
rate means .64ms.  There is no specified limit to how long devices
should be able to stretch the clocks, so just disable the timeout.  We
still have a timeout wrapping the entire transfer.

Signed-off-by: Eric Anholt <eric@anholt.net>
  • Loading branch information...
anholt committed Jun 1, 2016
1 parent fdbbc1f commit 894200276239d2e4c60b378bdc52164fcb13af8d
Showing with 12 additions and 0 deletions.
  1. +12 −0 drivers/i2c/busses/i2c-bcm2835.c
@@ -28,6 +28,11 @@
#define BCM2835_I2C_FIFO 0x10
#define BCM2835_I2C_DIV 0x14
#define BCM2835_I2C_DEL 0x18
/*
* 16-bit field for the number of SCL cycles to wait after rising SCL
* before deciding the slave is not responding. 0 disables the
* timeout detection.
*/
#define BCM2835_I2C_CLKT 0x1c

#define BCM2835_I2C_C_READ BIT(0)
@@ -281,6 +286,13 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
}
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);

/*
* Disable the hardware clock stretching timeout. SMBUS
* specifies a limit for how long the device can stretch the
* clock, but core I2C doesn't.
*/
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0);

irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq) {
dev_err(&pdev->dev, "No IRQ resource\n");

0 comments on commit 8942002

Please sign in to comment.
You can’t perform that action at this time.