bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-1051-fixup-overlays-mcp23017-allow-specification-of-the-i.patch
1 From 3ed6d34d53e94ecbebc64c8fa3d1b6d3c41db8fb Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Tue, 24 Oct 2023 09:58:52 +0100
4 Subject: [PATCH] fixup! overlays: mcp23017: allow specification of the i2c bus
5
6 The incorrect fragment order (*) caused broke the interrupt usage, and
7 while it was being fixed the lack of a reference to the pinctrl
8 declaration was noticed.
9
10 See: https://github.com/raspberrypi/linux/issues/5677
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
13
14 (*) Ideally all fragments would appear in the file in the order in which
15 they should be merged, but that is easy to forget and can be awkward, so
16 the firmware merges all "intra" fragments (those that target other
17 fragments in the overlay) before "inter" fragments (those that target
18 the base DTB). However, intra fragments that target other intra
19 fragments is a level of nesting too far for this logic to cope, so they
20 must appear before the fragments they target.
21 ---
22 .../boot/dts/overlays/mcp23017-overlay.dts | 42 ++++++++++---------
23 1 file changed, 22 insertions(+), 20 deletions(-)
24
25 --- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
26 +++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
27 @@ -24,30 +24,13 @@
28 };
29
30 fragment@2 {
31 - target = <&i2cbus>;
32 - __overlay__ {
33 - #address-cells = <1>;
34 - #size-cells = <0>;
35 -
36 - mcp23017: mcp@20 {
37 - compatible = "microchip,mcp23017";
38 - reg = <0x20>;
39 - gpio-controller;
40 - #gpio-cells = <2>;
41 -
42 - status = "okay";
43 - };
44 - };
45 - };
46 -
47 - fragment@3 {
48 target = <&mcp23017>;
49 __dormant__ {
50 compatible = "microchip,mcp23008";
51 };
52 };
53
54 - fragment@4 {
55 + fragment@3 {
56 target = <&mcp23017>;
57 mcp23017_irq: __overlay__ {
58 #interrupt-cells=<2>;
59 @@ -58,6 +41,25 @@
60 };
61 };
62
63 + fragment@4 {
64 + target = <&i2cbus>;
65 + __overlay__ {
66 + #address-cells = <1>;
67 + #size-cells = <0>;
68 +
69 + mcp23017: mcp@20 {
70 + compatible = "microchip,mcp23017";
71 + pinctrl-name = "default";
72 + pinctrl-0 = <&mcp23017_pins>;
73 + reg = <0x20>;
74 + gpio-controller;
75 + #gpio-cells = <2>;
76 +
77 + status = "okay";
78 + };
79 + };
80 + };
81 +
82 frag100: fragment@100 {
83 target = <&i2c1>;
84 i2cbus: __overlay__ {
85 @@ -83,8 +85,8 @@
86 gpiopin = <&mcp23017_pins>,"brcm,pins:0",
87 <&mcp23017_irq>,"interrupts:0";
88 addr = <&mcp23017>,"reg:0", <&mcp23017_pins>,"reg:0";
89 - mcp23008 = <0>,"=3";
90 - noints = <0>,"!1!4";
91 + mcp23008 = <0>,"=2";
92 + noints = <0>,"!1!3";
93 i2c0 = <&frag100>, "target:0=",<&i2c0>;
94 i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
95 <0>,"+101+102";