public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Denis Burkov <hitechshell@mail.ru>
To: u-boot@lists.denx.de
Cc: Denis Burkov <hitechshell@mail.ru>
Subject: [PATCH] gpio: axp: Add support for devicetree
Date: Wed, 21 Jan 2026 16:54:37 +0500	[thread overview]
Message-ID: <20260121115437.31406-1-hitechshell@mail.ru> (raw)

Signed-off-by: Denis Burkov <hitechshell@mail.ru>
---
 board/sunxi/board.c     |  4 ----
 drivers/gpio/axp_gpio.c | 28 +++++++++++-----------------
 2 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 2929bc17f08..3c61bfb8822 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -226,10 +226,6 @@ int board_init(void)
 	}
 #endif /* !CONFIG_ARM64 && !CONFIG_MACH_SUNIV */
 
-	ret = axp_gpio_init();
-	if (ret)
-		return ret;
-
 	eth_init_board();
 
 	return 0;
diff --git a/drivers/gpio/axp_gpio.c b/drivers/gpio/axp_gpio.c
index 181c53bfe72..1c5882a25d4 100644
--- a/drivers/gpio/axp_gpio.c
+++ b/drivers/gpio/axp_gpio.c
@@ -98,35 +98,29 @@ static const struct dm_gpio_ops gpio_axp_ops = {
 
 static int gpio_axp_probe(struct udevice *dev)
 {
+	int ret;
 	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
 	/* Tell the uclass how many GPIOs we have */
 	uc_priv->bank_name = AXP_GPIO_PREFIX;
 	uc_priv->gpio_count = AXP_GPIO_COUNT;
 
+	ret = pmic_bus_init();
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
+static const struct udevice_id gpio_axp_match[] = {
+	{ .compatible = "x-powers,axp209-gpio" },
+	{ }
+};
+
 U_BOOT_DRIVER(gpio_axp) = {
 	.name	= "gpio_axp",
 	.id	= UCLASS_GPIO,
+	.of_match = gpio_axp_match,
 	.ops	= &gpio_axp_ops,
 	.probe	= gpio_axp_probe,
 };
-
-int axp_gpio_init(void)
-{
-	struct udevice *dev;
-	int ret;
-
-	ret = pmic_bus_init();
-	if (ret)
-		return ret;
-
-	/* There is no devicetree support for the axp yet, so bind directly */
-	ret = device_bind_driver(dm_root(), "gpio_axp", "AXP-gpio", &dev);
-	if (ret)
-		return ret;
-
-	return 0;
-}
-- 
2.49.1


                 reply	other threads:[~2026-01-21 12:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260121115437.31406-1-hitechshell@mail.ru \
    --to=hitechshell@mail.ru \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox