mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Rockchip boards may depend on a working MMC regulator in SPL to successfully load FIT payload from MMC. Typically, these boards only include the vmmc-supply regulator and not its vin-supply in SPL control FDT. The commitf98d812e53("power: regulator: Add vin-supply for GPIO and Fixed regulators") breaks loading FIT from MMC in SPL on some of these boards due to now requiring the vin-supply to be included in the SPL control FDT. The commit also strangely enables any found vin-supply in regulator_common_of_to_plat() and not when a regulator is enabled or as part of regulator_autoset(). Revert the commit to fix FIT loading in SPL on broken boards. If a board needs to have its vin-supply enabled, two options come to mind: - Add regulator-always-on prop to the regulator in the -u-boot.dtsi for any board. - Implement full support for reference counting of regulators and then update the regulator-uclass to enable any found vin-supply when a regulator is enabled. This reverts commitf98d812e53. Reported-by: Dang Huynh <danct12@riseup.net> Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Dragan Simic <dsimic@manjaro.org>
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2019 Disruptive Technologies Research AS
|
|
* Sven Schwermer <sven.svenschwermer@disruptive-technologies.com>
|
|
*/
|
|
|
|
#ifndef _REGULATOR_COMMON_H
|
|
#define _REGULATOR_COMMON_H
|
|
|
|
#include <asm/gpio.h>
|
|
|
|
struct regulator_common_plat {
|
|
struct gpio_desc gpio; /* GPIO for regulator enable control */
|
|
unsigned int startup_delay_us;
|
|
unsigned int off_on_delay_us;
|
|
unsigned int enable_count;
|
|
};
|
|
|
|
int regulator_common_of_to_plat(struct udevice *dev,
|
|
struct regulator_common_plat *plat, const
|
|
char *enable_gpio_name);
|
|
int regulator_common_get_enable(const struct udevice *dev,
|
|
struct regulator_common_plat *plat);
|
|
/*
|
|
* Enable or Disable a regulator
|
|
*
|
|
* This is a reentrant function and subsequent calls that enable will
|
|
* increase an internal counter, and disable calls will decrease the counter.
|
|
* The actual resource will be enabled when the counter gets to 1 coming from 0,
|
|
* and disabled when it reaches 0 coming from 1.
|
|
*
|
|
* @dev: regulator device
|
|
* @plat: Platform data
|
|
* @enable: bool indicating whether to enable or disable the regulator
|
|
* @return:
|
|
* 0 on Success
|
|
* -EBUSY if the regulator cannot be disabled because it's requested by
|
|
* another device
|
|
* -EALREADY if the regulator has already been enabled or has already been
|
|
* disabled
|
|
* -EACCES if there is no possibility to enable/disable the regulator
|
|
* -ve on different error situation
|
|
*/
|
|
int regulator_common_set_enable(const struct udevice *dev,
|
|
struct regulator_common_plat *plat, bool enable);
|
|
|
|
#endif /* _REGULATOR_COMMON_H */
|