From 62b7f5931c54e96fca56dd8761b0e466d355c881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 18 Feb 2021 18:04:33 +0100 Subject: bcm27xx: import latest patches from the RPi foundation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas (cherry-picked from commit f07e572f64) --- ...erlays-i2c-gpio-Avoid-open-drain-warnings.patch | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.4/950-0764-overlays-i2c-gpio-Avoid-open-drain-warnings.patch (limited to 'target/linux/bcm27xx/patches-5.4/950-0764-overlays-i2c-gpio-Avoid-open-drain-warnings.patch') diff --git a/target/linux/bcm27xx/patches-5.4/950-0764-overlays-i2c-gpio-Avoid-open-drain-warnings.patch b/target/linux/bcm27xx/patches-5.4/950-0764-overlays-i2c-gpio-Avoid-open-drain-warnings.patch new file mode 100644 index 0000000000..9b6cb1d564 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.4/950-0764-overlays-i2c-gpio-Avoid-open-drain-warnings.patch @@ -0,0 +1,93 @@ +From 11f89a12530471a2b25c71416e106eaa014818c0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 5 Jun 2020 16:07:07 +0100 +Subject: [PATCH] overlays: i2c-gpio: Avoid open-drain warnings + +The i2c-gpio driver expects to use a GPIO in open-drain mode. Failure +to configure it in that way causes alarming warnings in the kernel log. +The BCM283x and BCM2711 GPIO blocks don't support open-drain mode, but +gpiolib can emulate it in software if configured correctly. + +Silence the warning by declaring the GPIOs as requiring open-drain +mode, trusting gpiolib to manage the emulation. The previous +incarnation of this patch took the other approach of telling the +i2c-gpio driver that the GPIOs were configured for open-drain, but +this had the effect of disabling the emulation. In some cases this +appears to work, but examining the waveforms as analogue voltages +shows contention, the success or failure depending on drive strengths. + +See: https://github.com/raspberrypi/firmware/issues/1381 +See: https://github.com/raspberrypi/firmware/issues/1401 + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/balena-fin-overlay.dts | 5 ++++- + arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 6 ++++-- + arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts | 6 ++++-- + 3 files changed, 12 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/overlays/balena-fin-overlay.dts ++++ b/arch/arm/boot/dts/overlays/balena-fin-overlay.dts +@@ -1,6 +1,8 @@ + /dts-v1/; + /plugin/; + ++#include ++ + /{ + compatible = "brcm,bcm2835"; + +@@ -48,7 +50,8 @@ + + i2c_soft: i2c@0 { + compatible = "i2c-gpio"; +- gpios = <&gpio 43 0 /* sda */ &gpio 42 0 /* scl */>; ++ gpios = <&gpio 43 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* sda */ ++ &gpio 42 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* scl */>; + i2c-gpio,delay-us = <5>; + i2c-gpio,scl-open-drain; + i2c-gpio,sda-open-drain; +--- a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts +@@ -2,6 +2,8 @@ + /dts-v1/; + /plugin/; + ++#include ++ + / { + compatible = "brcm,bcm2835"; + +@@ -12,8 +14,8 @@ + i2c_gpio: i2c@0 { + reg = <0xffffffff>; + compatible = "i2c-gpio"; +- gpios = <&gpio 23 0 /* sda */ +- &gpio 24 0 /* scl */ ++ gpios = <&gpio 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* sda */ ++ &gpio 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* scl */ + >; + i2c-gpio,delay-us = <2>; /* ~100 kHz */ + #address-cells = <1>; +--- a/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts +@@ -3,6 +3,8 @@ + /dts-v1/; + /plugin/; + ++#include ++ + / { + compatible = "brcm,bcm2835"; + +@@ -11,8 +13,8 @@ + __overlay__ { + i2c_gpio: i2c-gpio-rtc@0 { + compatible = "i2c-gpio"; +- gpios = <&gpio 23 0 /* sda */ +- &gpio 24 0 /* scl */ ++ gpios = <&gpio 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* sda */ ++ &gpio 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* scl */ + >; + i2c-gpio,delay-us = <2>; /* ~100 kHz */ + #address-cells = <1>; -- cgit v1.2.3