openwrt/target/linux/bcm27xx/patches-5.4/950-0355-overlays-Make-mcp342x-run-time-compatible.patch
Álvaro Fernández Rojas f07e572f64 bcm27xx: import latest patches from the RPi foundation
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-18 23:42:32 +01:00

210 lines
4.1 KiB
Diff

From 00f01136b1c165e0f4a190fcb5ec8aa11428362f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 9 Dec 2019 12:32:20 +0000
Subject: [PATCH] overlays: Make mcp342x run-time compatible
The order of processing of run-time overlays differs from that done by
the firmware. This means that certain parameter processing techniques
are not compatible with run-time use. The mcp342x overlay is one such
overlay, but it is easy to change the implementation without changing
the interface.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=258294
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
.../arm/boot/dts/overlays/mcp342x-overlay.dts | 133 ++++++++++++++----
1 file changed, 102 insertions(+), 31 deletions(-)
--- a/arch/arm/boot/dts/overlays/mcp342x-overlay.dts
+++ b/arch/arm/boot/dts/overlays/mcp342x-overlay.dts
@@ -8,14 +8,15 @@
fragment@0 {
target = <&i2c1>;
- __overlay__ {
+ __dormant__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
- mcp342x: mcp@68 {
+ mcp3421: mcp@68 {
reg = <0x68>;
+ compatible = "microchip,mcp3421";
status = "okay";
};
@@ -23,71 +24,141 @@
};
fragment@1 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3421";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3422: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3422";
+
+ status = "okay";
+ };
};
};
fragment@2 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3422";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3423: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3423";
+
+ status = "okay";
+ };
};
};
fragment@3 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3423";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3424: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3424";
+
+ status = "okay";
+ };
};
};
fragment@4 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3424";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3425: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3425","mcp3425";
+
+ status = "okay";
+ };
};
};
fragment@5 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3425";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3426: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3426";
+
+ status = "okay";
+ };
};
};
fragment@6 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3426";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ mcp3427: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3427";
+
+ status = "okay";
+ };
};
};
fragment@7 {
- target = <&mcp342x>;
+ target = <&i2c1>;
__dormant__ {
- compatible = "microchip,mcp3427";
- };
- };
+ #address-cells = <1>;
+ #size-cells = <0>;
- fragment@8 {
- target = <&mcp342x>;
- __dormant__ {
- compatible = "microchip,mcp3428";
+ status = "okay";
+
+ mcp3428: mcp@68 {
+ reg = <0x68>;
+ compatible = "microchip,mcp3428";
+
+ status = "okay";
+ };
};
};
__overrides__ {
- addr = <&mcp342x>,"reg:0";
- mcp3421 = <0>,"=1";
- mcp3422 = <0>,"=2";
- mcp3423 = <0>,"=3";
- mcp3424 = <0>,"=4";
- mcp3425 = <0>,"=5";
- mcp3426 = <0>,"=6";
- mcp3427 = <0>,"=7";
- mcp3428 = <0>,"=8";
+ addr = <&mcp3421>,"reg:0",
+ <&mcp3422>,"reg:0",
+ <&mcp3423>,"reg:0",
+ <&mcp3424>,"reg:0",
+ <&mcp3425>,"reg:0",
+ <&mcp3426>,"reg:0",
+ <&mcp3427>,"reg:0",
+ <&mcp3428>,"reg:0";
+ mcp3421 = <0>,"=0";
+ mcp3422 = <0>,"=1";
+ mcp3423 = <0>,"=2";
+ mcp3424 = <0>,"=3";
+ mcp3425 = <0>,"=4";
+ mcp3426 = <0>,"=5";
+ mcp3427 = <0>,"=6";
+ mcp3428 = <0>,"=7";
};
};