mbox series

[0/7] Drivers to support the MCU on QNAP NAS devices

Message ID 20240725194539.1780790-1-heiko@sntech.de
Headers show
Series Drivers to support the MCU on QNAP NAS devices | expand

Message

Heiko Stuebner July 25, 2024, 7:45 p.m. UTC
This implements a set of drivers for the MCU used on QNAP NAS devices.

Of course no documentation for the serial protocol is available, so
thankfully QNAP has a tool on their rescue-inird to talk to the MCU and
I found interceptty [0] to listen to what goes over the serial connection.

In general it looks like there are two different generations in general,
an "EC" device and now this "MCU" - referenced in the strings of the
userspace handlers for those devices.

For the MCU "SPEC3" and "SPEC4" are listed which is configured in
the model.conf of the device. When setting the value from SPEC4 to
SPEC3 on my TS433, the supported commands change, but the command
interface stays the same and especially the version command is the
same.

The binding also does not expose any interals of the device that
might change, so hopefully there shouldn't be big roadblocks to
support different devices, apart from possibly adapting the commands.


[0] https://github.com/geoffmeyers/interceptty

Heiko Stuebner (7):
  dt-bindings: mfd: add binding for qnap,mcu devices
  mfd: add base driver for qnap-mcu devices
  leds: add driver for LEDs from qnap-mcu devices
  Input: add driver for the input part of qnap-mcu devices
  hwmon: add driver for the hwmon parts of qnap-mcu devices
  arm64: dts: rockchip: hook up the MCU on the QNAP TS433
  arm64: dts: rockchip: set hdd led labels on qnap-ts433

 .../devicetree/bindings/mfd/qnap,mcu.yaml     |  43 +++
 .../boot/dts/rockchip/rk3568-qnap-ts433.dts   |  58 +++
 drivers/hwmon/Kconfig                         |  12 +
 drivers/hwmon/Makefile                        |   1 +
 drivers/hwmon/qnap-mcu-hwmon.c                | 352 +++++++++++++++++
 drivers/input/misc/Kconfig                    |  12 +
 drivers/input/misc/Makefile                   |   1 +
 drivers/input/misc/qnap-mcu-input.c           | 156 ++++++++
 drivers/leds/Kconfig                          |  11 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-qnap-mcu.c                  | 247 ++++++++++++
 drivers/mfd/Kconfig                           |  10 +
 drivers/mfd/Makefile                          |   2 +
 drivers/mfd/qnap-mcu.c                        | 356 ++++++++++++++++++
 include/linux/mfd/qnap-mcu.h                  |  28 ++
 15 files changed, 1290 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/qnap,mcu.yaml
 create mode 100644 drivers/hwmon/qnap-mcu-hwmon.c
 create mode 100644 drivers/input/misc/qnap-mcu-input.c
 create mode 100644 drivers/leds/leds-qnap-mcu.c
 create mode 100644 drivers/mfd/qnap-mcu.c
 create mode 100644 include/linux/mfd/qnap-mcu.h

Comments

Krzysztof Kozlowski July 26, 2024, 10:04 a.m. UTC | #1
On 25/07/2024 21:45, Heiko Stuebner wrote:
> These MCUs can be found in network attached storage devices made by QNAP.
> They are connected to a serial port of the host device and provide
> functionality like LEDs, power-control and temperature monitoring.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  .../devicetree/bindings/mfd/qnap,mcu.yaml     | 43 +++++++++++++++++++
>  1 file changed, 43 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/qnap,mcu.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/qnap,mcu.yaml b/Documentation/devicetree/bindings/mfd/qnap,mcu.yaml
> new file mode 100644
> index 0000000000000..3b1ad8cb54da3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/qnap,mcu.yaml

qnap,ts433-mcu.yaml

> @@ -0,0 +1,43 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/qnap,mcu.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: QNAP NAS on-board Microcontroller
> +
> +maintainers:
> +  - Heiko Stuebner <heiko@sntech.de>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  QNAP embeds a microcontroller on their NAS devices adding system feature
> +  as PWM Fan control, additional LEDs, power button status and more.
> +

With two above:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof