Skip to content

Commit 992f1a3

Browse files
elkabloarndb
authored andcommitted
platform: cznic: Add preliminary support for Turris Omnia MCU
Add the basic skeleton for a new platform driver for the microcontroller found on the Turris Omnia board. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Bartosz Golaszewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent f5e6f47 commit 992f1a3

File tree

9 files changed

+833
-0
lines changed

9 files changed

+833
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
What: /sys/bus/i2c/devices/<mcu_device>/board_revision
2+
Date: September 2024
3+
KernelVersion: 6.11
4+
Contact: Marek Behún <[email protected]>
5+
Description: (RO) Contains board revision number.
6+
7+
Only available if board information is burned in the MCU (older
8+
revisions have board information burned in the ATSHA204-A chip).
9+
10+
Format: %u.
11+
12+
What: /sys/bus/i2c/devices/<mcu_device>/first_mac_address
13+
Date: September 2024
14+
KernelVersion: 6.11
15+
Contact: Marek Behún <[email protected]>
16+
Description: (RO) Contains device first MAC address. Each Turris Omnia is
17+
allocated 3 MAC addresses. The two additional addresses are
18+
computed from the first one by incrementing it.
19+
20+
Only available if board information is burned in the MCU (older
21+
revisions have board information burned in the ATSHA204-A chip).
22+
23+
Format: %pM.
24+
25+
What: /sys/bus/i2c/devices/<mcu_device>/fw_features
26+
Date: September 2024
27+
KernelVersion: 6.11
28+
Contact: Marek Behún <[email protected]>
29+
Description: (RO) Newer versions of the microcontroller firmware report the
30+
features they support. These can be read from this file. If the
31+
MCU firmware is too old, this file reads 0x0.
32+
33+
Format: 0x%x.
34+
35+
What: /sys/bus/i2c/devices/<mcu_device>/fw_version_hash_application
36+
Date: September 2024
37+
KernelVersion: 6.11
38+
Contact: Marek Behún <[email protected]>
39+
Description: (RO) Contains the version hash (commit hash) of the application
40+
part of the microcontroller firmware.
41+
42+
Format: %s.
43+
44+
What: /sys/bus/i2c/devices/<mcu_device>/fw_version_hash_bootloader
45+
Date: September 2024
46+
KernelVersion: 6.11
47+
Contact: Marek Behún <[email protected]>
48+
Description: (RO) Contains the version hash (commit hash) of the bootloader
49+
part of the microcontroller firmware.
50+
51+
Format: %s.
52+
53+
What: /sys/bus/i2c/devices/<mcu_device>/mcu_type
54+
Date: September 2024
55+
KernelVersion: 6.11
56+
Contact: Marek Behún <[email protected]>
57+
Description: (RO) Contains the microcontroller type (STM32, GD32, MKL).
58+
59+
Format: %s.
60+
61+
What: /sys/bus/i2c/devices/<mcu_device>/reset_selector
62+
Date: September 2024
63+
KernelVersion: 6.11
64+
Contact: Marek Behún <[email protected]>
65+
Description: (RO) Contains the selected factory reset level, determined by
66+
how long the rear reset button was held by the user during board
67+
reset.
68+
69+
Format: %i.
70+
71+
What: /sys/bus/i2c/devices/<mcu_device>/serial_number
72+
Date: September 2024
73+
KernelVersion: 6.11
74+
Contact: Marek Behún <[email protected]>
75+
Description: (RO) Contains the 64-bit board serial number in hexadecimal
76+
format.
77+
78+
Only available if board information is burned in the MCU (older
79+
revisions have board information burned in the ATSHA204-A chip).
80+
81+
Format: %016X.

MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,7 @@ M: Marek Behún <[email protected]>
22062206
S: Maintained
22072207
W: https://www.turris.cz/
22082208
F: Documentation/ABI/testing/debugfs-moxtet
2209+
F: Documentation/ABI/testing/sysfs-bus-i2c-devices-turris-omnia-mcu
22092210
F: Documentation/ABI/testing/sysfs-bus-moxtet-devices
22102211
F: Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm
22112212
F: Documentation/devicetree/bindings/bus/moxtet.txt
@@ -2219,10 +2220,12 @@ F: drivers/firmware/turris-mox-rwtm.c
22192220
F: drivers/gpio/gpio-moxtet.c
22202221
F: drivers/leds/leds-turris-omnia.c
22212222
F: drivers/mailbox/armada-37xx-rwtm-mailbox.c
2223+
F: drivers/platform/cznic/
22222224
F: drivers/watchdog/armada_37xx_wdt.c
22232225
F: include/dt-bindings/bus/moxtet.h
22242226
F: include/linux/armada-37xx-rwtm-mailbox.h
22252227
F: include/linux/moxtet.h
2228+
F: include/linux/turris-omnia-mcu-interface.h
22262229

22272230
ARM/FARADAY FA526 PORT
22282231
M: Hans Ulli Kroll <[email protected]>

drivers/platform/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ source "drivers/platform/goldfish/Kconfig"
77

88
source "drivers/platform/chrome/Kconfig"
99

10+
source "drivers/platform/cznic/Kconfig"
11+
1012
source "drivers/platform/mellanox/Kconfig"
1113

1214
source "drivers/platform/olpc/Kconfig"

drivers/platform/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ obj-$(CONFIG_MIPS) += mips/
1010
obj-$(CONFIG_OLPC_EC) += olpc/
1111
obj-$(CONFIG_GOLDFISH) += goldfish/
1212
obj-$(CONFIG_CHROME_PLATFORMS) += chrome/
13+
obj-$(CONFIG_CZNIC_PLATFORMS) += cznic/
1314
obj-$(CONFIG_SURFACE_PLATFORMS) += surface/
1415
obj-$(CONFIG_ARM64) += arm64/

drivers/platform/cznic/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# For a description of the syntax of this configuration file,
4+
# see Documentation/kbuild/kconfig-language.rst.
5+
#
6+
7+
menuconfig CZNIC_PLATFORMS
8+
bool "Platform support for CZ.NIC's Turris hardware"
9+
help
10+
Say Y here to be able to choose driver support for CZ.NIC's Turris
11+
devices. This option alone does not add any kernel code.
12+
13+
if CZNIC_PLATFORMS
14+
15+
config TURRIS_OMNIA_MCU
16+
tristate "Turris Omnia MCU driver"
17+
depends on MACH_ARMADA_38X || COMPILE_TEST
18+
depends on I2C
19+
help
20+
Say Y here to add support for the features implemented by the
21+
microcontroller on the CZ.NIC's Turris Omnia SOHO router.
22+
To compile this driver as a module, choose M here; the module will be
23+
called turris-omnia-mcu.
24+
25+
endif # CZNIC_PLATFORMS

drivers/platform/cznic/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
3+
obj-$(CONFIG_TURRIS_OMNIA_MCU) += turris-omnia-mcu.o
4+
turris-omnia-mcu-y := turris-omnia-mcu-base.o

0 commit comments

Comments
 (0)