2020-02-13 21:49:25

by Dafna Hirschfeld

[permalink] [raw]
Subject: [PATCH v3 1/2] dt-bindings: i2c: cros-ec-tunnel: convert i2c-cros-ec-tunnel.txt to yaml

Convert the binding file i2c-cros-ec-tunnel.txt to yaml format.

This was tested and verified on ARM and ARM64 with:

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml
make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml

Signed-off-by: Dafna Hirschfeld <[email protected]>
---
Changes since v1:
- changing the subject to start with "dt-bindings: i2c: cros-ec-tunnel:"
- changing the license to (GPL-2.0-only OR BSD-2-Clause)
- removing "Guenter Roeck <[email protected]>" from the maintainers list
- adding ref: /schemas/i2c/i2c-controller.yaml

Changes since v2:
- adding another patch that fixes a warning found by this patch


.../bindings/i2c/i2c-cros-ec-tunnel.txt | 39 ------------
.../bindings/i2c/i2c-cros-ec-tunnel.yaml | 63 +++++++++++++++++++
2 files changed, 63 insertions(+), 39 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
create mode 100644 Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt b/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
deleted file mode 100644
index 898f030eba62..000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-I2C bus that tunnels through the ChromeOS EC (cros-ec)
-======================================================
-On some ChromeOS board designs we've got a connection to the EC (embedded
-controller) but no direct connection to some devices on the other side of
-the EC (like a battery and PMIC). To get access to those devices we need
-to tunnel our i2c commands through the EC.
-
-The node for this device should be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-
-Required properties:
-- compatible: google,cros-ec-i2c-tunnel
-- google,remote-bus: The EC bus we'd like to talk to.
-
-Optional child nodes:
-- One node per I2C device connected to the tunnelled I2C bus.
-
-
-Example:
- cros-ec@0 {
- compatible = "google,cros-ec-spi";
-
- ...
-
- i2c-tunnel {
- compatible = "google,cros-ec-i2c-tunnel";
- #address-cells = <1>;
- #size-cells = <0>;
-
- google,remote-bus = <0>;
-
- battery: sbs-battery@b {
- compatible = "sbs,sbs-battery";
- reg = <0xb>;
- sbs,poll-retry-count = <1>;
- };
- };
- }
diff --git a/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml b/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml
new file mode 100644
index 000000000000..a14d821ff65d
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-cros-ec-tunnel.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I2C bus that tunnels through the ChromeOS EC (cros-ec)
+
+maintainers:
+ - Benson Leung <[email protected]>
+ - Enric Balletbo i Serra <[email protected]>
+
+description: |
+ On some ChromeOS board designs we've got a connection to the EC (embedded
+ controller) but no direct connection to some devices on the other side of
+ the EC (like a battery and PMIC). To get access to those devices we need
+ to tunnel our i2c commands through the EC.
+ The node for this device should be under a cros-ec node like google,cros-ec-spi
+ or google,cros-ec-i2c.
+
+allOf:
+ - $ref: /schemas/i2c/i2c-controller.yaml#
+
+properties:
+ compatible:
+ const:
+ google,cros-ec-i2c-tunnel
+
+ google,remote-bus:
+ $ref: "/schemas/types.yaml#/definitions/uint32"
+ description: The EC bus we'd like to talk to.
+
+ "#address-cells": true
+ "#size-cells": true
+
+patternProperties:
+ "^.*@[0-9a-f]+$":
+ type: object
+ description: One node per I2C device connected to the tunnelled I2C bus.
+
+additionalProperties: false
+
+required:
+ - compatible
+ - google,remote-bus
+
+examples:
+ - |
+ cros-ec@0 {
+ compatible = "google,cros-ec-spi";
+ i2c-tunnel {
+ compatible = "google,cros-ec-i2c-tunnel";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ google,remote-bus = <0>;
+
+ battery: sbs-battery@b {
+ compatible = "sbs,sbs-battery";
+ reg = <0xb>;
+ sbs,poll-retry-count = <1>;
+ };
+ };
+ };
--
2.17.1


