From nobody Thu Feb 02 06:46:55 2023 X-Original-To: dev-commits-src-all@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 4P6q8J2LqZz3c3FV; Thu, 2 Feb 2023 06:46:56 +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 4P6q8J1vhHz4KDT; Thu, 2 Feb 2023 06:46:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675320416; 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=2y0y9y/qWmjCBrDbXWsc1+kD6GsS6zZUaNYvE1liN/U=; b=O+DxCpjb/vOO8bbIii8WSUGS9CGX4jfd6BQpeHR4gY7zfEB+ieqK29b1Q6olgpx/uH9+9G osnztd5zXoVn7Tlng3Yk96t0uBpr/czt5sgGag32ttOFHUKJ03ZLkV9lzZZVHxriRu5VEv mBXBa6F2xE93nTbKbzVgc4L9fGF8IYSfxG6WOWsG0vuAyAqGcbF5X5E5hdGf3i6mwrRB0r nCXnqh0+nNrYkJqmnH9YsASyz9nGlzOLvbkb17NBxie/0l/kJwiQhxqJFTIx3Cv+siogkF llRKjhZ3eDY7OWoyuCRJVpTUL3XUPzx6lEqZDHrkX7YZHehVBCN4hJzCyCQPWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675320416; 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=2y0y9y/qWmjCBrDbXWsc1+kD6GsS6zZUaNYvE1liN/U=; b=Xm/15QOPqC66PZuyF4yMRA8U+89JgQ+PTtVXZ4ia1jX281BVhPfC6m8h4dWsLnvT2bGSi7 v/SNd+3CaFsWqvdmda3Yzl2o6lD9miPuux/4ZR76gWPsiTY3stvQH5CfYmDWkRQgGMw/Wv 6M9yIpny4m8ej8lZP/l7hv1cTjF1HNkmFqgTYGN4K3QZMFuofZMYI0w+k86GlNbOL7hy45 m/4IXPRYuaOQlr78jwK1BlcDvz2MOI9EayoVeXXt7oJzSU06uVYH5ijKNy6LDoFn/W621B 4t6Ok6VeruZWB4NN+vYt7CD0c7fs4qe4TegdfP590COKMPc0Sz2gRtW8pE0Iqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675320416; a=rsa-sha256; cv=none; b=s1i3sMHriJGqXMhoRUnUEY6xjphBuKpaY35UL03gIadMl1s9ggk4hGgpfWbY23o1/NgX2t AIlYHfj/OQWTV2WZS002ldnH960EFm4RB7/lWfF+rucAObCeMdUP8kurV3q8eoz/bR+q/q 0H4T8K7gB5VliMvjit/P+OAVaxu5GbM59kicHMC6BPy+WMzZbQmeQQL808hxduWNgqntEc JnzMc1wHsjcDAZq9AePUFK3r2KBX2+VXugOXgZQyOIXIrft7+YSuDv6UbiTatEeYeHFfJT M5J0DKUx8pG7G0zMlBJ8MYuekOntZp7plGCad9buFi+eY3Zl3bzq2JfUqjNhKQ== 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 4P6q8J0pg5zlMR; Thu, 2 Feb 2023 06:46:56 +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 3126ktuf089616; Thu, 2 Feb 2023 06:46:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3126ktm5089614; Thu, 2 Feb 2023 06:46:55 GMT (envelope-from git) Date: Thu, 2 Feb 2023 06:46:55 GMT Message-Id: <202302020646.3126ktm5089614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: e5624479d191 - stable/13 - arm64: rockchip: pinctrl: Do not rely on the node name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: e5624479d191780a4a49e2d391b79570b4bc0bac Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e5624479d191780a4a49e2d391b79570b4bc0bac commit e5624479d191780a4a49e2d391b79570b4bc0bac Author: Emmanuel Vadot AuthorDate: 2022-08-10 13:47:22 +0000 Commit: Emmanuel Vadot CommitDate: 2023-02-02 06:38:06 +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 (cherry picked from commit 8d6b3a85701062ee795a5aeabb0771c93a8f6f72) --- 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 24ad7798eef0..5b62f67201d0 100644 --- a/sys/arm64/rockchip/rk_pinctrl.c +++ b/sys/arm64/rockchip/rk_pinctrl.c @@ -1191,21 +1191,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) { @@ -1226,8 +1211,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; @@ -1264,51 +1248,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);