You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux/bcm27xx/patches-4.19/950-0614-overlays-Add-i2c0-...

341 lines
8.7 KiB
Diff

From 9c0f4b3e3b197d5c81f4bd6679f2c2456ab45c9e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 17 Jul 2019 10:08:55 +0100
Subject: [PATCH] overlays: Add i2c0 and i2c1 for regularity
The new i2c overlays for pi4 (i2c3, i2c4, i2c5, i2c6) have a
standardised interface that allows pin groups to be chosen
atomically rather than as individual pins. Add i2c0 and i2c1
overlays to fit the naming scheme and parameter usage, deprecating
i2c0-bcm2708 and i2c1-bcm2708.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/overlays/Makefile | 2 +
arch/arm/boot/dts/overlays/README | 33 +++++---
.../dts/overlays/i2c0-bcm2708-overlay.dts | 77 +++----------------
arch/arm/boot/dts/overlays/i2c0-overlay.dts | 61 +++++++++++++++
.../dts/overlays/i2c1-bcm2708-overlay.dts | 46 ++---------
arch/arm/boot/dts/overlays/i2c1-overlay.dts | 44 +++++++++++
6 files changed, 147 insertions(+), 116 deletions(-)
create mode 100644 arch/arm/boot/dts/overlays/i2c0-overlay.dts
create mode 100644 arch/arm/boot/dts/overlays/i2c1-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -66,7 +66,9 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
i2c-rtc.dtbo \
i2c-rtc-gpio.dtbo \
i2c-sensor.dtbo \
+ i2c0.dtbo \
i2c0-bcm2708.dtbo \
+ i2c1.dtbo \
i2c1-bcm2708.dtbo \
i2c3.dtbo \
i2c4.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1151,14 +1151,12 @@ Params: addr Set the
sensor
-Name: i2c0-bcm2708
+Name: i2c0
Info: Change i2c0 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
-Load: dtoverlay=i2c0-bcm2708,<param>=<val>
-Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
- scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
- pins_0_1 Use pins 0 and 1 (default)
+Load: dtoverlay=i2c0,<param>=<val>
+Params: pins_0_1 Use pins 0 and 1 (default)
pins_28_29 Use pins 28 and 29
pins_44_45 Use pins 44 and 45
pins_46_47 Use pins 46 and 47
@@ -1166,18 +1164,33 @@ Params: sda0_pin GPIO pin
"yes")
-Name: i2c1-bcm2708
+Name: i2c0-bcm2708
+Info: Deprecated, legacy version of i2c0, from which it inherits its
+ parameters, just adding the explicit individual pin specifiers.
+Load: <Deprecated>
+Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
+ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
+
+
+Name: i2c1
Info: Change i2c1 pin usage. Not all pin combinations are usable on all
platforms - platforms other then Compute Modules can only use this
to disable transaction combining.
-Info: Enable the i2c_bcm2708 driver for the i2c1 bus
-Load: dtoverlay=i2c1-bcm2708,<param>=<val>
+Load: dtoverlay=i2c1,<param>=<val>
+Params: pins_2_3 Use pins 2 and 3 (default)
+ pins_44_45 Use pins 44 and 45
+ combine Allow transactions to be combined (default
+ "yes")
+
+
+Name: i2c1-bcm2708
+Info: Deprecated, legacy version of i2c1, from which it inherits its
+ parameters, just adding the explicit individual pin specifiers.
+Load: <Deprecated>
Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
pin_func Alternative pin function (4 (alt0), 6 (alt2) -
default 4)
- combine Allow transactions to be combined (default
- "yes")
Name: i2c3
--- a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
@@ -1,69 +1,14 @@
-/*
- * Device tree overlay for i2c_bcm2708, i2c0 bus
- *
- * Compile:
- * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts
- */
-
-/dts-v1/;
-/plugin/;
+#include "i2c0-overlay.dts"
/{
- compatible = "brcm,bcm2835";
-
- fragment@0 {
- target = <&i2c0>;
- __overlay__ {
- status = "okay";
- };
- };
-
- fragment@1 {
- target = <&i2c0_pins>;
- frag1: __overlay__ {
- brcm,pins = <0 1>;
- brcm,function = <4>; /* alt0 */
- };
- };
-
- fragment@2 {
- target = <&i2c0_pins>;
- __dormant__ {
- brcm,pins = <28 29>;
- brcm,function = <4>; /* alt0 */
- };
- };
-
- fragment@3 {
- target = <&i2c0_pins>;
- __dormant__ {
- brcm,pins = <44 45>;
- brcm,function = <5>; /* alt1 */
- };
- };
-
- fragment@4 {
- target = <&i2c0_pins>;
- __dormant__ {
- brcm,pins = <46 47>;
- brcm,function = <4>; /* alt0 */
- };
- };
-
- fragment@5 {
- target = <&i2c0>;
- __dormant__ {
- compatible = "brcm,bcm2708-i2c";
- };
- };
-
- __overrides__ {
- sda0_pin = <&frag1>,"brcm,pins:0";
- scl0_pin = <&frag1>,"brcm,pins:4";
- pins_0_1 = <0>,"+1-2-3-4";
- pins_28_29 = <0>,"-1+2-3-4";
- pins_44_45 = <0>,"-1-2+3-4";
- pins_46_47 = <0>,"-1-2-3+4";
- combine = <0>, "!5";
- };
+ __overrides__ {
+ sda0_pin = <&pins1>,"brcm,pins:0",
+ <&pins2>,"brcm,pins:0",
+ <&pins3>,"brcm,pins:0",
+ <&pins4>,"brcm,pins:0";
+ scl0_pin = <&pins1>,"brcm,pins:4",
+ <&pins2>,"brcm,pins:4",
+ <&pins3>,"brcm,pins:4",
+ <&pins4>,"brcm,pins:4";
+ };
};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/i2c0-overlay.dts
@@ -0,0 +1,61 @@
+/dts-v1/;
+/plugin/;
+
+/{
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&i2c0>;
+ __overlay__ {
+ status = "okay";
+ pinctrl-0 = <&i2c0_pins>;
+ };
+ };
+
+ fragment@1 {
+ target = <&i2c0_pins>;
+ pins1: __overlay__ {
+ brcm,pins = <0 1>;
+ brcm,function = <4>; /* alt0 */
+ };
+ };
+
+ fragment@2 {
+ target = <&i2c0_pins>;
+ pins2: __dormant__ {
+ brcm,pins = <28 29>;
+ brcm,function = <4>; /* alt0 */
+ };
+ };
+
+ fragment@3 {
+ target = <&i2c0_pins>;
+ pins3: __dormant__ {
+ brcm,pins = <44 45>;
+ brcm,function = <5>; /* alt1 */
+ };
+ };
+
+ fragment@4 {
+ target = <&i2c0_pins>;
+ pins4: __dormant__ {
+ brcm,pins = <46 47>;
+ brcm,function = <4>; /* alt0 */
+ };
+ };
+
+ fragment@5 {
+ target = <&i2c0>;
+ __dormant__ {
+ compatible = "brcm,bcm2708-i2c";
+ };
+ };
+
+ __overrides__ {
+ pins_0_1 = <0>,"+1-2-3-4";
+ pins_28_29 = <0>,"-1+2-3-4";
+ pins_44_45 = <0>,"-1-2+3-4";
+ pins_46_47 = <0>,"-1-2-3+4";
+ combine = <0>, "!5";
+ };
+};
--- a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
@@ -1,43 +1,9 @@
-/*
- * Device tree overlay for i2c_bcm2708, i2c1 bus
- *
- * Compile:
- * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts
- */
-
-/dts-v1/;
-/plugin/;
+#include "i2c1-overlay.dts"
/{
- compatible = "brcm,bcm2835";
-
- fragment@0 {
- target = <&i2c1>;
- __overlay__ {
- pinctrl-0 = <&i2c1_pins>;
- status = "okay";
- };
- };
-
- fragment@1 {
- target = <&i2c1_pins>;
- pins: __overlay__ {
- brcm,pins = <2 3>;
- brcm,function = <4>; /* alt 0 */
- };
- };
-
- fragment@2 {
- target = <&i2c1>;
- __dormant__ {
- compatible = "brcm,bcm2708-i2c";
- };
- };
-
- __overrides__ {
- sda1_pin = <&pins>,"brcm,pins:0";
- scl1_pin = <&pins>,"brcm,pins:4";
- pin_func = <&pins>,"brcm,function:0";
- combine = <0>, "!2";
- };
+ __overrides__ {
+ sda1_pin = <&pins1>,"brcm,pins:0", <&pins2>,"brcm,pins:0";
+ scl1_pin = <&pins1>,"brcm,pins:4", <&pins1>,"brcm,pins:4";
+ pin_func = <&pins1>,"brcm,function:0", <&pins2>,"brcm,function:0";
+ };
};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/i2c1-overlay.dts
@@ -0,0 +1,44 @@
+/dts-v1/;
+/plugin/;
+
+/{
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&i2c1>;
+ __overlay__ {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ };
+ };
+
+ fragment@1 {
+ target = <&i2c1_pins>;
+ pins1: __overlay__ {
+ brcm,pins = <2 3>;
+ brcm,function = <4>; /* alt 0 */
+ };
+ };
+
+ fragment@2 {
+ target = <&i2c1_pins>;
+ pins2: __dormant__ {
+ brcm,pins = <44 45>;
+ brcm,function = <6>; /* alt 2 */
+ };
+ };
+
+ fragment@3 {
+ target = <&i2c1>;
+ __dormant__ {
+ compatible = "brcm,bcm2708-i2c";
+ };
+ };
+
+ __overrides__ {
+ pins_2_3 = <0>,"=1!2";
+ pins_44_45 = <0>,"!1=2";
+ combine = <0>, "!3";
+ };
+};