1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 09:42:22 +02:00

reboot-mode: read the boot mode from GPIOs status

A use case for controlling the boot mode is when the user wants
to control the device boot by pushing a button without needing to
go in user-space.

Add a new backed for reboot mode where GPIOs are used to control the
reboot-mode. The driver is able to scan a predefined list of GPIOs
and return the magic value. Having the modes associated with
the magic value generated based on the GPIO values, allows the
reboot mode uclass to select the proper mode.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Nandor Han
2021-06-10 16:56:44 +03:00
committed by Tom Rini
parent 2541ce2c1a
commit f9db2f16cb
9 changed files with 243 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) Vaisala Oyj.
*/
#ifndef REBOOT_MODE_REBOOT_MODE_GPIO_H_
#define REBOOT_MODE_REBOOT_MODE_GPIO_H_
#include <asm/gpio.h>
/*
* In case of initializing the driver statically (using U_BOOT_DEVICE macro),
* we can use this struct to declare the pins used.
*/
#if !CONFIG_IS_ENABLED(OF_CONTROL)
struct reboot_mode_gpio_config {
int gpio_dev_offset;
int gpio_offset;
int flags;
};
#endif
struct reboot_mode_gpio_platdata {
struct gpio_desc *gpio_desc;
#if !CONFIG_IS_ENABLED(OF_CONTROL)
struct reboot_mode_gpio_config *gpios_config;
#endif
int gpio_count;
};
#endif /* REBOOT_MODE_REBOOT_MODE_GPIO_H_ */