Skip to content

Commit

Permalink
dt: Implement an I2C pinctrl mux for BSC0.
Browse files Browse the repository at this point in the history
BSC0 serves either the HAT EEPROM pins on the 40pin connector,
or the display and camera on a board specific pairing of either
GPIO 28&29, or 44&45.

Use I2C_MUX_PINCTRL to allow exposing both pairs of pins as I2C
busses.

Signed-off-by: Dave Stevenson <[email protected]>
  • Loading branch information
6by9 committed Apr 21, 2020
1 parent 9f10313 commit 30cc4f3
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 81 deletions.
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
Expand All @@ -21,11 +22,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -68,9 +64,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
15 changes: 7 additions & 8 deletions arch/arm/boot/dts/bcm2708-rpi-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-smsc9512.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
Expand All @@ -21,11 +22,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand All @@ -42,6 +38,11 @@
};
};

&i2c0mux {
pinctrl-0;
pinctrl-1 = <&i2c0_gpio28>;
};

&uart0 {
status = "okay";
};
Expand All @@ -68,9 +69,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2708-rpi-cm.dts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "bcm2708-rpi-cm.dtsi"
#include "bcm283x-rpi-csi0-2lane.dtsi"
#include "bcm283x-rpi-csi1-4lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,compute-module", "brcm,bcm2835";
Expand All @@ -24,11 +25,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -67,9 +63,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "bcm2708.dtsi"
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
Expand Down Expand Up @@ -30,11 +31,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -116,9 +112,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2709-rpi-2-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2709-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
Expand All @@ -21,11 +22,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -68,9 +64,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
7 changes: 4 additions & 3 deletions arch/arm/boot/dts/bcm270x-rpi.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
i2s = &i2s;
i2c0 = &i2c0;
i2c1 = &i2c1;
i2c9 = &i2c_csi_dsi;
spi0 = &spi0;
spi1 = &spi1;
spi2 = &spi2;
Expand Down Expand Up @@ -83,9 +84,9 @@
uart1 = <&uart1>,"status";
i2s = <&i2s>,"status";
spi = <&spi0>,"status";
i2c0 = <&i2c0>,"status";
i2c0 = <&i2c0if>,"status",<&i2c0mux>,"status";
i2c1 = <&i2c1>,"status";
i2c0_baudrate = <&i2c0>,"clock-frequency:0";
i2c0_baudrate = <&i2c0if>,"clock-frequency:0";
i2c1_baudrate = <&i2c1>,"clock-frequency:0";

audio = <&audio>,"status";
Expand All @@ -105,7 +106,7 @@
status = "disabled";
};

&i2c0 {
&i2c0if {
status = "disabled";
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2710-rpi-2-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2709-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"

/ {
compatible = "raspberrypi,2-model-b-rev2", "brcm,bcm2837";
Expand All @@ -21,11 +22,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -68,9 +64,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2709-rpi.dtsi"
#include "bcm283x-rpi-lan7515.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"

/ {
compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
Expand Down Expand Up @@ -31,11 +32,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -126,9 +122,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
10 changes: 2 additions & 8 deletions arch/arm/boot/dts/bcm2710-rpi-3-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "bcm2709-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"

/ {
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
Expand Down Expand Up @@ -31,11 +32,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -137,9 +133,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
11 changes: 2 additions & 9 deletions arch/arm/boot/dts/bcm2710-rpi-cm3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "bcm2709-rpi.dtsi"
#include "bcm283x-rpi-csi0-2lane.dtsi"
#include "bcm283x-rpi-csi1-4lane.dtsi"

#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,3-compute-module", "brcm,bcm2837";
model = "Raspberry Pi Compute Module 3";
Expand All @@ -25,11 +25,6 @@
brcm,function = <1>; /* output */
};

i2c0_pins: i2c0 {
brcm,pins = <0 1>;
brcm,function = <4>;
};

i2c1_pins: i2c1 {
brcm,pins = <2 3>;
brcm,function = <4>;
Expand Down Expand Up @@ -88,9 +83,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
5 changes: 2 additions & 3 deletions arch/arm/boot/dts/bcm2711-rpi-4-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@

#include "bcm2711-rpi.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"

/delete-node/ &emmc2;

Expand Down Expand Up @@ -421,9 +422,7 @@
};
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
&i2c0if {
clock-frequency = <100000>;
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/dts/bcm2711.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@
alloc-ranges = <0x0 0x00000000 0x40000000>;
};

&i2c0 {
&i2c0if {
compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
};
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
&i2c0mux {
pinctrl-0 = <&i2c0_gpio0>;
pinctrl-1 = <&i2c0_gpio28>;
};
4 changes: 4 additions & 0 deletions arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
&i2c0mux {
pinctrl-0 = <&i2c0_gpio0>;
pinctrl-1 = <&i2c0_gpio44>;
};
26 changes: 25 additions & 1 deletion arch/arm/boot/dts/bcm283x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
status = "disabled";
};

i2c0: i2c@7e205000 {
i2c0if: i2c@7e205000 {
compatible = "brcm,bcm2835-i2c";
reg = <0x7e205000 0x200>;
interrupts = <2 21>;
Expand All @@ -350,6 +350,30 @@
status = "disabled";
};

i2c0mux: i2c0mux {
compatible = "i2c-mux-pinctrl";
#address-cells = <1>;
#size-cells = <0>;

i2c-parent = <&i2c0if>;

pinctrl-names = "i2c0", "i2c_csi_dsi";

status = "disabled";

i2c0: i2c@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
};

i2c_csi_dsi: i2c@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
};
};

dpi: dpi@7e208000 {
compatible = "brcm,bcm2835-dpi";
reg = <0x7e208000 0x8c>;
Expand Down

0 comments on commit 30cc4f3

Please sign in to comment.