reboot-mode.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c), Vaisala Oyj
  4. */
  5. #ifndef REBOOT_MODE_REBOOT_MODE_H__
  6. #define REBOOT_MODE_REBOOT_MODE_H__
  7. #include <asm/types.h>
  8. #include <dm/device.h>
  9. struct reboot_mode_mode {
  10. const char *mode_name;
  11. u32 mode_id;
  12. };
  13. struct reboot_mode_uclass_platdata {
  14. struct reboot_mode_mode *modes;
  15. u8 count;
  16. const char *env_variable;
  17. };
  18. struct reboot_mode_ops {
  19. /**
  20. * get() - get the current reboot mode value
  21. *
  22. * Returns the current value from the reboot mode backing store.
  23. *
  24. * @dev: Device to read from
  25. * @rebootmode: Address to save the current reboot mode value
  26. */
  27. int (*get)(struct udevice *dev, u32 *rebootmode);
  28. /**
  29. * set() - set a reboot mode value
  30. *
  31. * Sets the value in the reboot mode backing store.
  32. *
  33. * @dev: Device to read from
  34. * @rebootmode: New reboot mode value to store
  35. */
  36. int (*set)(struct udevice *dev, u32 rebootmode);
  37. };
  38. /* Access the operations for a reboot mode device */
  39. #define reboot_mode_get_ops(dev) ((struct reboot_mode_ops *)(dev)->driver->ops)
  40. /**
  41. * dm_reboot_mode_update() - Update the reboot mode env variable.
  42. *
  43. * @dev: Device to read from
  44. * @return 0 if OK, -ve on error
  45. */
  46. int dm_reboot_mode_update(struct udevice *dev);
  47. #endif /* REBOOT_MODE_REBOOT_MODE_H__ */