5c37d93698ec6d83a84a2de5e1e4fd0f911fa08c
[openwrt/staging/blocktrron.git] /
1 From 16188a175bccc8fc6809b2751ba853defdff9197 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 15 Dec 2022 15:57:18 +0000
4 Subject: [PATCH] dtoverlays: Add overlay cm-swap-i2c0 to swap buses on
5 i2c0mux
6
7 The legacy camera stack wiring instructions connect the cameras
8 to the opposite sets of GPIOs compared to the arrangement
9 more normally used with libcamera on all other platforms.
10
11 Add an overlay to allow easy swapping of the assignments so
12 that the legacy wiring can be used with libcamera.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 ---
16 arch/arm/boot/dts/overlays/Makefile | 1 +
17 arch/arm/boot/dts/overlays/README | 16 +++++++++++
18 .../dts/overlays/cm-swap-i2c0-overlay.dts | 27 +++++++++++++++++++
19 3 files changed, 44 insertions(+)
20 create mode 100644 arch/arm/boot/dts/overlays/cm-swap-i2c0-overlay.dts
21
22 --- a/arch/arm/boot/dts/overlays/Makefile
23 +++ b/arch/arm/boot/dts/overlays/Makefile
24 @@ -39,6 +39,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
25 cap1106.dtbo \
26 chipdip-dac.dtbo \
27 cirrus-wm5102.dtbo \
28 + cm-swap-i2c0.dtbo \
29 cma.dtbo \
30 crystalfontz-cfa050_pi_m.dtbo \
31 cutiepi-panel.dtbo \
32 --- a/arch/arm/boot/dts/overlays/README
33 +++ b/arch/arm/boot/dts/overlays/README
34 @@ -787,6 +787,22 @@ Load: dtoverlay=cirrus-wm5102
35 Params: <None>
36
37
38 +Name: cm-swap-i2c0
39 +Info: Largely for Compute Modules 1&3 where the original instructions for
40 + adding a camera used GPIOs 0&1 for CAM1 and 28&29 for CAM0, whilst all
41 + other platforms use 28&29 (or 44&45) for CAM1.
42 + The default assignment through using this overlay is for
43 + i2c0 to use 28&29, and i2c10 (aka i2c_csi_dsi) to use 28&29, but the
44 + overrides allow this to be changed.
45 +Load: dtoverlay=cm-swap-i2c0,<param>=<val>
46 +Params: i2c0-gpio0 Use GPIOs 0&1 for i2c0
47 + i2c0-gpio28 Use GPIOs 28&29 for i2c0 (default)
48 + i2c0-gpio44 Use GPIOs 44&45 for i2c0
49 + i2c10-gpio0 Use GPIOs 0&1 for i2c0 (default)
50 + i2c10-gpio28 Use GPIOs 28&29 for i2c0
51 + i2c10-gpio44 Use GPIOs 44&45 for i2c0
52 +
53 +
54 Name: cma
55 Info: Set custom CMA sizes, only use if you know what you are doing, might
56 clash with other overlays like vc4-fkms-v3d and vc4-kms-v3d.
57 --- /dev/null
58 +++ b/arch/arm/boot/dts/overlays/cm-swap-i2c0-overlay.dts
59 @@ -0,0 +1,27 @@
60 +// SPDX-License-Identifier: GPL-2.0-only
61 +// Definitions for IMX708 camera module on VC I2C bus
62 +/dts-v1/;
63 +/plugin/;
64 +
65 +#include <dt-bindings/gpio/gpio.h>
66 +
67 +/{
68 + compatible = "brcm,bcm2835";
69 +
70 + fragment@0 {
71 + target = <&i2c0mux>;
72 + i2c0mux_frag: __overlay__ {
73 + pinctrl-0 = <&i2c0_gpio28>;
74 + pinctrl-1 = <&i2c0_gpio0>;
75 + };
76 + };
77 +
78 + __overrides__ {
79 + i2c0-gpio0 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio0>;
80 + i2c0-gpio28 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio28>;
81 + i2c0-gpio44 = <&i2c0mux_frag>, "pinctrl-0:0=",<&i2c0_gpio44>;
82 + i2c10-gpio0 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio0>;
83 + i2c10-gpio28 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio28>;
84 + i2c10-gpio44 = <&i2c0mux_frag>, "pinctrl-1:0=",<&i2c0_gpio44>;
85 + };
86 +};