diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-16 23:40:32 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-17 15:11:22 +0200 |
commit | 20ea6adbf199097c4f5f591ffee088340630dae4 (patch) | |
tree | d6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch | |
parent | bca05bd072180dc38ef740b37ded9572a6db1981 (diff) | |
download | upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2 upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip |
bcm27xx: add support for linux v5.15
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch b/target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch new file mode 100644 index 0000000000..f1404f4a92 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.15/950-0676-i2c-bcm2835-Make-clock-stretch-timeout-configurable.patch @@ -0,0 +1,44 @@ +From 8387866a1d91c78d9aa75052821b1dafa25fff0f Mon Sep 17 00:00:00 2001 +From: Alex Crawford <raspberrypi/linux@code.acrawford.com> +Date: Fri, 28 Jan 2022 13:36:51 -0800 +Subject: [PATCH] i2c: bcm2835: Make clock-stretch timeout configurable + +The default clock-stretch timeout is 35 mS, which works well for +SMBus, but there are some I2C devices which can stretch the clock even +longer. Rather than trying to prescribe a safe default for everyone, +allow the timeout to be configured. + +Signed-off-by: Alex Crawford <raspberrypi/linux@code.acrawford.com> +--- + drivers/i2c/busses/i2c-bcm2835.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-bcm2835.c ++++ b/drivers/i2c/busses/i2c-bcm2835.c +@@ -60,6 +60,10 @@ static unsigned int debug; + module_param(debug, uint, 0644); + MODULE_PARM_DESC(debug, "1=err, 2=isr, 3=xfer"); + ++static unsigned int clk_tout_ms = 35; /* SMBUs-recommended 35ms */ ++module_param(clk_tout_ms, uint, 0644); ++MODULE_PARM_DESC(clk_tout_ms, "clock-stretch timeout (mS)"); ++ + #define BCM2835_DEBUG_MAX 512 + struct bcm2835_debug { + struct i2c_msg *msg; +@@ -219,12 +223,12 @@ static int clk_bcm2835_i2c_set_rate(stru + (redl << BCM2835_I2C_REDL_SHIFT)); + + /* +- * Set the clock stretch timeout to the SMBUs-recommended 35ms. ++ * Set the clock stretch timeout. + */ +- if (rate > 0xffff*1000/35) ++ if (rate > 0xffff*1000/clk_tout_ms) + clk_tout = 0xffff; + else +- clk_tout = 35*rate/1000; ++ clk_tout = clk_tout_ms*rate/1000; + + bcm2835_i2c_writel(div->i2c_dev, BCM2835_I2C_CLKT, clk_tout); + |