[RFC] ARM: dts: Add i2cmux-pinctrl config to Raspberry Pi i2c-0
Dave Stevenson
dave.stevenson at raspberrypi.org
Mon Nov 20 06:09:20 PST 2017
The first i2c controller on the Raspberry Pi family can
be pinmuxed to either GPIOs 0&1, 28&29, or 44&45.
The default has always been 0&1 as those are exposed on
the 40 pin GPIO header of the more recent models.
GPIOs 28&29 on Pi 0/1/2/3 and GPIOs 44&45 on Pi3 are
used for i2c to the DSI display and the camera module.
The i2c-mux-pinctrl driver allows pinctrl setup to be used
to expose the GPIO sets as alternate i2c adapters. This
patch configures that driver to expose two adapters -
i2c0 on GPIOs 0&1, and i2c_csi_dsi on the correct GPIOs for
the camera and display.
(This could be extended to expose all 3 options on the CM
and CM3, but there isn't a pressing case for that at present).
The one quirk with the i2cmux-pinctrl driver is that the
parent controller still exists as an i2c adapter which
will be connnected to whichever pins were last requested
(or an optional idle setting). That adapter appears first so
is numbered as adapter 0, whilst the child ports end up as
adapters 3&4. These can be renumbered through using DT aliases
if we wish to retain the ordering of adapters (this will be
required downstream).
Signed-off-by: Dave Stevenson <dave.stevenson at raspberrypi.org>
---
Hi All.
Thoughts from people?
Do others care about access to the alternate pin muxing options for BSC0?
Is the location of these changes acceptable?
Objections on naming of nodes?
To get back to the current adapter numbering, an aliases section
such as
/ {
aliases {
i2c10 = &i2c0_parent;
i2c0 = &i2c0;
i2c1 = &i2c1;
i2c2 = &i2c2;
i2c4 = &i2c_csi_dsi;
};
};
is needed somewhere. Yes i2c1 and i2c2 are needed otherwise they
become i2c11 and i2c12 as dynamically numbered adapters come after
all statically defined ones.
Thanks
Dave
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-a.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-zero.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 +---
arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 1 +
arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 1 +
arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi | 4 ++++
arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi | 4 ++++
arch/arm/boot/dts/bcm283x.dtsi | 24 +++++++++++++++++++++++-
13 files changed, 41 insertions(+), 4 deletions(-)
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
index 9f86649..7308928 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
@@ -2,6 +2,7 @@
#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-a-plus", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts
index 4b1af06..5b075e8 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
@@ -2,6 +2,7 @@
#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-a", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index a846f1e..81c8927 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -3,6 +3,7 @@
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
index e860964..8d9d102 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
@@ -3,6 +3,7 @@
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-smsc9512.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 5d77f3f..a25159d 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -3,6 +3,7 @@
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-smsc9512.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
index 82651c3..a52917f 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
@@ -13,6 +13,7 @@
#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
index 7036240..63ed0ce 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-zero.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
@@ -13,6 +13,7 @@
#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-usb-otg.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,model-zero", "brcm,bcm2835";
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index e36c392..46a76ec 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -44,9 +44,7 @@
};
};
-&i2c0 {
- pinctrl-names = "default";
- pinctrl-0 = <&i2c0_gpio0>;
+&i2c0_parent {
status = "okay";
clock-frequency = <100000>;
};
diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
index e8de414..6cea032 100644
--- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
@@ -3,6 +3,7 @@
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
/ {
compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
index 20725ca..09a4b43 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
@@ -3,6 +3,7 @@
#include "bcm2835-rpi.dtsi"
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
/ {
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
diff --git a/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi
new file mode 100644
index 0000000..d2915a1
--- /dev/null
+++ b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_28.dtsi
@@ -0,0 +1,4 @@
+&i2c0_mux {
+ pinctrl-0 = <&i2c0_gpio0>;
+ pinctrl-1 = <&i2c0_gpio28>;
+};
diff --git a/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
new file mode 100644
index 0000000..15a7989
--- /dev/null
+++ b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
@@ -0,0 +1,4 @@
+&i2c0_mux {
+ pinctrl-0 = <&i2c0_gpio0>;
+ pinctrl-1 = <&i2c0_gpio44>;
+};
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 431dcfc..2bf24f0 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -410,7 +410,7 @@
status = "disabled";
};
- i2c0: i2c at 7e205000 {
+ i2c0_parent: i2c at 7e205000 {
compatible = "brcm,bcm2835-i2c";
reg = <0x7e205000 0x1000>;
interrupts = <2 21>;
@@ -420,6 +420,28 @@
status = "disabled";
};
+ i2c0_mux: i2c0_mux {
+ compatible = "i2c-mux-pinctrl";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ i2c-parent = <&i2c0_parent>;
+
+ pinctrl-names = "i2c0", "i2c_csi_dsi";
+
+ i2c0: i2c at 0 {
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+
+ i2c_csi_dsi: i2c at 1 {
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+ };
+
pixelvalve at 7e206000 {
compatible = "brcm,bcm2835-pixelvalve0";
reg = <0x7e206000 0x100>;
--
2.7.4
More information about the linux-rpi-kernel
mailing list