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

dm: gpio: Add of-platdata support

Add support for accessing GPIOs using of-plata. This uses the same
mechanism as for clocks, but allows use of the xlate() method so that
the driver can interpret the parameters.

Update the condition for GPIO_HOG so that it is not built into SPL,
since it needs SPL_OF_REAL which is not enabled in sandbox_spl.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-08-07 07:24:12 -06:00
parent 3e57ad907c
commit 48609d0789
9 changed files with 93 additions and 9 deletions

View File

@@ -323,11 +323,13 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
static int sandbox_gpio_of_to_plat(struct udevice *dev)
{
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
if (CONFIG_IS_ENABLED(OF_REAL)) {
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
uc_priv->gpio_count = dev_read_u32_default(dev, "sandbox,gpio-count",
0);
uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
uc_priv->gpio_count =
dev_read_u32_default(dev, "sandbox,gpio-count", 0);
uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
}
return 0;
}
@@ -371,6 +373,8 @@ U_BOOT_DRIVER(sandbox_gpio) = {
DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias)
#if CONFIG_IS_ENABLED(PINCTRL)
/* pincontrol: used only to check GPIO pin configuration (pinmux command) */
struct sb_pinctrl_priv {
@@ -579,3 +583,5 @@ U_BOOT_DRIVER(sandbox_pinctrl_gpio) = {
.priv_auto = sizeof(struct sb_pinctrl_priv),
ACPI_OPS_PTR(&pinctrl_sandbox_acpi_ops)
};
#endif /* PINCTRL */