1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c), Vaisala Oyj
6 #ifndef REBOOT_MODE_REBOOT_MODE_H__
7 #define REBOOT_MODE_REBOOT_MODE_H__
10 #include <dm/device.h>
12 struct reboot_mode_mode {
13 const char *mode_name;
17 struct reboot_mode_uclass_platdata {
18 struct reboot_mode_mode *modes;
20 const char *env_variable;
23 struct reboot_mode_ops {
25 * get() - get the current reboot mode value
27 * Returns the current value from the reboot mode backing store.
29 * @dev: Device to read from
30 * @rebootmode: Address to save the current reboot mode value
32 int (*get)(struct udevice *dev, u32 *rebootmode);
35 * set() - set a reboot mode value
37 * Sets the value in the reboot mode backing store.
39 * @dev: Device to read from
40 * @rebootmode: New reboot mode value to store
42 int (*set)(struct udevice *dev, u32 rebootmode);
45 /* Access the operations for a reboot mode device */
46 #define reboot_mode_get_ops(dev) ((struct reboot_mode_ops *)(dev)->driver->ops)
49 * dm_reboot_mode_update() - Update the reboot mode env variable.
51 * @dev: Device to read from
52 * Return: 0 if OK, -ve on error
54 int dm_reboot_mode_update(struct udevice *dev);
56 #endif /* REBOOT_MODE_REBOOT_MODE_H__ */