Lines Matching +full:turris +full:- +full:omnia +full:- +full:mcu

1 // SPDX-License-Identifier: GPL-2.0
3 * CZ.NIC's Turris Omnia MCU watchdog driver
16 #include <linux/turris-omnia-mcu-interface.h>
17 #include "turris-omnia-mcu.h"
32 struct omnia_mcu *mcu = watchdog_get_drvdata(wdt); in omnia_wdt_start() local
34 return omnia_cmd_write_u8(mcu->client, OMNIA_CMD_SET_WATCHDOG_STATE, 1); in omnia_wdt_start()
39 struct omnia_mcu *mcu = watchdog_get_drvdata(wdt); in omnia_wdt_stop() local
41 return omnia_cmd_write_u8(mcu->client, OMNIA_CMD_SET_WATCHDOG_STATE, 0); in omnia_wdt_stop()
46 struct omnia_mcu *mcu = watchdog_get_drvdata(wdt); in omnia_wdt_ping() local
48 return omnia_cmd_write_u8(mcu->client, OMNIA_CMD_SET_WATCHDOG_STATE, 1); in omnia_wdt_ping()
54 struct omnia_mcu *mcu = watchdog_get_drvdata(wdt); in omnia_wdt_set_timeout() local
56 return omnia_cmd_write_u16(mcu->client, OMNIA_CMD_SET_WDT_TIMEOUT, in omnia_wdt_set_timeout()
62 struct omnia_mcu *mcu = watchdog_get_drvdata(wdt); in omnia_wdt_get_timeleft() local
66 err = omnia_cmd_read_u16(mcu->client, OMNIA_CMD_GET_WDT_TIMELEFT, in omnia_wdt_get_timeleft()
69 dev_err(&mcu->client->dev, "Cannot get watchdog timeleft: %d\n", in omnia_wdt_get_timeleft()
79 .identity = "Turris Omnia MCU Watchdog",
91 int omnia_mcu_register_watchdog(struct omnia_mcu *mcu) in omnia_mcu_register_watchdog() argument
93 struct device *dev = &mcu->client->dev; in omnia_mcu_register_watchdog()
97 if (!(mcu->features & OMNIA_FEAT_WDT_PING)) in omnia_mcu_register_watchdog()
100 mcu->wdt.info = &omnia_wdt_info; in omnia_mcu_register_watchdog()
101 mcu->wdt.ops = &omnia_wdt_ops; in omnia_mcu_register_watchdog()
102 mcu->wdt.parent = dev; in omnia_mcu_register_watchdog()
103 mcu->wdt.min_timeout = 1; in omnia_mcu_register_watchdog()
104 mcu->wdt.max_timeout = 65535 / DECI; in omnia_mcu_register_watchdog()
106 mcu->wdt.timeout = WATCHDOG_TIMEOUT; in omnia_mcu_register_watchdog()
107 watchdog_init_timeout(&mcu->wdt, timeout, dev); in omnia_mcu_register_watchdog()
109 watchdog_set_drvdata(&mcu->wdt, mcu); in omnia_mcu_register_watchdog()
111 omnia_wdt_set_timeout(&mcu->wdt, mcu->wdt.timeout); in omnia_mcu_register_watchdog()
113 err = omnia_cmd_read_u8(mcu->client, OMNIA_CMD_GET_WATCHDOG_STATE, in omnia_mcu_register_watchdog()
117 "Cannot get MCU watchdog state\n"); in omnia_mcu_register_watchdog()
120 set_bit(WDOG_HW_RUNNING, &mcu->wdt.status); in omnia_mcu_register_watchdog()
122 watchdog_set_nowayout(&mcu->wdt, nowayout); in omnia_mcu_register_watchdog()
123 watchdog_stop_on_reboot(&mcu->wdt); in omnia_mcu_register_watchdog()
124 err = devm_watchdog_register_device(dev, &mcu->wdt); in omnia_mcu_register_watchdog()
127 "Cannot register MCU watchdog\n"); in omnia_mcu_register_watchdog()