2020-02-13 21:49:28

by Dafna Hirschfeld

[permalink] [raw]
Subject: [PATCH v3 2/2] arm64: tegra: add unit address to nodes under i2c-tunnel

add unit address to the nodes bq24735, smart-battery

This fixes the warning:
'bq24735', 'smart-battery' do not match any of the
regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'

Signed-off-by: Dafna Hirschfeld <[email protected]>
---
arch/arm64/boot/dts/nvidia/tegra132-norrin.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
index a0385a386a3f..a19171f6f0f7 100644
--- a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
@@ -767,7 +767,7 @@

google,remote-bus = <0>;

- charger: bq24735 {
+ charger: bq24735@9 {
compatible = "ti,bq24735";
reg = <0x9>;
interrupt-parent = <&gpio>;
@@ -778,7 +778,7 @@
GPIO_ACTIVE_HIGH>;
};

- battery: smart-battery {
+ battery: smart-battery@b {
compatible = "sbs,sbs-battery";
reg = <0xb>;
battery-name = "battery";
--
2.17.1

2020-02-13 22:34:00

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] arm64: tegra: add unit address to nodes under i2c-tunnel

Hi,

On Thu, Feb 13, 2020 at 10:46:56PM +0100, Dafna Hirschfeld wrote:
> add unit address to the nodes bq24735, smart-battery
>
> This fixes the warning:
> 'bq24735', 'smart-battery' do not match any of the
> regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'
>
> Signed-off-by: Dafna Hirschfeld <[email protected]>
> ---

While fixing the node names, it makes sense to also
use device class instead of name as mentioned in
Documentation/devicetree/bindings/writing-bindings.txt

> arch/arm64/boot/dts/nvidia/tegra132-norrin.dts | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
> index a0385a386a3f..a19171f6f0f7 100644
> --- a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
> +++ b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts
> @@ -767,7 +767,7 @@
>
> google,remote-bus = <0>;
>
> - charger: bq24735 {
> + charger: bq24735@9 {

charger: charger@9 {

> compatible = "ti,bq24735";
> reg = <0x9>;
> interrupt-parent = <&gpio>;
> @@ -778,7 +778,7 @@
> GPIO_ACTIVE_HIGH>;
> };
>
> - battery: smart-battery {
> + battery: smart-battery@b {

battery: battery@b {

> compatible = "sbs,sbs-battery";
> reg = <0xb>;
> battery-name = "battery";

-- Sebastian


Attachments:
(No filename) (1.37 kB)
signature.asc (849.00 B)
Download all attachments

2020-02-13 22:37:17

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: i2c: cros-ec-tunnel: convert i2c-cros-ec-tunnel.txt to yaml

Hi,

On Thu, Feb 13, 2020 at 10:46:55PM +0100, Dafna Hirschfeld wrote:
> Convert the binding file i2c-cros-ec-tunnel.txt to yaml format.
>
> This was tested and verified on ARM and ARM64 with:
>
> make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml
> make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.yaml
>
> Signed-off-by: Dafna Hirschfeld <[email protected]>
> ---

[...]

> +examples:
> + - |
> + cros-ec@0 {
> + compatible = "google,cros-ec-spi";
> + i2c-tunnel {
> + compatible = "google,cros-ec-i2c-tunnel";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + google,remote-bus = <0>;
> +
> + battery: sbs-battery@b {

This should be "battery@b {", since node names are supposed to
match the class of the device instead of the name of the device.

> + compatible = "sbs,sbs-battery";
> + reg = <0xb>;
> + sbs,poll-retry-count = <1>;
> + };
> + };
> + };

-- Sebastian


Attachments:
(No filename) (1.13 kB)
signature.asc (849.00 B)
Download all attachments