DTB backward/forward compatibility with "pinctrl: bcm2835: Change init order for gpio hogs"

Stefan Wahren stefan.wahren at i2se.com
Mon Mar 7 03:38:31 PST 2022


Hi,

Am 06.03.22 um 17:54 schrieb Florian Fainelli:
> Hi Stefan,
>
> On 3/6/2022 7:03 AM, Stefan Wahren wrote:
>> Hi Florian,
>>
>> it seems that other platform stumbled on the same issue:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20220304&id=9b4924da4711674e62d97d4f5360446cc78337af
>>
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20220304&id=7ed07855773814337b9814f1c3e866df52ebce68
>>
>>
>> I will try to prepare a patch.
>
> Thank you! Do you think we could have a core function expose which
> would do essentially avoid drivers having to sprinkle checks for the
> absence of a 'gpio-ranges' property?

unfortunately my first attempts to implement it similiar to the
solutions above failed. I read the explanations from the original fix
from Christian Lamparter [1] and from my understanding the backward
compatibility must be implemented into gpiochip_add_data() or a variant.
Before the gpiochip is not registered and afterwards it would be too late.

My test scenario (worst case) is an additional gpio hog for the
Raspberry Pi 3 B with removed gpio-ranges:

diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
index e12938b..a5163cc 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
@@ -123,6 +123,14 @@
                          "SD_DATA1_R",
                          "SD_DATA2_R",
                          "SD_DATA3_R";
+
+       ant1: ant1-hog {
+               gpio-hog;
+               gpios = <23 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "ant1";
+       };
 };
 
 &hdmi {
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index c113661..4b65954 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -126,7 +126,7 @@
                        interrupt-controller;
                        #interrupt-cells = <2>;
 
-                       gpio-ranges = <&gpio 0 0 54>;
+                       // gpio-ranges = <&gpio 0 0 54>;
 
                        /* Defines common pin muxing groups
                         *

[1] -
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20220307&id=a86caa9ba5d70696ceb35d1d39caa20d8b641387


More information about the linux-arm-kernel mailing list