* [PATCH v12 0/8] Turris Omnia MCU driver
@ 2024-06-17 15:25 Marek Behún
2024-06-17 15:25 ` [PATCH v12 1/8] dt-bindings: firmware: add cznic,turris-omnia-mcu binding Marek Behún
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Marek Behún @ 2024-06-17 15:25 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,
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 v12 of the series adding Turris Omnia MCU driver.
Changes since v11:
- fixed some includes, suggested by Andy
- moved #include <linux/turris-omnia-mcu-interface.h> after the other
includes, since it is domain specific, suggested by Andy
- in patch 2, use sizeof() of dest buffer in memcpy call, instead of
ETH_ALEN constant, as suggested by Andy
- in patch 3, dropped the .has_int member of omnia GPIO definition
structure, and added is_int_bit_valid() function instead, as suggested
by Andy
- in patch 3, changed int to unsigned int where appropriate, as
suggested by Andy
- in patch 3, fixed docstring indentation, suggested by Andy
- in patch 4 dropped #include <linux/rtc.h>, and instead declared struct
rtc_device, it is only used as a pointer, suggested by Andy
- in patch 5, renamed the completion from trng_completion to
trng_entropy_available
- in patch 5, use gpio_device_get_desc() instead of gpiochip_get_desc()
when mapping IRQ (as discussed with Andy and Bart)
- in patch 5, dropped setting the priv member of hwrng, and instead use
container_of() to get the driver private structure, suggested by
Herbert
Links to previous cover letters (v1 to v11):
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/
https://patchwork.kernel.org/project/linux-soc/cover/20240424173809.7214-1-kabel@kernel.org/
https://patchwork.kernel.org/project/linux-soc/cover/20240430115111.3453-1-kabel@kernel.org/
https://patchwork.kernel.org/project/linux-soc/cover/20240508103118.23345-1-kabel@kernel.org/
https://patchwork.kernel.org/project/linux-soc/cover/20240510101819.13551-1-kabel@kernel.org/
https://patchwork.kernel.org/project/linux-soc/cover/20240605161851.13911-1-kabel@kernel.org/
Marek Behún (8):
dt-bindings: firmware: 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
ARM: dts: turris-omnia: Add MCU system-controller node
ARM: dts: turris-omnia: Add GPIO key node for front button
.../sysfs-bus-i2c-devices-turris-omnia-mcu | 113 ++
.../firmware/cznic,turris-omnia-mcu.yaml | 86 ++
MAINTAINERS | 4 +
.../dts/marvell/armada-385-turris-omnia.dts | 35 +-
drivers/platform/Kconfig | 2 +
drivers/platform/Makefile | 1 +
drivers/platform/cznic/Kconfig | 48 +
drivers/platform/cznic/Makefile | 8 +
.../platform/cznic/turris-omnia-mcu-base.c | 408 +++++++
.../platform/cznic/turris-omnia-mcu-gpio.c | 1088 +++++++++++++++++
.../cznic/turris-omnia-mcu-sys-off-wakeup.c | 260 ++++
.../platform/cznic/turris-omnia-mcu-trng.c | 103 ++
.../cznic/turris-omnia-mcu-watchdog.c | 130 ++
drivers/platform/cznic/turris-omnia-mcu.h | 194 +++
include/linux/turris-omnia-mcu-interface.h | 249 ++++
15 files changed, 2728 insertions(+), 1 deletion(-)
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-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.44.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v12 1/8] dt-bindings: firmware: add cznic,turris-omnia-mcu binding
2024-06-17 15:25 [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
@ 2024-06-17 15:25 ` Marek Behún
2024-06-17 15:26 ` [PATCH v12 7/8] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-06-17 15:25 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, Conor Dooley
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>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
---
.../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..af9249695ef5
--- /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/firmware/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 cf9c9221c388..5496c8ec3e1d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2210,6 +2210,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.44.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v12 7/8] ARM: dts: turris-omnia: Add MCU system-controller node
2024-06-17 15:25 [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
2024-06-17 15:25 ` [PATCH v12 1/8] dt-bindings: firmware: add cznic,turris-omnia-mcu binding Marek Behún
@ 2024-06-17 15:26 ` Marek Behún
2024-06-17 15:26 ` [PATCH v12 8/8] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
2024-07-01 8:41 ` [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
3 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-06-17 15:26 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.
This does not carry a Fixes tag - we do not want this to get backported
to stable kernels for the following reason: U-Boot since v2022.10
inserts a phy-reset-gpio property into the WAN ethernet node pointing to
the MCU node if it finds the MCU node with a cznic,turris-omnia-mcu
compatible. Thus if this change got backported to a stable kernel, the
WAN interface driver would defer probe indefinitely (since it would wait
for the turris-omnia-mcu driver which would not be present).
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.44.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v12 8/8] ARM: dts: turris-omnia: Add GPIO key node for front button
2024-06-17 15:25 [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
2024-06-17 15:25 ` [PATCH v12 1/8] dt-bindings: firmware: add cznic,turris-omnia-mcu binding Marek Behún
2024-06-17 15:26 ` [PATCH v12 7/8] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
@ 2024-06-17 15:26 ` Marek Behún
2024-07-01 8:41 ` [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
3 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-06-17 15:26 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.
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.44.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v12 0/8] Turris Omnia MCU driver
2024-06-17 15:25 [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
` (2 preceding siblings ...)
2024-06-17 15:26 ` [PATCH v12 8/8] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
@ 2024-07-01 8:41 ` Marek Behún
2024-07-01 11:38 ` Marek Behún
3 siblings, 1 reply; 6+ messages in thread
From: Marek Behún @ 2024-07-01 8:41 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Gregory CLEMENT, 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,
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
Hi Arnd,
will you be merging this series?
Thanks.
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v12 0/8] Turris Omnia MCU driver
2024-07-01 8:41 ` [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
@ 2024-07-01 11:38 ` Marek Behún
0 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-01 11:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Gregory CLEMENT, 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,
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 Mon, 1 Jul 2024 10:41:15 +0200
Marek Behún <kabel@kernel.org> wrote:
> Hi Arnd,
>
> will you be merging this series?
Just to clear up, I wanted to ask whether you will be merging or
someone else should take stuff to drivers/platform.
Anyway, I sent v13 with one more cosmetic change, requested by Bart.
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-01 11:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 15:25 [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
2024-06-17 15:25 ` [PATCH v12 1/8] dt-bindings: firmware: add cznic,turris-omnia-mcu binding Marek Behún
2024-06-17 15:26 ` [PATCH v12 7/8] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
2024-06-17 15:26 ` [PATCH v12 8/8] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
2024-07-01 8:41 ` [PATCH v12 0/8] Turris Omnia MCU driver Marek Behún
2024-07-01 11:38 ` 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).