mbox series

[v9,0/9] Turris Omnia MCU driver

Message ID 20240508103118.23345-1-kabel@kernel.org (mailing list archive)
Headers show
Series Turris Omnia MCU driver | expand

Message

Marek Behún May 8, 2024, 10:31 a.m. UTC
Hello Andy, Hans, Ilpo, Arnd, Gregory, and others,

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

This series still 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, v6, v7 and v8:
  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/

Changes since v8:
- removed the MACH_ARMADA_38X || COMPILE_TEST dependency for the
  CZNIC_PLATFORMS Kconfig option in the Kconfig file, as suggested
  by Andy (patch 2)
- fixed the issues in the global header turris-omnia-mcu-interface.h
  pointed out by Andy and Ilpo: added the "OMNIA_" prefix to all
  enumerator entries, added trailing commas, converted to use
  FIELD_PREP_CONST() (patches 2-7)
- added comment why we can't use ether_addr_copy(), as requested by
  Andy (patch 2)
- rewritten the error message for when the MCU does not support
  reporting features, requested by Andy (patch 2)
- changed how the nul-byte is assigned to the end of bin2hex() result,
  requested by Andy (patch 2)
- made the omnia_cmd_write_read() function final in patch 2, instead of
  updating it in subsequent patches, requested by Andy
- in order to be more consistent, changed the omnia_cmd_read_u8() and
  omnia_cmd_read_u16() functions to return zero on success and the read
  value is passed into a pointer, and then added a new function
  omnia_cmd_read_u32(), as requested by Ilpo (he did not like the
  inconsistency in omnia_mcu_read_features(), where the
  omnia_cmd_read_u16() hid the le16_to_cpu() call, but then we did an
  explicit call to le32_to_cpu() when reading 32-bit features) (patch 2)
- some other minor tweaks (changed the version type from u8[] to char[],
  changed len type from size_t to unsigned int in omnia_cmd_write())
  (patches 2 & 3)
- dropped the "gpio%u." prefix from GPIO line names, Andy pointed out
  why this is wrong (patch 3)
- decoupled GPIOs information struct definition and assignment and put
  filling macros before the assignment, requested by Andy (patch 3)
- moved return value check into the guarded scope, suggested by Andy
  (patch 3)
- put some assignments into the definition lines, suggested by Andy
  (patch 3)
- fixed some typos (patches 2 & 3)
- refactored the reply length computation into a new function
  omnia_compute_reply_length(), as requested by Andy (patch 3)

Marek Behún (9):
  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
  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                |   50 +
 drivers/platform/cznic/Makefile               |    9 +
 .../platform/cznic/turris-omnia-mcu-base.c    |  451 +++++++
 .../platform/cznic/turris-omnia-mcu-debugfs.c |  207 ++++
 .../platform/cznic/turris-omnia-mcu-gpio.c    | 1040 +++++++++++++++++
 .../cznic/turris-omnia-mcu-sys-off-wakeup.c   |  258 ++++
 .../platform/cznic/turris-omnia-mcu-trng.c    |  103 ++
 .../cznic/turris-omnia-mcu-watchdog.c         |  127 ++
 drivers/platform/cznic/turris-omnia-mcu.h     |  210 ++++
 include/linux/turris-omnia-mcu-interface.h    |  249 ++++
 17 files changed, 2971 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

Comments

Andy Shevchenko May 8, 2024, 11:17 a.m. UTC | #1
On Wed, May 08, 2024 at 12:31:09PM +0200, Marek Behún wrote:
> Hello Andy, Hans, Ilpo, Arnd, Gregory, and others,
> 
> this is v9 of the series adding Turris Omnia MCU driver.
> 
> This series still 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, v6, v7 and v8:
>   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/

From GPIO implementation perspective, it's good enough in my opinion. The rest
can be amended later on.
Marek Behún May 8, 2024, 5:50 p.m. UTC | #2
On Wed, May 08, 2024 at 02:17:24PM +0300, Andy Shevchenko wrote:
> On Wed, May 08, 2024 at 12:31:09PM +0200, Marek Behún wrote:
> > Hello Andy, Hans, Ilpo, Arnd, Gregory, and others,
> > 
> > this is v9 of the series adding Turris Omnia MCU driver.
> > 
> > This series still 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, v6, v7 and v8:
> >   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/
> 
> From GPIO implementation perspective, it's good enough in my opinion. The rest
> can be amended later on.

I will send v10 tomorrow with these issues fixed. We'll see if Arnd will
be willing to take this for 6.10, and if not, 6.11 will it be.

Marek