Skip to content

Commit 019f87f

Browse files
elkabloarndb
authored andcommitted
platform: cznic: turris-omnia-mcu: Make watchdog code optional
Make the watchdog part of the driver optional, under a boolean config option. Move the dependency to WATCHDOG to this new option, and change the WATCHDOG_CORE dependency to selection, as is done in most watchdog drivers. This makes the turris-omnia-mcu driver available for compilation even if WATCHDOG is disabled. Fixes: ed46f1f ("platform: cznic: turris-omnia-mcu: fix Kconfig dependencies") Signed-off-by: Marek Behún <kabel@kernel.org> Link: https://lore.kernel.org/r/20240719085756.30598-2-kabel@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 8400291 commit 019f87f

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

drivers/platform/cznic/Kconfig

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ config TURRIS_OMNIA_MCU
1717
depends on MACH_ARMADA_38X || COMPILE_TEST
1818
depends on I2C
1919
depends on OF
20-
depends on WATCHDOG
2120
depends on GPIOLIB
2221
depends on HW_RANDOM
2322
depends on RTC_CLASS
24-
depends on WATCHDOG_CORE
2523
select GPIOLIB_IRQCHIP
2624
help
2725
Say Y here to add support for the features implemented by the
@@ -31,7 +29,6 @@ config TURRIS_OMNIA_MCU
3129
disabled) and the ability to configure wake up from this mode (via
3230
rtcwake)
3331
- true random number generator (if available on the MCU)
34-
- MCU watchdog
3532
- GPIO pins
3633
- to get front button press events (the front button can be
3734
configured either to generate press events to the CPU or to change
@@ -44,7 +41,21 @@ config TURRIS_OMNIA_MCU
4441
to be able to program SOC's OTP on board revisions 32+
4542
- to get input from the LED output pins of the WAN ethernet PHY, LAN
4643
switch and MiniPCIe ports
44+
Other features can be enabled by subsequent config options.
4745
To compile this driver as a module, choose M here; the module will be
4846
called turris-omnia-mcu.
4947

48+
if TURRIS_OMNIA_MCU
49+
50+
config TURRIS_OMNIA_MCU_WATCHDOG
51+
bool "Turris Omnia MCU watchdog"
52+
default y
53+
depends on WATCHDOG
54+
select WATCHDOG_CORE
55+
help
56+
Say Y here to add support for watchdog provided by CZ.NIC's Turris
57+
Omnia MCU.
58+
59+
endif # TURRIS_OMNIA_MCU
60+
5061
endif # CZNIC_PLATFORMS

drivers/platform/cznic/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ turris-omnia-mcu-y := turris-omnia-mcu-base.o
55
turris-omnia-mcu-y += turris-omnia-mcu-gpio.o
66
turris-omnia-mcu-y += turris-omnia-mcu-sys-off-wakeup.o
77
turris-omnia-mcu-y += turris-omnia-mcu-trng.o
8-
turris-omnia-mcu-y += turris-omnia-mcu-watchdog.o
8+
turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_WATCHDOG) += turris-omnia-mcu-watchdog.o

drivers/platform/cznic/turris-omnia-mcu.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ struct omnia_mcu {
4747
u32 rtc_alarm;
4848
bool front_button_poweron;
4949

50+
#ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
5051
/* MCU watchdog */
5152
struct watchdog_device wdt;
53+
#endif
5254

5355
/* true random number generator */
5456
struct hwrng trng;
@@ -189,6 +191,14 @@ extern const struct attribute_group omnia_mcu_poweroff_group;
189191
int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu);
190192
int omnia_mcu_register_sys_off_and_wakeup(struct omnia_mcu *mcu);
191193
int omnia_mcu_register_trng(struct omnia_mcu *mcu);
194+
195+
#ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
192196
int omnia_mcu_register_watchdog(struct omnia_mcu *mcu);
197+
#else
198+
static inline int omnia_mcu_register_watchdog(struct omnia_mcu *mcu)
199+
{
200+
return 0;
201+
}
202+
#endif
193203

194204
#endif /* __TURRIS_OMNIA_MCU_H */

0 commit comments

Comments
 (0)