From patchwork Tue Aug 31 10:21:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 504652 Delivered-To: patches@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2636336jai; Tue, 31 Aug 2021 03:21:37 -0700 (PDT) X-Received: by 2002:a05:6512:3c94:: with SMTP id h20mr14282382lfv.170.1630405297757; Tue, 31 Aug 2021 03:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630405297; cv=none; d=google.com; s=arc-20160816; b=bWVtSZ+/jLkWlDL7pAoQlzoqzBIDmPLz0gJTyazbX6XJD3JtfpPxdqZz8fsX+aLGPZ Z7e+Y/fin7e9c27s82fzYB8gIGyEsopK//z5rWjREkydkkQ+hjesO5Bk4B0JeNRy6GRn bIOWCtaH92lf0tHM3MPfW2TyDmz1jOl7U7XGS0KndjdXYt/ag48YGsovz8c9dnApjixo BeDxaJt6DfDwYjtIiwPkXVoFVPs03/VWroYzahamoA8vbXS9Co4RNizRZ1JhaQAoLM8P 71SPIVkxWb6whrQ8YWqsf2Qyby5SynxIt5k2jVz7Novaze+eyntL8qSHAbZIYIW2iy8m A/ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=SaQiFvhNq7368+94ke7tCwmU8u/vT5hggbptJeHOcYo=; b=fNu54SGYztlfjqOjx9TtBVOAT8tLdylkobFPyFgiOZjlJA98d/023A8ZjPXr6X6h+Q oYu/jzGtxNghsmEglZIz/HD+44A6Y4fmaDeSttNEemYKvgLE+prxHpdLpIZnllUrtGlx Y7MhEjM9zKVsOoNFSvNv8BZcSww1zSICpqZOEbXK5u2iv38pGH1E2IOPmdXAVEoR1sBk ZdMXxjpds6Rj9iAVoRHqKIZGu8kAaR1bp6Un1W/ekRrKKR1tkqPexGQ5HELTQ0PXEWyk XMX7JX6rsvjs2MC2i45enDjR7vwAvKLdW7bqiTZsbXApxyjIrZrFjF/MABCddK4vfejY sg2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OQ8Bc7H/"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id b17sor3988335lft.94.2021.08.31.03.21.37 for (Google Transport Security); Tue, 31 Aug 2021 03:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OQ8Bc7H/"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SaQiFvhNq7368+94ke7tCwmU8u/vT5hggbptJeHOcYo=; b=OQ8Bc7H/j7dY8F+7/WWLC8l2pfhCHESOHANGP40xBtANdPJhhCoXsFJE8/mcMLl6lb bKH2QIzdw8Z3bHXrkZiaqsbkx9pU/7qQ3ikcKw5DsQifxf7w4S6mRQvk1kjExY/XCrBL x1f8EISuWCWhIkqllRSOpX0AE8ii8ONpNBj807/cw5HxrPKESUk9MTq7svvQQbGk8/DX PT6GqOiEW+D9hmrjFv2Db0EVRCjLTLSb9b0DMV2Id/Pszpdi0+sYj409rQuECO1+Zsdc D/bTITEW67QawE23Dz0u5spWInPsJ8lnUGdvyx/xOZCTiDWTFogofPOFgZWhd5KL98sg ZfmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SaQiFvhNq7368+94ke7tCwmU8u/vT5hggbptJeHOcYo=; b=aiFuVsJPEmK99MoSZ2B0La5uT/5saUtAPTrGiy0iZSzi3FK6eySLGUJ5wyScbQTfNh l6t2CxE4BnfR/X9Pcpee4U5GvE/MhwFSF7r6KCDJ7knFQrx3s1qOlt8qbWbnhJiomyGp 4PoRx6mYRKEZLzeXkDPwGj8OzzBNJSXcTVmxj4UyVPKYffXa1aqH48VljClw14CfKwUv GoAPkw8Kr/Cev2fnjVzvyIcEqc6dJQusy15cAQM7i8Kg+eQP+aCQpx3xp9MIWWnSVOL5 qQERJZ+h7QQJUKkPquj+3ShDuBrsH7686U0fFkOqLbi9tVkBujt4Q+Z6tJw+MGF8mdRx AHAQ== X-Gm-Message-State: AOAM531rOeyn5MCP/JKKIeMlDem1VWFp9jn1DlGlCqFjTX9LDzq38Hiz dJqty3J3fnImrLuRlUIydr0c59MP X-Google-Smtp-Source: ABdhPJysTQHKjj6sHl08LoVd8gzCM5Oi5pHDfNeAo1fs+lBAhuD47ThIpXSDKSYwaxeOL6peufsGZQ== X-Received: by 2002:a05:6512:2210:: with SMTP id h16mr20684305lfu.621.1630405297014; Tue, 31 Aug 2021 03:21:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id b21sm753714lfi.104.2021.08.31.03.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 03:21:36 -0700 (PDT) From: Ulf Hansson To: Saravana Kannan , Rob Herring , devicetree@vger.kernel.org Cc: "Rafael J . Wysocki" , Stephen Boyd , Dmitry Osipenko , Ulf Hansson , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] of: property: fw_devlink: Rename 'node_not_dev' to 'optional_con_dev' Date: Tue, 31 Aug 2021 12:21:25 +0200 Message-Id: <20210831102125.624661-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 In the struct supplier_bindings the member 'node_not_dev' is described as "The consumer node containing the property is never a device.", but that doesn't match the behaviour of the code in of_link_property(). To make the behaviour consistent with the description, let's rename the member to "optional_con_dev" and clarify the corresponding comment. Signed-off-by: Ulf Hansson --- drivers/of/property.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 Signed-off-by: Ulf Hansson diff --git a/drivers/of/property.c b/drivers/of/property.c index 6c028632f425..2babb1807228 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1249,7 +1249,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ * @parse_prop.index: For properties holding a list of phandles, this is the * index into the list * @optional: Describes whether a supplier is mandatory or not - * @node_not_dev: The consumer node containing the property is never a device. + * @optional_con_dev: The consumer node containing the property may not be a + * device, then try finding one from an ancestor node. * * Returns: * parse_prop() return values are @@ -1261,7 +1262,7 @@ struct supplier_bindings { struct device_node *(*parse_prop)(struct device_node *np, const char *prop_name, int index); bool optional; - bool node_not_dev; + bool optional_con_dev; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1370,7 +1371,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, - { .parse_prop = parse_remote_endpoint, .node_not_dev = true, }, + { .parse_prop = parse_remote_endpoint, .optional_con_dev = true, }, { .parse_prop = parse_gpio_compat, }, { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, }, @@ -1415,7 +1416,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) while ((phandle = s->parse_prop(con_np, prop_name, i))) { struct device_node *con_dev_np; - con_dev_np = s->node_not_dev + con_dev_np = s->optional_con_dev ? of_get_compat_node(con_np) : of_node_get(con_np); matched = true; From patchwork Tue Aug 31 10:21:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 504653 Delivered-To: patches@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2636419jai; Tue, 31 Aug 2021 03:21:45 -0700 (PDT) X-Received: by 2002:a2e:6808:: with SMTP id c8mr24855772lja.70.1630405305448; Tue, 31 Aug 2021 03:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630405305; cv=none; d=google.com; s=arc-20160816; b=BYzi5ZD/7E0ctdAO5aWyQ5099EraQgts48oOgZVuSE7ca6MwsfYOeBE6bDU67uQN4L WgsPWS/N/gitC0jXzmKMQP1In6XSD2WWi983TYCRioHw1+tL47Ll0Q5HOZjEaaFemcNK enLsSXipsZ93LOql9d8wTtvGc3kF68GhqWe6CaTtIWSbOS8WCZCmpKbx9Y7qasuUtnk4 MzN18b4+SldcZqlDfmuFm0XHBdrDT0Ah3frtBUtNO62YoaQrLqUQ+naSstgZyefhGFtu TqgKwbkRMhP/yWJ+4o45pZAy5qRTV4TbUnZLMZBrsAlHBtLhdj7jHxzZDDJGQCv8hiGG qvrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=wQ8kS/+bTV4avdS2tU6jC3f6zz+Ryry/9cKDRK1gufo=; b=K/YhUaKGX04+I8k6q43beXJFCC2nFjPm2AkrJcEb85utwWrOiSxIWXgwSWj9INzuxe fzugQnbUyztATwK1doIl6LOS+mOX0fItqteXkLAJrGaK9L6urfY/tj7sYt/y8FRLyK5P N7kPk/uXyIkcBY12eJ4va+EfOKMuUNhrrLbigc0Ss3CYrod1rizZDV0eZMMANZl/fq7f bqVj0kBcMggO39SotsnccL6w9GrrHzYQkFYobfrOE/+k3pHyt5rBT4T/Wz8fhDz6HmiE KNE491XqQYoGzcd4sFly5LMrIhj/2Y//cFg7FZUt927HreWNazZ8f0mGt1zpKDkvO+jR 9spw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiP1wMEE; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q12sor7261409lji.21.2021.08.31.03.21.45 for (Google Transport Security); Tue, 31 Aug 2021 03:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiP1wMEE; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wQ8kS/+bTV4avdS2tU6jC3f6zz+Ryry/9cKDRK1gufo=; b=jiP1wMEEvsgc3n7vYx1ledvZpCZkUX5FcfCU/d4NmQ10imEb+nTwuV7AvPQyuAhzpe YsP/UU3DHPPh2i10yLbc78f5nCMLrerGJ6O5w2qQxXo1os1R5iEn/nQbRPHBGoAOHkXS 1aGLp5y3Z3p+M9xTR3mVec6Ve/Wj+o+zBAE2jyiAeEhGtBnmOfK3J7BHgoO9AKlkFMG8 XHtHiuMg1cbBY5AtMl5rgl7rqbMvAu7ThdDV0Pq3/ED5GoRF4shP/c5KQGW9yKirDnmq d2LCC2MTmPF6h0Symi6YMYf/1TDJKL/EaXJSAYRhHwpoTPEraIaRvdsHZ1cUt089Z39h /jrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wQ8kS/+bTV4avdS2tU6jC3f6zz+Ryry/9cKDRK1gufo=; b=NUvGvkjUeeA/f6stBqvtaZghjpRfAqgV35ZfhOoh4CUegoWNLPjN4eDrAu/locoGXH VRLHXg88OJ/bV8VoXoBbq0PtiHFugaHpmm/4G+e71M9CwB8Ofp4+kGt4ORdTbJW1Zw6d XAimV9rh1EHknJ4gtYoacxbx7t/rIZvhm1+EUs837Brek1fcGkOfrml5p9TuDzrNsuUm cb8LIRGToaKOrOuBrQMJRE48ZzvWKShfwU2qGJF2M3x2SzoHUEPTAiS9fLLSUgh5vT0s hrb9Iy3PwuKa1Dx0J8zQ1FI03+tHRhPL9X6O6CAmDbwzoon6tnZfuT3LSgY0BB+sSjbf WEGw== X-Gm-Message-State: AOAM530eFDsVtyMoS7P26R0C5CTULcmz8ulgoAl2UK4aWpN7fpXoHYYP R6An63jqJMW3UZ1OPlH2KjjOnTgm X-Google-Smtp-Source: ABdhPJyfAO80CqzIGBt9m8D2PiuI5w5PJosyAgh/JmPeY8WX1k4mcSvpAtqPgpVYTTOGtXaXZQRtog== X-Received: by 2002:a05:651c:2ca:: with SMTP id f10mr24621298ljo.211.1630405305074; Tue, 31 Aug 2021 03:21:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id d13sm1687864lfk.232.2021.08.31.03.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 03:21:44 -0700 (PDT) From: Ulf Hansson To: Saravana Kannan , Rob Herring , devicetree@vger.kernel.org Cc: "Rafael J . Wysocki" , Stephen Boyd , Dmitry Osipenko , Ulf Hansson , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] of: property: fw_devlink: Set 'optional_con_dev' for parse_power_domains Date: Tue, 31 Aug 2021 12:21:41 +0200 Message-Id: <20210831102141.624725-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 The power-domain DT bindings [1] doesn't enforce a compatible string for a provider node, even if this is common to use. In particular, when describing a hierarchy with parent/child power-domains, as the psci DT bindings [2] for example, it's sometimes not applicable to use a compatible string. Therefore, let's set the 'optional_con_dev' to true to avoid creating incorrect fw_devlinks for power-domains. [1] Documentation/devicetree/bindings/power/power-domain.yaml [2] Documentation/devicetree/bindings/arm/psci.yaml Signed-off-by: Ulf Hansson --- Some more details of what goes on here. I have added a debug print in of_link_to_phandle() to see the fw_devlinks that gets created. This is what happens on Dragonboard 410c when 'optional_con_dev' isn't set: ... [ 0.041274] device: 'psci': device_add [ 0.041366] OF: Linking power-domain-cpu0 (consumer) to psci (supplier) [ 0.041395] OF: Linking power-domain-cpu1 (consumer) to psci (supplier) [ 0.041423] OF: Linking power-domain-cpu2 (consumer) to psci (supplier) [ 0.041451] OF: Linking power-domain-cpu3 (consumer) to psci (supplier) [ 0.041494] device: 'platform:psci--platform:psci': device_add [ 0.041556] platform psci: Linked as a sync state only consumer to psci ... This is what happens on Dragonboard 410c when 'optional_con_dev' is set: ... [ 0.041179] device: 'psci': device_add [ 0.041265] OF: Not linking psci to psci - is descendant [ 0.041293] OF: Not linking psci to psci - is descendant [ 0.041319] OF: Not linking psci to psci - is descendant [ 0.041346] OF: Not linking psci to psci - is descendant ... The relevant dtsi file: arch/arm64/boot/dts/qcom/msm8916.dtsi Kind regards Ulf Hansson --- drivers/of/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/of/property.c b/drivers/of/property.c index 2babb1807228..4d607fdbea24 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1356,7 +1356,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_io_channels, }, { .parse_prop = parse_interrupt_parent, }, { .parse_prop = parse_dmas, .optional = true, }, - { .parse_prop = parse_power_domains, }, + { .parse_prop = parse_power_domains, .optional_con_dev = true, }, { .parse_prop = parse_hwlocks, }, { .parse_prop = parse_extcon, }, { .parse_prop = parse_nvmem_cells, },