[PATCH v2] ARM: dts: Add i2cmux-pinctrl config to Raspberry Pi BSC0
Stefan Wahren
stefan.wahren at i2se.com
Tue Dec 12 12:25:08 PST 2017
Hi Dave,
> Dave Stevenson <dave.stevenson at raspberrypi.org> hat am 12. Dezember 2017 um 16:18 geschrieben:
>
>
> ...
after trying to connect a Raspberry Pi and the official 7inch touch panel, i think the motivation behind this change is to avoid the GPIO bitbanging from here [1].
Am i right?
Since the i2c-mux-pinctrl is only enabled in arm/multi_v7_defconfig, could you please add 2 additional patches? The first one should enable this driver as builtin for arm/bcm2835_defconfig and the second one as kernel module for arm64/defconfig.
This patch adds a lot of files, so please send also a copy of your next patch version to the ARM maintainers and linux-arm-kernel. So they have a chance to give comments, before Eric sends a pull request.
[1] - https://patchwork.kernel.org/patch/9474665/
>
> Signed-off-by: Dave Stevenson <dave.stevenson at raspberrypi.org>
> ---
>
> Changes from v1 to v2.
> - Changed from RFC to Patch as at least Eric appears to consider it worth pursuing.
> - Reworked for models A & B where no mux is required.
> - Added the aliases so that the bus naming remains the same.
> - Renamed the new files to only have dashes and not underscores in them.
> - Renamed the i2c controller label from i2c0_parent to bsc0 as it is more accurate,
> and more logical for when there is no mux.
> - SPDX License header added for the 3 new files.
>
> 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-i2c0-nomux.dtsi | 12 ++++++++
> arch/arm/boot/dts/bcm283x-rpi-i2c0mux-0-28.dtsi | 39 +++++++++++++++++++++++++
> arch/arm/boot/dts/bcm283x-rpi-i2c0mux-0-44.dtsi | 39 +++++++++++++++++++++++++
> arch/arm/boot/dts/bcm283x.dtsi | 2 +-
> 14 files changed, 101 insertions(+), 4 deletions(-)
> create mode 100644 arch/arm/boot/dts/bcm283x-rpi-i2c0-nomux.dtsi
> 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 aa1fc7b..8e2e78f 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
> @@ -3,6 +3,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 425f6b0..e7cb947 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
> @@ -3,6 +3,7 @@
> #include "bcm2835.dtsi"
> #include "bcm2835-rpi.dtsi"
> #include "bcm283x-rpi-usb-host.dtsi"
> +#include "bcm283x-rpi-i2c0-nomux.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 effa195..2587262 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> @@ -4,6 +4,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 772ec3b..1e6195b 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
> @@ -4,6 +4,7 @@
> #include "bcm2835-rpi.dtsi"
> #include "bcm283x-rpi-smsc9512.dtsi"
> #include "bcm283x-rpi-usb-host.dtsi"
> +#include "bcm283x-rpi-i2c0-nomux.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 434483d..82128f6 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
> @@ -4,6 +4,7 @@
> #include "bcm2835-rpi.dtsi"
> #include "bcm283x-rpi-smsc9512.dtsi"
> #include "bcm283x-rpi-usb-host.dtsi"
> +#include "bcm283x-rpi-i2c0-nomux.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 b8565fc..7eb1eac 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..02e2e50 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..907f3c6 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>;
> +&bsc0 {
> 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 5c339ad..db72667 100644
> --- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
> +++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
> @@ -4,6 +4,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 3e4ed7c..4828ea4 100644
> --- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
> +++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
> @@ -4,6 +4,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-i2c0-nomux.dtsi b/arch/arm/boot/dts/bcm283x-rpi-i2c0-nomux.dtsi
> new file mode 100644
> index 0000000..8ef9c3ea
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm283x-rpi-i2c0-nomux.dtsi
No strong opinion, but shouldn't be the filename bcm283x-rpi-i2c0-nomux-0.dtsi?
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: GPL-2.0
> +&bsc0 {
pinctrl-names = "default";
> + pinctrl-0 = <&i2c0_gpio0>;
> +};
> +
> +/ {
> + aliases {
> + i2c0 = &bsc0;
> + i2c1 = &i2c1;
> + i2c2 = &i2c2;
> + };
> +};
In the other dtsi files the root node is always before the references. So please move this up. Same applies to the other mux dtsi files.
> 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..ae152e5
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux-0-28.dtsi
> @@ -0,0 +1,39 @@
> +// SPDX-License-Identifier: GPL-2.0
> +&{/soc} {
> + i2c0_mux: i2c0_mux {
> + compatible = "i2c-mux-pinctrl";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + i2c-parent = <&bsc0>;
> +
> + pinctrl-names = "i2c0", "i2c_csi_dsi";
> + pinctrl-0 = <&i2c0_gpio0>;
> + pinctrl-1 = <&i2c0_gpio28>;
> +
> + i2c0: i2c at 0 {
> + reg = <0>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + pinctrl-0 = <&i2c0_gpio0>;
> + };
> +
> + i2c_csi_dsi: i2c at 1 {
> + reg = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + pinctrl-1 = <&i2c0_gpio28>;
> + };
> + };
> +
> +};
> +
> +/ {
> + aliases {
> + i2c10 = &bsc0;
> + i2c0 = &i2c0;
> + i2c1 = &i2c1;
> + i2c2 = &i2c2;
> + i2c4 = &i2c_csi_dsi;
> + };
> +};
> 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..7680127
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm283x-rpi-i2c0mux-0-44.dtsi
> @@ -0,0 +1,39 @@
> +// SPDX-License-Identifier: GPL-2.0
> +&{/soc} {
> + i2c0_mux: i2c0_mux {
> + compatible = "i2c-mux-pinctrl";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + i2c-parent = <&bsc0>;
> +
> + pinctrl-names = "i2c0", "i2c_csi_dsi";
> + pinctrl-0 = <&i2c0_gpio0>;
> + pinctrl-1 = <&i2c0_gpio44>;
> +
> + i2c0: i2c at 0 {
> + reg = <0>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + pinctrl-0 = <&i2c0_gpio0>;
> + };
> +
> + i2c_csi_dsi: i2c at 1 {
> + reg = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + pinctrl-1 = <&i2c0_gpio44>;
Unfortunately this could cause a pin conflict between the PWM and I2C. In bcm2835-rpi.dtsi the PWM takes pin control over GPIO40 and GPIO45. I think I2C is more important and suggest to remove GPIO45 from PWM's pinctrl as a separate patch before this.
Thanks
More information about the linux-rpi-kernel
mailing list