From patchwork Sat Aug 14 02:31:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 497186 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.2 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=ham 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 5DBB1C4320E for ; Sat, 14 Aug 2021 02:31:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 489D8610FC for ; Sat, 14 Aug 2021 02:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236652AbhHNCcK (ORCPT ); Fri, 13 Aug 2021 22:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236629AbhHNCcJ (ORCPT ); Fri, 13 Aug 2021 22:32:09 -0400 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 E9D9CC0617AD for ; Fri, 13 Aug 2021 19:31:41 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id s206-20020a3745d70000b02903b9207abc7bso8829539qka.4 for ; Fri, 13 Aug 2021 19:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=VScF7YU24u6/3/ImRpw40sHg3zOa5uLkS4vlieP2+vw=; b=BQFS55IcoBMVhmhaW3LlsF6XbAI8wIJ/hKqJevMy4quj58zUUZQDpVIM767gWm0pZ8 WnWgO41gNIdMllgEtaLBBbH/Fvp+JqEv4TBA0lSiPWb7fZnMDKynorQ63A99vXxXd0lQ wXZ+KB8vl9qc1WZQEskoQvWrbWHAd1AXU2l0zaCFcPhn0X/Op7IKecbw/XiXXrg1/+zZ h6SxdZ6ej8gmeIK1WhUaxxOtFQdWUp7D2o4GxTc+nVSzA1La02bAbeFZ/PCBjvJhkRUx NFNBCBeQZKXX+p89gZ3+PcUjI8eJxkF7WSD3uLr0ROq6bYM2NPc+qKniAFxY+Yq1DG8f IUjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=VScF7YU24u6/3/ImRpw40sHg3zOa5uLkS4vlieP2+vw=; b=qxms2so54TqXT8DO7kktsJloouv28f0DG0sWOgVprOOij002DjvA1UcECko+mEkHy8 XDy7R1rsbvXE+9iYf6GQ3AL4hdSmRHY1ZQbmXOm0KOvStQjIa92KCoYcIquzIZ8OjJNe ih7DbRA+RWUW9wjIxH6RuwHoY1GHPnCulsM8x8IwPMk2KqceARGUUFy1jxOUgJDsDFOD 9sv8zOxkNaHOH2T4CNrbjIfBiVZD2sku8LxFOEUB/jttXFo1feQmmtph0CMHsST6S01N hbdeLGdOKGIO0NnxACeRA6L2VlSNqBdqfoMHqZgFNBNSxwnzfpAZ4uHrKsvaOAJA+gs7 3+Dg== X-Gm-Message-State: AOAM5321C19coVz+NLaBszOWWSXNo2BCtpjLLOoNw6FprTNFWpy2N8rZ kdmsbKEV+GI7mlu6BWI4PZ3cXiTnQ54Uf1I= X-Google-Smtp-Source: ABdhPJzOErHhEkhCh9EJI4GT7EBhMAEaMyu97hAOx70DUHnw2UgHafwWHHIKdPvynjFR28LWZZv3wBqG7j9w8Kk= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:55f9:6fdc:d435:ad28]) (user=saravanak job=sendgmr) by 2002:a05:6214:1e1:: with SMTP id c1mr5744296qvu.42.1628908301138; Fri, 13 Aug 2021 19:31:41 -0700 (PDT) Date: Fri, 13 Aug 2021 19:31:31 -0700 In-Reply-To: <20210814023132.2729731-1-saravanak@google.com> Message-Id: <20210814023132.2729731-3-saravanak@google.com> Mime-Version: 1.0 References: <20210814023132.2729731-1-saravanak@google.com> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog Subject: [PATCH v1 2/2] of: property: fw_devlink: Add support for "phy-handle" property From: Saravana Kannan To: Rob Herring , Frank Rowand Cc: Saravana Kannan , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Allows tracking dependencies between consumers of an Ethernet PHY and the parent devices that own the PHY. Cc: Andrew Lunn Cc: netdev@vger.kernel.org Signed-off-by: Saravana Kannan --- Hi Andrew, I spent a few hours looking at most/all uses of phy-handle and my comment in the code seems valid. Can you confirm that please? Also there are so many phy related properties that my head is spinning. Is there a "phy" property (which is different from "phys") that treated exactly as "phy-handle"? -Saravana drivers/of/property.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 931340329414..70d9843fd4bf 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1350,6 +1350,20 @@ static struct device_node *parse_interrupts(struct device_node *np, return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; } +static struct device_node *parse_phy_handle(struct device_node *np, + const char *prop_name, int index) +{ + if (strcmp(prop_name, "phy-handle")) + return NULL; + + /* + * Device tree nodes pointed to by phy-handle never have struct devices + * created for them even if they have a "compatible" property. So + * return the parent node pointer. + */ + return of_get_next_parent(of_parse_phandle(np, prop_name, index)); +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1379,6 +1393,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_resets, }, { .parse_prop = parse_leds, }, { .parse_prop = parse_backlight, }, + { .parse_prop = parse_phy_handle, }, { .parse_prop = parse_gpio_compat, }, { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, },