From nobody Wed Aug 10 13:49:42 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M2rsL4MNmz4YjrY; Wed, 10 Aug 2022 13:49:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M2rsL3r9vz3qHC; Wed, 10 Aug 2022 13:49:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660139382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZxfhBsRRjX9PGHQJ5R/Yg/1Mw1Hpz6fYZR3g8jTrPUY=; b=iOXkkQ7NjGTNKiYwzEaUEyZ+jC5bRzj9RM6lj6/UjRAO9/27IvvjjCy7Ql8G6Gz+ITmLWj 3OiKxnYpTomhabLUJbX56fIrIPLzOKzDmbY94PlNnfcg951quW3+NUDHqqmIdjh7i5tX+5 AHoIJw2B22MbAzqPhblgmJnjWcBjM21T+rzn0tAwNhu1wEZmEyc/4EhdCC9sgVYjjzkSbC szlZcGnzwbPm7wnWK73AOQxNdkkQwzsDZUG+Fm5gOCre/y8TgExHRINmSwpu60I51ONOYf MWRwjHQQuisJ9vMMrsmA5LCz68nKBQqpCGuYWDwpCoAABMNnl+R6HCnbaKKFtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M2rsL2fStz1Cql; Wed, 10 Aug 2022 13:49:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27ADngJa081926; Wed, 10 Aug 2022 13:49:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27ADng2M081925; Wed, 10 Aug 2022 13:49:42 GMT (envelope-from git) Date: Wed, 10 Aug 2022 13:49:42 GMT Message-Id: <202208101349.27ADng2M081925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8d6b3a857010 - main - arm64: rockchip: pinctrl: Do not rely on the node name List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d6b3a85701062ee795a5aeabb0771c93a8f6f72 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660139382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZxfhBsRRjX9PGHQJ5R/Yg/1Mw1Hpz6fYZR3g8jTrPUY=; b=FzOZzoVEQamF078UCBkHdWopFSGmqs10RwWlGnv5BCkSAke1iidDCdxUyYZir/xoim5C+r SAhvLkq2NzYkavpd0jY44/vTiZNFyfBcGpzKOj5S990kCtAxGX5L4a27YS9cvUU+LyA9Pe /g7kaT/wBA7w+5mokx3IkcxdwZpJxH/srq14VmMfzKSfyilUl0AhtzYkIsANutPRBg3AiA K9MD5EvYGTKywpTZo5zXmNNNPr4qnkzVruD67l+F6/2vbVRGPe65i6diuHAsnnWFgjHZO8 hKOcVMJmyCa1TR8d8ncfmbRltgddpfv4lTi8jIcDP4dCmS6+Bt16YFc3xMyX4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660139382; a=rsa-sha256; cv=none; b=nBhA8UYFKOkpBHtLHdnFKT+Bn5oK8c/v1KOovxKGTQfkD85ppdm62o/GcVwtGo/rVGAasH ggUIocIRelTXamdk1jI6gbRQdNgcLfQoVTDVoErj3Vmi+rH0s6076hG8awKR25KhJWbzoz 9PkwLnUHUCGJuiZal0VJd+eVySznztLUUXxrsHCOVdQky0faiPjcYzmHbo6U387wNe2RTO bGfJeED0qon8NyCkY0rhN6olZ0onFNKJlbKCG0PdxSZTDdpdovYstRCDvnv1PXEvw+6Bjh ZVJ8XnGJiWDyFtK0esoaqHx2B9OTNz6c6JWILovURvlir9Tz5tysjd+DyZ50og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=8d6b3a85701062ee795a5aeabb0771c93a8f6f72 commit 8d6b3a85701062ee795a5aeabb0771c93a8f6f72 Author: Emmanuel Vadot AuthorDate: 2022-08-10 13:47:22 +0000 Commit: Emmanuel Vadot CommitDate: 2022-08-10 13:47:22 +0000 arm64: rockchip: pinctrl: Do not rely on the node name Node names for gpio bank were made generic in Linux 5.16 so stop using them to map the gpio controller to the pin controller bank unit. Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/arm64/rockchip/rk_pinctrl.c | 60 +++++++---------------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/sys/arm64/rockchip/rk_pinctrl.c b/sys/arm64/rockchip/rk_pinctrl.c index 6d0d93aee439..c158de40dca5 100644 --- a/sys/arm64/rockchip/rk_pinctrl.c +++ b/sys/arm64/rockchip/rk_pinctrl.c @@ -1437,21 +1437,6 @@ done: return (rv); } -static int -rk_pinctrl_register_gpio(struct rk_pinctrl_softc *sc, char *gpio_name, - device_t gpio_dev) -{ - int i; - - for(i = 0; i < sc->conf->ngpio_bank; i++) { - if (strcmp(gpio_name, sc->conf->gpio_bank[i].gpio_name) != 0) - continue; - sc->conf->gpio_bank[i].gpio_dev = gpio_dev; - return(0); - } - return (ENXIO); -} - static int rk_pinctrl_probe(device_t dev) { @@ -1472,8 +1457,7 @@ rk_pinctrl_attach(device_t dev) struct rk_pinctrl_softc *sc; phandle_t node; device_t cdev; - char *gpio_name, *eptr; - int rv; + int rv, gpio_unit; sc = device_get_softc(dev); sc->dev = dev; @@ -1511,51 +1495,25 @@ rk_pinctrl_attach(device_t dev) bus_generic_probe(dev); /* Attach child devices */ - for (node = OF_child(node); node > 0; node = OF_peer(node)) { + for (node = OF_child(node), gpio_unit = 0; node > 0; + node = OF_peer(node)) { if (!ofw_bus_node_is_compatible(node, "rockchip,gpio-bank")) continue; - - rv = OF_getprop_alloc(node, "name", (void **)&gpio_name); - if (rv <= 0) { - device_printf(sc->dev, "Cannot GPIO subdevice name.\n"); - continue; - } - cdev = simplebus_add_device(dev, node, 0, NULL, -1, NULL); if (cdev == NULL) { - device_printf(dev, " Cannot add GPIO subdevice: %s\n", - gpio_name); - OF_prop_free(gpio_name); + device_printf(dev, " Cannot add GPIO subdevice\n"); + gpio_unit += 1; continue; } - rv = device_probe_and_attach(cdev); if (rv != 0) { device_printf(sc->dev, - "Cannot attach GPIO subdevice: %s\n", gpio_name); - OF_prop_free(gpio_name); - continue; - } - - /* Grep device name from name property */ - eptr = gpio_name; - strsep(&eptr, "@"); - if (gpio_name == eptr) { - device_printf(sc->dev, - "Unrecognized format of GPIO subdevice name: %s\n", - gpio_name); - OF_prop_free(gpio_name); - continue; - } - rv = rk_pinctrl_register_gpio(sc, gpio_name, cdev); - if (rv != 0) { - device_printf(sc->dev, - "Cannot register GPIO subdevice %s: %d\n", - gpio_name, rv); - OF_prop_free(gpio_name); + "Cannot attach GPIO subdevice\n"); + gpio_unit += 1; continue; } - OF_prop_free(gpio_name); + sc->conf->gpio_bank[gpio_unit].gpio_dev = cdev; + gpio_unit += 1; } fdt_pinctrl_configure_tree(dev);