8cb35e1a79d19ab09c3b3dbd00bcfe0415765b95
[openwrt/staging/pepe2k.git] /
1 From 27f0e0e195568c06f21ce380f0736bdd219baf3c Mon Sep 17 00:00:00 2001
2 From: Janis Streib <janis+github@dogcraft.de>
3 Date: Sun, 15 Oct 2023 21:08:40 +0200
4 Subject: [PATCH] overlays: mcp23017: allow specification of the i2c bus
5
6 Analogous to i2c-rtc-overlay.dts
7
8 See: https://github.com/raspberrypi/linux/pull/5650
9 ---
10 arch/arm/boot/dts/overlays/README | 10 ++++++
11 .../boot/dts/overlays/mcp23017-overlay.dts | 36 +++++++++++++++++--
12 2 files changed, 44 insertions(+), 2 deletions(-)
13
14 --- a/arch/arm/boot/dts/overlays/README
15 +++ b/arch/arm/boot/dts/overlays/README
16 @@ -2810,6 +2810,16 @@ Params: gpiopin Gpio pin
17
18 mcp23008 Configure an MCP23008 instead.
19 noints Disable the interrupt GPIO line.
20 + i2c0 Choose the I2C0 bus on GPIOs 0&1
21 + i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
22 + i2c3 Choose the I2C3 bus (configure with the i2c3
23 + overlay - BCM2711 only)
24 + i2c4 Choose the I2C4 bus (configure with the i2c4
25 + overlay - BCM2711 only)
26 + i2c5 Choose the I2C5 bus (configure with the i2c5
27 + overlay - BCM2711 only)
28 + i2c6 Choose the I2C6 bus (configure with the i2c6
29 + overlay - BCM2711 only)
30
31
32 Name: mcp23s17
33 --- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
34 +++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts
35 @@ -7,7 +7,7 @@
36 compatible = "brcm,bcm2835";
37
38 fragment@0 {
39 - target = <&i2c1>;
40 + target = <&i2cbus>;
41 __overlay__ {
42 status = "okay";
43 };
44 @@ -24,7 +24,7 @@
45 };
46
47 fragment@2 {
48 - target = <&i2c1>;
49 + target = <&i2cbus>;
50 __overlay__ {
51 #address-cells = <1>;
52 #size-cells = <0>;
53 @@ -58,12 +58,44 @@
54 };
55 };
56
57 + frag100: fragment@100 {
58 + target = <&i2c1>;
59 + i2cbus: __overlay__ {
60 + status = "okay";
61 + };
62 + };
63 +
64 + fragment@101 {
65 + target = <&i2c0if>;
66 + __dormant__ {
67 + status = "okay";
68 + };
69 + };
70 +
71 + fragment@102 {
72 + target = <&i2c0mux>;
73 + __dormant__ {
74 + status = "okay";
75 + };
76 + };
77 +
78 __overrides__ {
79 gpiopin = <&mcp23017_pins>,"brcm,pins:0",
80 <&mcp23017_irq>,"interrupts:0";
81 addr = <&mcp23017>,"reg:0", <&mcp23017_pins>,"reg:0";
82 mcp23008 = <0>,"=3";
83 noints = <0>,"!1!4";
84 + i2c0 = <&frag100>, "target:0=",<&i2c0>;
85 + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
86 + <0>,"+101+102";
87 + i2c3 = <&frag100>, "target?=0",
88 + <&frag100>, "target-path=i2c3";
89 + i2c4 = <&frag100>, "target?=0",
90 + <&frag100>, "target-path=i2c4";
91 + i2c5 = <&frag100>, "target?=0",
92 + <&frag100>, "target-path=i2c5";
93 + i2c6 = <&frag100>, "target?=0",
94 + <&frag100>, "target-path=i2c6";
95 };
96 };
97