Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlays: Factor out the common i2c bus selection #6636

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 50 additions & 214 deletions arch/arm/boot/dts/overlays/README

Large diffs are not rendered by default.

38 changes: 2 additions & 36 deletions arch/arm/boot/dts/overlays/ads1115-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/dts-v1/;
/plugin/;

#include "i2c-buses.dtsi"

/ {
compatible = "brcm,bcm2835";

Expand Down Expand Up @@ -81,27 +83,6 @@
};
};

frag100: fragment@100 {
target = <&i2c1>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@101 {
target = <&i2c0if>;
__dormant__ {
status = "okay";
};
};

fragment@102 {
target = <&i2c0mux>;
__dormant__ {
status = "okay";
};
};

__overrides__ {
addr = <&ads1115>,"reg:0";
cha_enable = <0>,"=0";
Expand All @@ -120,20 +101,5 @@
chd_cfg = <&channel_d>,"reg:0";
chd_gain = <&channel_d>,"ti,gain:0";
chd_datarate = <&channel_d>,"ti,datarate:0";
i2c0 = <&frag100>, "target:0=",<&i2c0>;
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
<0>,"+101+102";
i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>,
<0>,"+101+102";
i2c3 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c3";
i2c4 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c4";
i2c5 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c5";
i2c6 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c6";
i2c-path = <&frag100>, "target?=0",
<&frag100>, "target-path";
};
};
39 changes: 6 additions & 33 deletions arch/arm/boot/dts/overlays/edt-ft5406-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,16 @@
/dts-v1/;
/plugin/;

#define ENABLE_I2C0_MUX
#include "i2c-buses.dtsi"
#include "edt-ft5406.dtsi"

/ {
fragment@0 {
target = <&i2c0if>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&i2c0mux>;
__overlay__ {
status = "okay";
};
};
&busfrag {
target = <&i2c_csi_dsi>;
};

/ {
__overrides__ {
i2c0 = <&ts_i2c_frag>,"target:0=",<&i2c0>;
i2c1 = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path=i2c1",
<0>,"-0-1";
i2c3 = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path=i2c3",
<0>,"-0-1";
i2c4 = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path=i2c4",
<0>,"-0-1";
i2c5 = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path=i2c5",
<0>,"-0-1";
i2c6 = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path=i2c6",
<0>,"-0-1";
i2c-path = <&ts_i2c_frag>, "target?=0",
<&ts_i2c_frag>, "target-path",
<0>,"-0-1";
addr = <&ft5406>,"reg:0";
};
};
5 changes: 2 additions & 3 deletions arch/arm/boot/dts/overlays/edt-ft5406.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
};
};

