Skip to content

Commit

Permalink
overlays: mcp23017: allow specification of the i2c bus
Browse files Browse the repository at this point in the history
Analogous to i2c-rtc-overlay.dts

See: #5650
  • Loading branch information
janisstreib authored and popcornmix committed Oct 30, 2023
1 parent 4f02247 commit 4e2c6cf
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 17 deletions.
10 changes: 10 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,16 @@ Params: gpiopin Gpio pin connected to the INTA output of the

mcp23008 Configure an MCP23008 instead.
noints Disable the interrupt GPIO line.
i2c0 Choose the I2C0 bus on GPIOs 0&1
i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
i2c3 Choose the I2C3 bus (configure with the i2c3
overlay - BCM2711 only)
i2c4 Choose the I2C4 bus (configure with the i2c4
overlay - BCM2711 only)
i2c5 Choose the I2C5 bus (configure with the i2c5
overlay - BCM2711 only)
i2c6 Choose the I2C6 bus (configure with the i2c6
overlay - BCM2711 only)


Name: mcp23s17
Expand Down
68 changes: 51 additions & 17 deletions arch/arm/boot/dts/overlays/mcp23017-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
compatible = "brcm,bcm2835";

fragment@0 {
target = <&i2c1>;
target = <&i2cbus>;
__overlay__ {
status = "okay";
};
Expand All @@ -24,13 +24,33 @@
};

fragment@2 {
target = <&i2c1>;
target = <&mcp23017>;
__dormant__ {
compatible = "microchip,mcp23008";
};
};

fragment@3 {
target = <&mcp23017>;
mcp23017_irq: __overlay__ {
#interrupt-cells=<2>;
interrupt-parent = <&gpio>;
interrupts = <4 2>;
interrupt-controller;
microchip,irq-mirror;
};
};

fragment@4 {
target = <&i2cbus>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

mcp23017: mcp@20 {
compatible = "microchip,mcp23017";
pinctrl-name = "default";
pinctrl-0 = <&mcp23017_pins>;
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
Expand All @@ -40,30 +60,44 @@
};
};

fragment@3 {
target = <&mcp23017>;
__dormant__ {
compatible = "microchip,mcp23008";
frag100: fragment@100 {
target = <&i2c1>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@4 {
target = <&mcp23017>;
mcp23017_irq: __overlay__ {
#interrupt-cells=<2>;
interrupt-parent = <&gpio>;
interrupts = <4 2>;
interrupt-controller;
microchip,irq-mirror;
};
fragment@101 {
target = <&i2c0if>;
__dormant__ {
status = "okay";
};
};

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

__overrides__ {
gpiopin = <&mcp23017_pins>,"brcm,pins:0",
<&mcp23017_irq>,"interrupts:0";
addr = <&mcp23017>,"reg:0", <&mcp23017_pins>,"reg:0";
mcp23008 = <0>,"=3";
noints = <0>,"!1!4";
mcp23008 = <0>,"=2";
noints = <0>,"!1!3";
i2c0 = <&frag100>, "target:0=",<&i2c0>;
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
<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";
};
};

0 comments on commit 4e2c6cf

Please sign in to comment.