devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/9] Turris Omnia MCU driver
@ 2024-04-24 17:37 Marek Behún
  2024-04-24 17:38 ` [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Marek Behún @ 2024-04-24 17:37 UTC (permalink / raw)
  To: Gregory CLEMENT, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen, Alessandro Zummo,
	Alexandre Belloni, Bartosz Golaszewski, Christophe JAILLET,
	Dan Carpenter, devicetree, Greg Kroah-Hartman, Guenter Roeck,
	Herbert Xu, Krzysztof Kozlowski, Linus Walleij, linux-crypto,
	linux-gpio, linux-rtc, linux-watchdog, Olivia Mackall,
	Rob Herring, Wim Van Sebroeck
  Cc: Marek Behún, Andrew Lunn, Conor Dooley, Krzysztof Kozlowski,
	Rob Herring, Sebastian Hesselbarth, Uwe Kleine-König

Hello Andy, Hans, Ilpo, Arnd, Gregory, and others,

this is v7 of the series adding Turris Omnia MCU driver.

This series depends on the immutable branch between LEDs and locking,
introducing devm_mutex_init(), see the PR
  https://lore.kernel.org/linux-leds/20240412084616.GR2399047@google.com/

See also cover letters for v1, v2, v3, v4, v5 and v6:
  https://patchwork.kernel.org/project/linux-soc/cover/20230823161012.6986-1-kabel@kernel.org/
  https://patchwork.kernel.org/project/linux-soc/cover/20230919103815.16818-1-kabel@kernel.org/
  https://patchwork.kernel.org/project/linux-soc/cover/20231023143130.11602-1-kabel@kernel.org/
  https://patchwork.kernel.org/project/linux-soc/cover/20231026161803.16750-1-kabel@kernel.org/
  https://patchwork.kernel.org/project/linux-soc/cover/20240323164359.21642-1-kabel@kernel.org/
  https://patchwork.kernel.org/project/linux-soc/cover/20240418121116.22184-1-kabel@kernel.org/

Changes since v6:
- moved the DT binding from arm/cznic,turris-omnia-mcu.yaml to
  firmware/cznic,turris-omnia-mcu.yaml, as suggested by Conor Dooley
  (patch 1)
- dropped the devm-helpers.h additions, for the reasons see
  https://lore.kernel.org/soc/20240423184346.37eb0915@thinkpad/
- use gpiod_to_irq(gpiochip_get_desc(...)) instead of
  irq_create_mapping(), as suggested by Andy Shevchenko (patches 6 and
  7)
- added a dummy read of TRNG entropy when registering TRNG, in case
  someone cleared the TRNG interrupt before probing the driver, but did
  not read the entropy (the MCU won't send a new TRNG interrupt if the
  entropy is not collected) (patch 6)
- fixed a bug in TRNG probing, wherein if the 

Marek Behún (9):
  dt-bindings: arm: add cznic,turris-omnia-mcu binding
  platform: cznic: Add preliminary support for Turris Omnia MCU
  platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs
  platform: cznic: turris-omnia-mcu: Add support for poweroff and wakeup
  platform: cznic: turris-omnia-mcu: Add support for MCU watchdog
  platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG
  platform: cznic: turris-omnia-mcu: Add support for digital message
    signing via debugfs
  ARM: dts: turris-omnia: Add MCU system-controller node
  ARM: dts: turris-omnia: Add GPIO key node for front button

 .../ABI/testing/debugfs-turris-omnia-mcu      |   13 +
 .../sysfs-bus-i2c-devices-turris-omnia-mcu    |  126 ++
 .../firmware/cznic,turris-omnia-mcu.yaml      |   86 ++
 MAINTAINERS                                   |    5 +
 .../dts/marvell/armada-385-turris-omnia.dts   |   35 +-
 drivers/platform/Kconfig                      |    2 +
 drivers/platform/Makefile                     |    1 +
 drivers/platform/cznic/Kconfig                |   51 +
 drivers/platform/cznic/Makefile               |    9 +
 .../platform/cznic/turris-omnia-mcu-base.c    |  439 +++++++
 .../platform/cznic/turris-omnia-mcu-debugfs.c |  216 ++++
 .../platform/cznic/turris-omnia-mcu-gpio.c    | 1047 +++++++++++++++++
 .../cznic/turris-omnia-mcu-sys-off-wakeup.c   |  258 ++++
 .../platform/cznic/turris-omnia-mcu-trng.c    |  109 ++
 .../cznic/turris-omnia-mcu-watchdog.c         |  123 ++
 drivers/platform/cznic/turris-omnia-mcu.h     |  188 +++
 include/linux/turris-omnia-mcu-interface.h    |  249 ++++
 17 files changed, 2956 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/debugfs-turris-omnia-mcu
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-turris-omnia-mcu
 create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
 create mode 100644 drivers/platform/cznic/Kconfig
 create mode 100644 drivers/platform/cznic/Makefile
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-base.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-debugfs.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-gpio.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-sys-off-wakeup.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-trng.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu-watchdog.c
 create mode 100644 drivers/platform/cznic/turris-omnia-mcu.h
 create mode 100644 include/linux/turris-omnia-mcu-interface.h

-- 
2.43.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding
  2024-04-24 17:37 [PATCH v7 0/9] Turris Omnia MCU driver Marek Behún
@ 2024-04-24 17:38 ` Marek Behún
  2024-04-24 18:16   ` Rob Herring
  2024-04-24 17:38 ` [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Marek Behún @ 2024-04-24 17:38 UTC (permalink / raw)
  To: Gregory CLEMENT, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen
  Cc: Marek Behún, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	devicetree, Krzysztof Kozlowski

Add binding for cznic,turris-omnia-mcu, the device-tree node
representing the system-controller features provided by the MCU on the
Turris Omnia router.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../firmware/cznic,turris-omnia-mcu.yaml      | 86 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml

diff --git a/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml b/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
new file mode 100644
index 000000000000..dd9ee21ee24d
--- /dev/null
+++ b/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/cznic,turris-omnia-mcu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CZ.NIC's Turris Omnia MCU
+
+maintainers:
+  - Marek Behún <kabel@kernel.org>
+
+description:
+  The MCU on Turris Omnia acts as a system controller providing additional
+  GPIOs, interrupts, watchdog, system power off and wakeup configuration.
+
+properties:
+  compatible:
+    const: cznic,turris-omnia-mcu
+
+  reg:
+    description: MCU I2C slave address
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+    description: |
+      The first cell specifies the interrupt number (0 to 63), the second cell
+      specifies interrupt type (which can be one of IRQ_TYPE_EDGE_RISING,
+      IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_BOTH).
+      The interrupt numbers correspond sequentially to GPIO numbers, taking the
+      GPIO banks into account:
+        IRQ number   GPIO bank   GPIO pin within bank
+           0 - 15      0           0 - 15
+          16 - 47      1           0 - 31
+          48 - 63      2           0 - 15
+      There are several exceptions:
+        IRQ number   meaning
+          11           LED panel brightness changed by button press
+          13           TRNG entropy ready
+          14           ECDSA message signature computation done
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    const: 3
+    description:
+      The first cell is bank number (0, 1 or 2), the second cell is pin number
+      within the bank (0 to 15 for banks 0 and 2, 0 to 31 for bank 1), and the
+      third cell specifies consumer flags.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        system-controller@2a {
+            compatible = "cznic,turris-omnia-mcu";
+            reg = <0x2a>;
+
+            interrupt-parent = <&gpio1>;
+            interrupts = <11 IRQ_TYPE_NONE>;
+
+            gpio-controller;
+            #gpio-cells = <3>;
+
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index c0bfad334623..bb869d5b7d4e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2143,6 +2143,7 @@ F:	Documentation/ABI/testing/sysfs-bus-moxtet-devices
 F:	Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm
 F:	Documentation/devicetree/bindings/bus/moxtet.txt
 F:	Documentation/devicetree/bindings/firmware/cznic,turris-mox-rwtm.txt
+F:	Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
 F:	Documentation/devicetree/bindings/gpio/gpio-moxtet.txt
 F:	Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml
 F:	Documentation/devicetree/bindings/watchdog/armada-37xx-wdt.txt
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node
  2024-04-24 17:37 [PATCH v7 0/9] Turris Omnia MCU driver Marek Behún
  2024-04-24 17:38 ` [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
@ 2024-04-24 17:38 ` Marek Behún
  2024-04-26 16:01   ` Gregory CLEMENT
  2024-04-24 17:38 ` [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
  2024-04-26 16:13 ` [PATCH v7 0/9] Turris Omnia MCU driver Gregory CLEMENT
  3 siblings, 1 reply; 13+ messages in thread
From: Marek Behún @ 2024-04-24 17:38 UTC (permalink / raw)
  To: Gregory CLEMENT, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen
  Cc: Marek Behún, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

Turris Omnia's MCU provides various features that can be configured over
I2C at address 0x2a. Add device-tree node.

Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 .../dts/marvell/armada-385-turris-omnia.dts   | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
index 7b755bb4e4e7..59079d63fe27 100644
--- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
+++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
@@ -218,7 +218,22 @@ i2c@0 {
 			#size-cells = <0>;
 			reg = <0>;
 
-			/* STM32F0 command interface at address 0x2a */
+			mcu: system-controller@2a {
+				compatible = "cznic,turris-omnia-mcu";
+				reg = <0x2a>;
+
+				pinctrl-names = "default";
+				pinctrl-0 = <&mcu_pins>;
+
+				interrupt-parent = <&gpio1>;
+				interrupts = <11 IRQ_TYPE_NONE>;
+
+				gpio-controller;
+				#gpio-cells = <3>;
+
+				interrupt-controller;
+				#interrupt-cells = <2>;
+			};
 
 			led-controller@2b {
 				compatible = "cznic,turris-omnia-leds";
@@ -501,6 +516,11 @@ fixed-link {
 };
 
 &pinctrl {
+	mcu_pins: mcu-pins {
+		marvell,pins = "mpp43";
+		marvell,function = "gpio";
+	};
+
 	pcawan_pins: pcawan-pins {
 		marvell,pins = "mpp46";
 		marvell,function = "gpio";
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button
  2024-04-24 17:37 [PATCH v7 0/9] Turris Omnia MCU driver Marek Behún
  2024-04-24 17:38 ` [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
  2024-04-24 17:38 ` [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
@ 2024-04-24 17:38 ` Marek Behún
  2024-04-26 16:02   ` Gregory CLEMENT
  2024-04-26 16:13 ` [PATCH v7 0/9] Turris Omnia MCU driver Gregory CLEMENT
  3 siblings, 1 reply; 13+ messages in thread
From: Marek Behún @ 2024-04-24 17:38 UTC (permalink / raw)
  To: Gregory CLEMENT, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen
  Cc: Marek Behún, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

Now that we have the MCU device-tree node, which acts as a GPIO
controller, add GPIO key node for the front button.

Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 .../boot/dts/marvell/armada-385-turris-omnia.dts    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
index 59079d63fe27..43202890c959 100644
--- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
+++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
@@ -112,6 +112,19 @@ sfp: sfp {
 		status = "disabled";
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		front-button {
+			label = "Front Button";
+			linux,code = <KEY_VENDOR>;
+			linux,can-disable;
+			gpios = <&mcu 0 12 GPIO_ACTIVE_HIGH>;
+			/* debouncing is done by the microcontroller */
+			debounce-interval = <0>;
+		};
+	};
+
 	sound {
 		compatible = "simple-audio-card";
 		simple-audio-card,name = "SPDIF";
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding
  2024-04-24 17:38 ` [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
@ 2024-04-24 18:16   ` Rob Herring
  2024-04-24 18:22     ` Marek Behún
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2024-04-24 18:16 UTC (permalink / raw)
  To: Marek Behún
  Cc: Andy Shevchenko, Krzysztof Kozlowski, arm, Ilpo Järvinen,
	soc, Gregory CLEMENT, Hans de Goede, devicetree,
	Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann


On Wed, 24 Apr 2024 19:38:00 +0200, Marek Behún wrote:
> Add binding for cznic,turris-omnia-mcu, the device-tree node
> representing the system-controller features provided by the MCU on the
> Turris Omnia router.
> 
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  .../firmware/cznic,turris-omnia-mcu.yaml      | 86 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 87 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
 	 $id: http://devicetree.org/schemas/arm/cznic,turris-omnia-mcu.yaml
 	file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240424173809.7214-2-kabel@kernel.org

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding
  2024-04-24 18:16   ` Rob Herring
@ 2024-04-24 18:22     ` Marek Behún
  2024-04-25 17:18       ` Conor Dooley
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Behún @ 2024-04-24 18:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andy Shevchenko, Krzysztof Kozlowski, arm, Ilpo Järvinen,
	soc, Gregory CLEMENT, Hans de Goede, devicetree,
	Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann

On Wed, 24 Apr 2024 13:16:18 -0500
Rob Herring <robh@kernel.org> wrote:

> On Wed, 24 Apr 2024 19:38:00 +0200, Marek Behún wrote:
> > Add binding for cznic,turris-omnia-mcu, the device-tree node
> > representing the system-controller features provided by the MCU on the
> > Turris Omnia router.
> > 
> > Signed-off-by: Marek Behún <kabel@kernel.org>
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > ---
> >  .../firmware/cznic,turris-omnia-mcu.yaml      | 86 +++++++++++++++++++
> >  MAINTAINERS                                   |  1 +
> >  2 files changed, 87 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
> >   
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
>  	 $id: http://devicetree.org/schemas/arm/cznic,turris-omnia-mcu.yaml
>  	file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240424173809.7214-2-kabel@kernel.org
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
> 

Sigh. I moved the patch bud did not change it in $id...

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding
  2024-04-24 18:22     ` Marek Behún
@ 2024-04-25 17:18       ` Conor Dooley
  0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2024-04-25 17:18 UTC (permalink / raw)
  To: Marek Behún
  Cc: Rob Herring, Andy Shevchenko, Krzysztof Kozlowski, arm,
	Ilpo Järvinen, soc, Gregory CLEMENT, Hans de Goede,
	devicetree, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 2357 bytes --]

On Wed, Apr 24, 2024 at 08:22:46PM +0200, Marek Behún wrote:
> On Wed, 24 Apr 2024 13:16:18 -0500
> Rob Herring <robh@kernel.org> wrote:
> 
> > On Wed, 24 Apr 2024 19:38:00 +0200, Marek Behún wrote:
> > > Add binding for cznic,turris-omnia-mcu, the device-tree node
> > > representing the system-controller features provided by the MCU on the
> > > Turris Omnia router.
> > > 
> > > Signed-off-by: Marek Behún <kabel@kernel.org>
> > > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > ---
> > >  .../firmware/cznic,turris-omnia-mcu.yaml      | 86 +++++++++++++++++++
> > >  MAINTAINERS                                   |  1 +
> > >  2 files changed, 87 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
> > >   
> > 
> > My bot found errors running 'make dt_binding_check' on your patch:
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
> >  	 $id: http://devicetree.org/schemas/arm/cznic,turris-omnia-mcu.yaml
> >  	file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
> > 
> > doc reference errors (make refcheckdocs):
> > 
> > See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240424173809.7214-2-kabel@kernel.org
> > 
> > The base for the series is generally the latest rc1. A different dependency
> > should be noted in *this* patch.
> > 
> > If you already ran 'make dt_binding_check' and didn't see the above
> > error(s), then make sure 'yamllint' is installed and dt-schema is up to
> > date:
> > 
> > pip3 install dtschema --upgrade
> > 
> > Please check and re-submit after running the above command yourself. Note
> > that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> > your schema. However, it must be unset to test all examples with your schema.
> > 
> 
> Sigh. I moved the patch bud did not change it in $id...

A bit needless, given you've got a tag from Krzysztof, but with that fixed
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node
  2024-04-24 17:38 ` [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
@ 2024-04-26 16:01   ` Gregory CLEMENT
  2024-04-26 16:40     ` Marek Behún
  0 siblings, 1 reply; 13+ messages in thread
From: Gregory CLEMENT @ 2024-04-26 16:01 UTC (permalink / raw)
  To: Marek Behún, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen
  Cc: Marek Behún, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

Hello Marek,

> Turris Omnia's MCU provides various features that can be configured over
> I2C at address 0x2a. Add device-tree node.
>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")

Is it really a fix ?

It seems that the node you add depends on the firmware support that was
not yet added.

Gregory

> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
>  .../dts/marvell/armada-385-turris-omnia.dts   | 22 ++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> index 7b755bb4e4e7..59079d63fe27 100644
> --- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> @@ -218,7 +218,22 @@ i2c@0 {
>  			#size-cells = <0>;
>  			reg = <0>;
>  
> -			/* STM32F0 command interface at address 0x2a */
> +			mcu: system-controller@2a {
> +				compatible = "cznic,turris-omnia-mcu";
> +				reg = <0x2a>;
> +
> +				pinctrl-names = "default";
> +				pinctrl-0 = <&mcu_pins>;
> +
> +				interrupt-parent = <&gpio1>;
> +				interrupts = <11 IRQ_TYPE_NONE>;
> +
> +				gpio-controller;
> +				#gpio-cells = <3>;
> +
> +				interrupt-controller;
> +				#interrupt-cells = <2>;
> +			};
>  
>  			led-controller@2b {
>  				compatible = "cznic,turris-omnia-leds";
> @@ -501,6 +516,11 @@ fixed-link {
>  };
>  
>  &pinctrl {
> +	mcu_pins: mcu-pins {
> +		marvell,pins = "mpp43";
> +		marvell,function = "gpio";
> +	};
> +
>  	pcawan_pins: pcawan-pins {
>  		marvell,pins = "mpp46";
>  		marvell,function = "gpio";
> -- 
> 2.43.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button
  2024-04-24 17:38 ` [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
@ 2024-04-26 16:02   ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2024-04-26 16:02 UTC (permalink / raw)
  To: Marek Behún, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen
  Cc: Marek Behún, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

Hello Marek,

> Now that we have the MCU device-tree node, which acts as a GPIO
> controller, add GPIO key node for the front button.
>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")

Same as previous patch is it really a fix ?

Gregory

> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
>  .../boot/dts/marvell/armada-385-turris-omnia.dts    | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> index 59079d63fe27..43202890c959 100644
> --- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> @@ -112,6 +112,19 @@ sfp: sfp {
>  		status = "disabled";
>  	};
>  
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +
> +		front-button {
> +			label = "Front Button";
> +			linux,code = <KEY_VENDOR>;
> +			linux,can-disable;
> +			gpios = <&mcu 0 12 GPIO_ACTIVE_HIGH>;
> +			/* debouncing is done by the microcontroller */
> +			debounce-interval = <0>;
> +		};
> +	};
> +
>  	sound {
>  		compatible = "simple-audio-card";
>  		simple-audio-card,name = "SPDIF";
> -- 
> 2.43.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 0/9] Turris Omnia MCU driver
  2024-04-24 17:37 [PATCH v7 0/9] Turris Omnia MCU driver Marek Behún
                   ` (2 preceding siblings ...)
  2024-04-24 17:38 ` [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
@ 2024-04-26 16:13 ` Gregory CLEMENT
  2024-04-30 11:54   ` Marek Behún
  3 siblings, 1 reply; 13+ messages in thread
From: Gregory CLEMENT @ 2024-04-26 16:13 UTC (permalink / raw)
  To: Marek Behún, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen, Alessandro Zummo,
	Alexandre Belloni, Bartosz Golaszewski, Christophe JAILLET,
	Dan Carpenter, devicetree, Greg Kroah-Hartman, Guenter Roeck,
	Herbert Xu, Krzysztof Kozlowski, Linus Walleij, linux-crypto,
	linux-gpio, linux-rtc, linux-watchdog, Olivia Mackall,
	Rob Herring, Wim Van Sebroeck
  Cc: Marek Behún, Andrew Lunn, Conor Dooley, Krzysztof Kozlowski,
	Rob Herring, Sebastian Hesselbarth, Uwe Kleine-König

Hello all,

> Hello Andy, Hans, Ilpo, Arnd, Gregory, and others,
>
> this is v7 of the series adding Turris Omnia MCU driver.
>
> This series depends on the immutable branch between LEDs and locking,
> introducing devm_mutex_init(), see the PR
>   https://lore.kernel.org/linux-leds/20240412084616.GR2399047@google.com/
>
> See also cover letters for v1, v2, v3, v4, v5 and v6:
>   https://patchwork.kernel.org/project/linux-soc/cover/20230823161012.6986-1-kabel@kernel.org/
>   https://patchwork.kernel.org/project/linux-soc/cover/20230919103815.16818-1-kabel@kernel.org/
>   https://patchwork.kernel.org/project/linux-soc/cover/20231023143130.11602-1-kabel@kernel.org/
>   https://patchwork.kernel.org/project/linux-soc/cover/20231026161803.16750-1-kabel@kernel.org/
>   https://patchwork.kernel.org/project/linux-soc/cover/20240323164359.21642-1-kabel@kernel.org/
>   https://patchwork.kernel.org/project/linux-soc/cover/20240418121116.22184-1-kabel@kernel.org/
>
> Changes since v6:
> - moved the DT binding from arm/cznic,turris-omnia-mcu.yaml to
>   firmware/cznic,turris-omnia-mcu.yaml, as suggested by Conor Dooley
>   (patch 1)
> - dropped the devm-helpers.h additions, for the reasons see
>   https://lore.kernel.org/soc/20240423184346.37eb0915@thinkpad/
> - use gpiod_to_irq(gpiochip_get_desc(...)) instead of
>   irq_create_mapping(), as suggested by Andy Shevchenko (patches 6 and
>   7)
> - added a dummy read of TRNG entropy when registering TRNG, in case
>   someone cleared the TRNG interrupt before probing the driver, but did
>   not read the entropy (the MCU won't send a new TRNG interrupt if the
>   entropy is not collected) (patch 6)
> - fixed a bug in TRNG probing, wherein if the 
>
> Marek Behún (9):
>   dt-bindings: arm: add cznic,turris-omnia-mcu binding
>   platform: cznic: Add preliminary support for Turris Omnia MCU
>   platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs
>   platform: cznic: turris-omnia-mcu: Add support for poweroff and wakeup
>   platform: cznic: turris-omnia-mcu: Add support for MCU watchdog
>   platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG
>   platform: cznic: turris-omnia-mcu: Add support for digital message
>     signing via debugfs

It is still early as there are some comment pending but I wonder who
will responsible of merging all theses patches ?

Arnd ? Hans ? Ilpo ? me ?

Gregory


>   ARM: dts: turris-omnia: Add MCU system-controller node
>   ARM: dts: turris-omnia: Add GPIO key node for front button
>
>  .../ABI/testing/debugfs-turris-omnia-mcu      |   13 +
>  .../sysfs-bus-i2c-devices-turris-omnia-mcu    |  126 ++
>  .../firmware/cznic,turris-omnia-mcu.yaml      |   86 ++
>  MAINTAINERS                                   |    5 +
>  .../dts/marvell/armada-385-turris-omnia.dts   |   35 +-
>  drivers/platform/Kconfig                      |    2 +
>  drivers/platform/Makefile                     |    1 +
>  drivers/platform/cznic/Kconfig                |   51 +
>  drivers/platform/cznic/Makefile               |    9 +
>  .../platform/cznic/turris-omnia-mcu-base.c    |  439 +++++++
>  .../platform/cznic/turris-omnia-mcu-debugfs.c |  216 ++++
>  .../platform/cznic/turris-omnia-mcu-gpio.c    | 1047 +++++++++++++++++
>  .../cznic/turris-omnia-mcu-sys-off-wakeup.c   |  258 ++++
>  .../platform/cznic/turris-omnia-mcu-trng.c    |  109 ++
>  .../cznic/turris-omnia-mcu-watchdog.c         |  123 ++
>  drivers/platform/cznic/turris-omnia-mcu.h     |  188 +++
>  include/linux/turris-omnia-mcu-interface.h    |  249 ++++
>  17 files changed, 2956 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/ABI/testing/debugfs-turris-omnia-mcu
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-turris-omnia-mcu
>  create mode 100644 Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml
>  create mode 100644 drivers/platform/cznic/Kconfig
>  create mode 100644 drivers/platform/cznic/Makefile
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-base.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-debugfs.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-gpio.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-sys-off-wakeup.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-trng.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu-watchdog.c
>  create mode 100644 drivers/platform/cznic/turris-omnia-mcu.h
>  create mode 100644 include/linux/turris-omnia-mcu-interface.h
>
> -- 
> 2.43.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node
  2024-04-26 16:01   ` Gregory CLEMENT
@ 2024-04-26 16:40     ` Marek Behún
  2024-04-26 18:21       ` Andrew Lunn
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Behún @ 2024-04-26 16:40 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Arnd Bergmann, soc, arm, Andy Shevchenko, Hans de Goede,
	Ilpo Järvinen, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

On Fri, 26 Apr 2024 18:01:20 +0200
Gregory CLEMENT <gregory.clement@bootlin.com> wrote:

> Hello Marek,
> 
> > Turris Omnia's MCU provides various features that can be configured over
> > I2C at address 0x2a. Add device-tree node.
> >
> > Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")  
> 
> Is it really a fix ?
> 
> It seems that the node you add depends on the firmware support that was
> not yet added.
> 
> Gregory

It is a fix in the sense that Omnia always had the MCU, and so
device-tree without the MCU node was incorrect.

Since device-trees should be (if possible) backwards and forwards
compatible, this should not be a problem.

But I am guessing it might be because of what new U-Boot does: if it
finds the MCU node in the device-tree, it will add a reset gpio property
for ethernet PHY, linking it to the MCU node. So if this
patch got backported to older kernel where the MCU driver is not
present, and the board had this new U-Boot, the kernel would not create
the eth2 interface, because it would be waiting for a driver providing
the GPIO.

So hmm, maybe I should drop the Fixes tag.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node
  2024-04-26 16:40     ` Marek Behún
@ 2024-04-26 18:21       ` Andrew Lunn
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2024-04-26 18:21 UTC (permalink / raw)
  To: Marek Behún
  Cc: Gregory CLEMENT, Arnd Bergmann, soc, arm, Andy Shevchenko,
	Hans de Goede, Ilpo Järvinen, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, devicetree

> But I am guessing it might be because of what new U-Boot does: if it
> finds the MCU node in the device-tree, it will add a reset gpio property
> for ethernet PHY, linking it to the MCU node. So if this
> patch got backported to older kernel where the MCU driver is not
> present, and the board had this new U-Boot, the kernel would not create
> the eth2 interface, because it would be waiting for a driver providing
> the GPIO.

You should make this clear in the commit message. There is a danger
the ML algorithm which picks patches for back porting decides this is
a candidate. Hopefully a human will read the commit message and then
reject it.

       Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7 0/9] Turris Omnia MCU driver
  2024-04-26 16:13 ` [PATCH v7 0/9] Turris Omnia MCU driver Gregory CLEMENT
@ 2024-04-30 11:54   ` Marek Behún
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Behún @ 2024-04-30 11:54 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Arnd Bergmann, soc, arm, Andy Shevchenko, Hans de Goede,
	Ilpo Järvinen, Alessandro Zummo, Alexandre Belloni,
	Bartosz Golaszewski, Christophe JAILLET, Dan Carpenter,
	devicetree, Greg Kroah-Hartman, Guenter Roeck, Herbert Xu,
	Krzysztof Kozlowski, Linus Walleij, linux-crypto, linux-gpio,
	linux-rtc, linux-watchdog, Olivia Mackall, Rob Herring,
	Wim Van Sebroeck, Andrew Lunn, Conor Dooley, Krzysztof Kozlowski,
	Rob Herring, Sebastian Hesselbarth, Uwe Kleine-König

On Fri, 26 Apr 2024 18:13:32 +0200
Gregory CLEMENT <gregory.clement@bootlin.com> wrote:

> Hello all,
>
...
> 
> It is still early as there are some comment pending but I wonder who
> will responsible of merging all theses patches ?
> 
> Arnd ? Hans ? Ilpo ? me ?

I am assigning these patches to Arnd on patchwork all this time, so I
guess it could be him, unless he has a problem with this?

I've just sent v8.

Marek

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-04-30 11:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 17:37 [PATCH v7 0/9] Turris Omnia MCU driver Marek Behún
2024-04-24 17:38 ` [PATCH v7 1/9] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
2024-04-24 18:16   ` Rob Herring
2024-04-24 18:22     ` Marek Behún
2024-04-25 17:18       ` Conor Dooley
2024-04-24 17:38 ` [PATCH v7 8/9] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
2024-04-26 16:01   ` Gregory CLEMENT
2024-04-26 16:40     ` Marek Behún
2024-04-26 18:21       ` Andrew Lunn
2024-04-24 17:38 ` [PATCH v7 9/9] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
2024-04-26 16:02   ` Gregory CLEMENT
2024-04-26 16:13 ` [PATCH v7 0/9] Turris Omnia MCU driver Gregory CLEMENT
2024-04-30 11:54   ` Marek Behún

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).