ts_i2c_frag: fragment@12 {
target = <&i2c_csi_dsi>;
fragment@12 {
target = <&i2cbus>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

ft5406: ts@38 {
compatible = "edt,edt-ft5506";
Expand Down
67 changes: 67 additions & 0 deletions arch/arm/boot/dts/overlays/i2c-buses.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Common i2c buses, and dtparams to select them

/ {
compatible = "brcm,bcm2835";

busfrag: fragment@100 {
target = <&i2c_arm>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@101 {
target = <&i2c0if>;
#ifdef ENABLE_I2C0_MUX
__overlay__ {
#else
__dormant__ {
#endif
status = "okay";
};
};

fragment@102 {
target = <&i2c0mux>;
#ifdef ENABLE_I2C0_MUX
__overlay__ {
#else
__dormant__ {
#endif
status = "okay";
};
};

__overrides__ {
i2c0 = <&busfrag>,"target:0=",<&i2c0>,
<&busfrag>, "target-path?=0",
<0>,"+101+102";
i2c_csi_dsi = <&busfrag>,"target:0=",<&i2c_csi_dsi>,
<&busfrag>, "target-path?=0",
<0>,"+101+102";
i2c_csi_dsi0 = <&busfrag>, "target:0=",<&i2c_csi_dsi0>,
<&busfrag>, "target-path?=0",
<0>,"+101+102";
i2c1 = <&busfrag>,"target:0=",<&i2c1>,
<&busfrag>, "target-path?=0",
<0>,"-101-102";
i2c2 = <&busfrag>, "target?=0",
<&busfrag>, "target-path=i2c2",
<0>,"-101-102";
i2c3 = <&busfrag>, "target?=0",
<&busfrag>, "target-path=i2c3",
<0>,"-101-102";
i2c4 = <&busfrag>, "target?=0",
<&busfrag>, "target-path=i2c4",
<0>,"-101-102";
i2c5 = <&busfrag>, "target?=0",
<&busfrag>, "target-path=i2c5",
<0>,"-101-102";
i2c6 = <&busfrag>, "target?=0",
<&busfrag>, "target-path=i2c6",
<0>,"-101-102";
i2c-path = <&busfrag>, "target?=0",
<&busfrag>, "target-path",
<0>,"-101-102";
};
};
45 changes: 5 additions & 40 deletions arch/arm/boot/dts/overlays/i2c-fan-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <dt-bindings/thermal/thermal.h>

#include "i2c-buses.dtsi"

/ {
compatible = "brcm,bcm2835";

Expand All @@ -17,41 +19,19 @@
emc2301: emc2301@2f {
compatible = "microchip,emc2301";
reg = <0x2f>;
status = "okay";
#cooling-cells = <0x02>;
};
};
};

frag100: fragment@100 {
target = <&i2c_arm>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@101 {
target = <&i2c0if>;
__dormant__ {
status = "okay";
};
};

fragment@102 {
target = <&i2c0mux>;
__dormant__ {
status = "okay";
};
};

fragment@103 {
fragment@1 {
target = <&cpu_thermal>;
__overlay__ {
polling-delay = <2000>; /* milliseconds */
};
};

fragment@104 {
fragment@2 {
target = <&thermal_trips>;
__overlay__ {
fanmid0: fanmid0 {
Expand All @@ -67,7 +47,7 @@
};
};

fragment@105 {
fragment@3 {
target = <&cooling_maps>;
__overlay__ {
map0: map0 {
Expand All @@ -82,21 +62,6 @@
};

__overrides__ {
i2c0 = <&frag100>,"target:0=",<&i2c0>;
i2c_csi_dsi = <&frag100>,"target:0=",<&i2c_csi_dsi>,
<0>,"+101+102";
i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>,
<0>,"+101+102";
i2c3 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c3";
i2c4 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c4";
i2c5 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c5";
i2c6 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c6";
i2c-path = <&frag100>, "target?=0",
<&frag100>, "target-path";
addr = <&emc2301>,"reg:0";
minpwm = <&emc2301>,"emc2305,pwm-min.0";
maxpwm = <&emc2301>,"emc2305,pwm-max.0";
Expand Down
42 changes: 2 additions & 40 deletions arch/arm/boot/dts/overlays/i2c-mux-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <dt-bindings/mux/mux.h>

#include "i2c-buses.dtsi"

/{
compatible = "brcm,bcm2835";

Expand All @@ -13,7 +15,6 @@
__dormant__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

pca9542: mux@70 {
compatible = "nxp,pca9542";
Expand All @@ -40,7 +41,6 @@
__dormant__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

pca9545: mux@70 {
compatible = "nxp,pca9545";
Expand Down Expand Up @@ -77,7 +77,6 @@
__dormant__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

pca9548: mux@70 {
compatible = "nxp,pca9548";
Expand Down Expand Up @@ -129,27 +128,6 @@
};
};

frag100: fragment@100 {
target = <&i2c_arm>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@101 {
target = <&i2c0if>;
__dormant__ {
status = "okay";
};
};

fragment@102 {
target = <&i2c0mux>;
__dormant__ {
status = "okay";
};
};

__overrides__ {
pca9542 = <0>, "+0";
pca9545 = <0>, "+1";
Expand All @@ -163,22 +141,6 @@
<&pca9545>,"base-nr:0",
<&pca9548>,"base-nr:0";

i2c0 = <&frag100>, "target:0=",<&i2c0>,
<0>,"+101+102";
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
<0>,"+101+102";
i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>,
<0>,"+101+102";
i2c3 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c3";
i2c4 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c4";
i2c5 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c5";
i2c6 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c6";
i2c-path = <&frag100>, "target?=0",
<&frag100>, "target-path";
disconnect_on_idle =
<&pca9542>,"idle-state:0=", <MUX_IDLE_DISCONNECT>,
<&pca9545>,"idle-state:0=", <MUX_IDLE_DISCONNECT>,
Expand Down
Loading