From 16188a175bccc8fc6809b2751ba853defdff9197 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 15 Dec 2022 15:57:18 +0000 Subject: [PATCH] dtoverlays: Add overlay cm-swap-i2c0 to swap buses on i2c0mux The legacy camera stack wiring instructions connect the cameras to the opposite sets of GPIOs compared to the arrangement more normally used with libcamera on all other platforms. Add an overlay to allow easy swapping of the assignments so that the legacy wiring can be used with libcamera. Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/Makefile | 1 + arch/arm/boot/dts/overlays/README | 16 +++++++++++ .../dts/overlays/cm-swap-i2c0-overlay.dts | 27 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 arch/arm/boot/dts/overlays/cm-swap-i2c0-overlay.dts --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -39,6 +39,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ cap1106.dtbo \ chipdip-dac.dtbo \ cirrus-wm5102.dtbo \ + cm-swap-i2c0.dtbo \ cma.dtbo \ crystalfontz-cfa050_pi_m.dtbo \ cutiepi-panel.dtbo \ --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -787,6 +787,22 @@ Load: dtoverlay=cirrus-wm5102 Params: +Name: cm-swap-i2c0 +Info: Largely for Compute Modules 1&3 where the original instructions for + adding a camera used GPIOs 0&1 for CAM1 and 28&29 for CAM0, whilst all + other platforms use 28&29 (or 44&45) for CAM1. + The default assignment through using this overlay is for + i2c0 to use 28&29, and i2c10 (aka i2c_csi_dsi) to use 28&29, but the + overrides allow this to be changed. +Load: dtoverlay=cm-swap-i2c0,= +Params: i2c0-gpio0 Use GPIOs 0&1 for i2c0 + i2c0-gpio28 Use GPIOs 28&29 for i2c0 (default) + i2c0-gpio44 Use GPIOs 44&45 for i2c0 + i2c10-gpio0 Use GPIOs 0&1 for i2c0 (default) + i2c10-gpio28 Use GPIOs 28&29 for i2c0 + i2c10-gpio44 Use GPIOs 44&45 for i2c0 + + Name: cma Info: Set custom CMA sizes, only use if you know what you are doing, might clash with other overlays like vc4-fkms-v3d and vc4-kms-v3d. --- /dev/null +++ b/arch/arm/boot/dts/overlays/cm-swap-i2c0-overlay.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Definitions for IMX708 camera module on VC I2C bus +/dts-v1/; +/plugin/; + +#include + +/{ + compatible = "brcm,bcm2835"; + + fragment@0 { + target = <&i2c0mux>; + i2c0mux_frag: __overlay__ { + pinctrl-0 = <&i2c0_gpio28>; + pinctrl-1 = <&i2c0_gpio0>; + }; + }; + + __overrides__ { + i2c0-gpio0 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio0>; + i2c0-gpio28 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio28>; + i2c0-gpio44 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio44>; + i2c10-gpio0 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio0>; + i2c10-gpio28 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio28>; + i2c10-gpio44 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio44>; + }; +};