Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC7BEC7618A for ; Sat, 18 Mar 2023 23:57:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BB1785997; Sun, 19 Mar 2023 00:57:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="fOVyJm0c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B17C859FD; Sun, 19 Mar 2023 00:57:08 +0100 (CET) Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C8AF085983 for ; Sun, 19 Mar 2023 00:56:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=3h7l4AjyLtlqylRB1e2H8hqbZpj3nIuNwB1vgyUaYKU=; b=fOVyJm0c+EUbGXP1MCXM5M5UJeqU7fbjkAIgo4F2ctrLRaQb1tyM2TbzMoTYuMVijlVo i3LuQPKLe+7RZW+tVMwU1qRXdfPI44E90i6liLmq6pe1Vq1drYj0Arv668vAhzfeDFoX39 w5PTLxTjxBvimqojqbUo0m4JM96EZuKSpbN8ODvikEtxj7AaIvZyN9iY7WSjnVrQW/mapy hn6pcIbwq1D7llJS+qpdVyALf1rM18LI6AZVLEUvqVsd0O6ZUyuRVoZxC+zdoFnKnfnFat /iZMjXDyWPuTkTDhPSckxMqTGRjJkBmo2WhDH3BuvhAFaZqgCUIHP8S2hyK7oIvg== Received: by filterdrecv-6c845fd887-wm5hq with SMTP id filterdrecv-6c845fd887-wm5hq-1-64164FCA-6 2023-03-18 23:56:58.201507198 +0000 UTC m=+2161442.012048724 Received: from bionic.localdomain (unknown) by geopod-ismtpd-9 (SG) with ESMTP id l5v79m_-QXC6tu3hC-2WpA Sat, 18 Mar 2023 23:56:57.915 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/3] gpio: rockchip: Use gpio alias id as gpio bank id Date: Sat, 18 Mar 2023 23:56:58 +0000 (UTC) Message-Id: <20230318235651.826148-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230318235651.826148-1-jonas@kwiboo.se> References: <20230318235651.826148-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h0kbKgAdfCIM3oyBR?= =?us-ascii?Q?1d4XcOpRu7W2rAUulkMVzyX7eyicWOMmk9y+AcV?= =?us-ascii?Q?JQN3WqtH8IYug7Py2c4Njd=2FZCU=2FTR3n=2FZs4LEn2?= =?us-ascii?Q?Dbiiy2v1HUnMVuAT8Q8O5kBw0I4+Fy5SpgS5p3G?= =?us-ascii?Q?T0L6QxXKYvEHTOElr3l4oabfTbgaW+CW50EN3X?= To: Kever Yang , Simon Glass , Philipp Tomsich , Chris Morgan Cc: Quentin Schulz , Johan Jonker , u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Use the gpio alias id as the gpio bank id, same as in the linux driver. This reverts the recent change to base bank id on the gpio-ranges prop and apply the same logic used when nodes was named gpio0@ to the alias. With missing gpio aliases added to u-boot.dtsi files this should restore gpio function for SoCs that have synced gpio0@ to gpio@ node name changes from linux. Fixes: 904b8700f81c ("gpio: gpio-rockchip: parse gpio-ranges for bank id") Signed-off-by: Jonas Karlman --- drivers/gpio/rk_gpio.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c index f7ad4d68b452..bc77b28307c0 100644 --- a/drivers/gpio/rk_gpio.c +++ b/drivers/gpio/rk_gpio.c @@ -15,6 +15,7 @@ #include #include #include +#include #include enum { @@ -142,7 +143,6 @@ static int rockchip_gpio_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct rockchip_gpio_priv *priv = dev_get_priv(dev); - struct ofnode_phandle_args args; char *end; int ret; @@ -151,24 +151,15 @@ static int rockchip_gpio_probe(struct udevice *dev) if (ret) return ret; - /* - * If "gpio-ranges" is present in the devicetree use it to parse - * the GPIO bank ID, otherwise use the legacy method. - */ - ret = ofnode_parse_phandle_with_args(dev_ofnode(dev), - "gpio-ranges", NULL, 3, - 0, &args); - if (!ret || ret != -ENOENT) { - uc_priv->gpio_count = args.args[2]; - priv->bank = args.args[1] / args.args[2]; - } else { - uc_priv->gpio_count = ROCKCHIP_GPIOS_PER_BANK; + ret = dev_read_alias_seq(dev, &priv->bank); + if (ret) { end = strrchr(dev->name, '@'); priv->bank = trailing_strtoln(dev->name, end); } priv->name[0] = 'A' + priv->bank; uc_priv->bank_name = priv->name; + uc_priv->gpio_count = ROCKCHIP_GPIOS_PER_BANK; return 0; } -- 2.40.0