From patchwork Wed Jan 20 08:05:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 368186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82FA9C433E6 for ; Wed, 20 Jan 2021 08:09:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 335C623333 for ; Wed, 20 Jan 2021 08:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729818AbhATIJD (ORCPT ); Wed, 20 Jan 2021 03:09:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729643AbhATIG5 (ORCPT ); Wed, 20 Jan 2021 03:06:57 -0500 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6046EC0613D6 for ; Wed, 20 Jan 2021 00:05:28 -0800 (PST) Received: by mail-qk1-x749.google.com with SMTP id y187so22941656qke.20 for ; Wed, 20 Jan 2021 00:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=uGaUoM+E9lfomuo5VcB6+FBCFYFJdpblUN9bMb0KEQ8=; b=WXFajYaCVStBAKnz0wmB2RrIJ38/1vH//mTVPlMPb41/IhwYJkh+lPTxY4cx0w0w50 fArOq6D2XgX0y4Bo3onEcnRQ9phEiUsLnrfusOxat89NlAdQQm9p93P4AzfVIha1z/t9 QrXpm97SWljygpeLIS6G+W41y/CcfX8285AT/dVcGidwhI6PKrlOmv2qv4FlYlavSNle NWQiSDPLVy4CkmQqIeKZWZ8Mf/hC7LcaRT7F21eDu4HbDZfynn4hElcSIADLjfVgAVwU hcl0k69nFgk6t4yypuOwqCqc3tFltgbbtbwL4pWshP+Xu6W7zX03ckMKncpS1/DDjMyo NDoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=uGaUoM+E9lfomuo5VcB6+FBCFYFJdpblUN9bMb0KEQ8=; b=MmnuFYB/4Of4TtAN7ARe4iWqiRO0BE98RydRaFY3G3jO+YuvpuFOFdjhqTkO8xq2cj xtRa7ZPRcLfnboihep7Q6AFVtTb1LdNSDm4jHMulxPUt0PhRx4Vd95fNrpr0Ft6lUmWL B1UjOIsK/ddVxtUPiYdz6jedcBz8jwfpw/q1zTxap1npYBrJrxsQEpPgU4YTXhUXnZAy TQ8CUA++WHqvtDHN4DyT98J5AqHCIbPDmCFpJ3wNDHsPY6fz9frcYIZI0nXC8kJSALOU /26eLht3iKmT3Zwo87Zn1bGH+TPj7Ptc7qT5DIacdutJvuc+IEouNtWmfKRe22czToax Scjg== X-Gm-Message-State: AOAM532la/NyxnYG9OPXg/zFcFQWBm/rs4LEhTakxfC6kOuTb8I4u5Fs KE1FK9dsPB6X/yux8UVaerwfjqx8ebNMyok= X-Google-Smtp-Source: ABdhPJw7tNEQiVhvl/LJcPnKFL/dA/jCctKdfptjpMAvIQ5ksmAAJk6aEs0ccjbVgVaDM7oMM/eCKVnVTTZR6vE= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:7220:84ff:fe09:fedc]) (user=saravanak job=sendgmr) by 2002:a0c:f107:: with SMTP id i7mr8384314qvl.35.1611129927528; Wed, 20 Jan 2021 00:05:27 -0800 (PST) Date: Wed, 20 Jan 2021 00:05:20 -0800 In-Reply-To: <20210120080522.471120-1-saravanak@google.com> Message-Id: <20210120080522.471120-2-saravanak@google.com> Mime-Version: 1.0 References: <20210120080522.471120-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding From: Saravana Kannan To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Saravana Kannan Cc: linux-tegra , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven , Jon Hunter , Marc Zyngier , Kevin Hilman , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org To provide backward compatibility for boards that use deprecated DT bindings, we need to add fw_devlink support for "gpio" and "gpios". Cc: linux-tegra Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Greg Kroah-Hartman Cc: Geert Uytterhoeven Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") Tested-by: Jon Hunter Signed-off-by: Saravana Kannan --- drivers/of/property.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 5f9eed79a8aa..0b256ce9d7d5 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1271,6 +1271,24 @@ static struct device_node *parse_iommu_maps(struct device_node *np, return of_parse_phandle(np, prop_name, (index * 4) + 1); } +static struct device_node *parse_gpio_compat(struct device_node *np, + const char *prop_name, int index) +{ + struct of_phandle_args sup_args; + + if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios")) + return NULL; + + if (of_find_property(np, "gpio-hog", NULL)) + return NULL; + + if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index, + &sup_args)) + return NULL; + + return sup_args.np; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1296,6 +1314,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, + { .parse_prop = parse_gpio_compat, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, From patchwork Wed Jan 20 08:05:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 367271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26FF5C433E0 for ; Wed, 20 Jan 2021 08:09:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C619D23131 for ; Wed, 20 Jan 2021 08:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730340AbhATIJQ (ORCPT ); Wed, 20 Jan 2021 03:09:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730314AbhATIHF (ORCPT ); Wed, 20 Jan 2021 03:07:05 -0500 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4F0DC061786 for ; Wed, 20 Jan 2021 00:05:30 -0800 (PST) Received: by mail-qt1-x849.google.com with SMTP id b24so20510627qtt.22 for ; Wed, 20 Jan 2021 00:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=DHTbZHOkLsKuxtNFUubtLM+gqL6YY3qNMXB7NuoXXTA=; b=Il85GfxJuukw/3SvMs3zLOlirjw0U0IRX28xLvqLD/ty4nOJ9Xp2b6K/KilcjTtmQM l537tY9lg5rnaulxbobhsAQ4ifT7eB3rf7cPRgXY2+779zC29zzRqjwxCm/qPxoZFv/T YLNOmli8uuHOFGw2BPlx47YqPWcXY9rNa3RaHpibks4PcGEamflHasRmla1Xc09F3K3H q/XHi9O0n4NiedG60FpJA022VrFu72+DH+a6+I8VVIwjqABMUaVUYwhaJgA5/MCSpuah 95TGfv7ff6pRPcUfPbgtt/nVwnmLY6DkE0HEZitHNxnfVAqkWg4tMJoqPW9JRwpn00BR AEcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DHTbZHOkLsKuxtNFUubtLM+gqL6YY3qNMXB7NuoXXTA=; b=bwB/EXCQCcfrxliXCU+Kw+OBXsQH86DwlRStx1V6upyle5A7la/pq67VGAWK0OPRpA BzPJDw4+2Ot0PoUGUlFmUqIQc0kJgYmnnGXhj4v8LnqYJ3Nlr893ef3HMecP/5Rbibo6 67kHHCOmnDE9j5BFdWUuEI1unNG74HZlleERtyMC6j64ik5HBtJ8ERAujrLLfAfyEq++ 03Qf3pRk2n59CN7P5pquKZ+gcO+vs9vnIyW0VU7Lt1JzaAjZdhcpHXRf4PczJkeDZCHe csyCFWHyGY6XpIJhKD0dWErd7Ss9zP8YJ3Gw4G4aAhQTD49tzYxjK6T73D8LIfSRr24A P2tA== X-Gm-Message-State: AOAM533x4dL0ZjGgCIYAk4EWHlP4W/zEIMRHpWxSYRRYWApdKXAb3OxZ PmP8KY6+Ugx+Xi0hXU7NJWFmKvBAgo3MuNY= X-Google-Smtp-Source: ABdhPJyakDkqGvLIh+tdPGMZ1JrSamWDar9qMU1B4qiTmPWOBDxyLEdM7ux0cpDZXMRzWb92SLidW5+XN5u+0vQ= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:7220:84ff:fe09:fedc]) (user=saravanak job=sendgmr) by 2002:ad4:58c2:: with SMTP id dh2mr8314576qvb.4.1611129929818; Wed, 20 Jan 2021 00:05:29 -0800 (PST) Date: Wed, 20 Jan 2021 00:05:21 -0800 In-Reply-To: <20210120080522.471120-1-saravanak@google.com> Message-Id: <20210120080522.471120-3-saravanak@google.com> Mime-Version: 1.0 References: <20210120080522.471120-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts From: Saravana Kannan To: Rob Herring , Frank Rowand , Greg Kroah-Hartman Cc: Saravana Kannan , linux-tegra , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven , Jon Hunter , Marc Zyngier , Kevin Hilman , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This allows fw_devlink to create device links between consumers of an interrupt and the supplier of the interrupt. Cc: Marc Zyngier Cc: Kevin Hilman Cc: Greg Kroah-Hartman Signed-off-by: Saravana Kannan Reviewed-by: Rob Herring Reviewed-by: Linus Walleij --- drivers/of/property.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 0b256ce9d7d5..9dd9cc50e65a 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1289,6 +1290,15 @@ static struct device_node *parse_gpio_compat(struct device_node *np, return sup_args.np; } +static struct device_node *parse_interrupts(struct device_node *np, + const char *prop_name, int index) +{ + if (strcmp(prop_name, "interrupts") || index) + return NULL; + + return of_irq_find_parent(np); +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1315,6 +1325,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, { .parse_prop = parse_gpio_compat, }, + { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, },