From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 91046C4338F for ; Fri, 6 Aug 2021 04:50:20 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFC68611C5 for ; Fri, 6 Aug 2021 04:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BFC68611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E84F382E2B; Fri, 6 Aug 2021 06:50:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ixod1OLe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 57C2382E48; Fri, 6 Aug 2021 06:50:15 +0200 (CEST) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D696C82E15 for ; Fri, 6 Aug 2021 06:50:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-pj1-x102f.google.com with SMTP id pj14-20020a17090b4f4eb029017786cf98f9so15175794pjb.2 for ; Thu, 05 Aug 2021 21:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z1SKqU7ODXXLxpTzOPZCM9MUgfqKNuGlmuTTxSuJMY4=; b=Ixod1OLedtuYhQbFwMI4D7188dAJXQHgD1SuwpgDbJdfh9o/hcVE+IbBKmw5oGOarE 2bFv72CSp0zl9YqmvCXA4lLMdKyKOj+0UwquIrN+MwkWiNwGMxaJKnjp/EIqNTSk4mB1 FG9q2/MLYok1XXw4TpiyjKxTsUQ8ut6UczPlx+9o3L0nx6J/IixjrpTAL5moxfz1IIDg 47Z5tGlFdOi2vVzaUZo/ourcr51UWrDSUMZ2VRbBBCl9Zrbnw0l0bghX0vXb9gqwg6U4 uNwTDuh4j7RdikxJJXy/8yMCGl2TewDI7YLln9BBgEG8rdPq7vxPo2LrL5t6epysf35o jqaQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z1SKqU7ODXXLxpTzOPZCM9MUgfqKNuGlmuTTxSuJMY4=; b=l3fbHbTdaCXK6/OhxIJG7KLjPw6lkxDYpVLXav1nDSvxP3tltNt5kjV3GliBP8UxxH whcB8pQyO3Z/2DVp2CjnEfS9tNEYzxQxOYWqcKPPYo8SRqRpEhAm9ICEM6kwTSax8iBv XXsxZPtZ1gmjbyW7WpaR/rPXC0fXLQ4qWOXJXfvTHYF6DqqHntGuXES4Kevi/m/5trYI lRJt25T/s4MOTogPQuKmlEuzTQ+N0SesYFaZWmK3SJmTd/DRvwpLe7RBnNszR3t8aM2g T23GA4Bbiu+Wn+UO30e8OAALaKpmx4hpS/9nAu7LEqy1Lfmy5bP7Z4g+2NrSFm5tlOA5 BC3g== X-Gm-Message-State: AOAM53067q00lBarXMwBbxcpbZf46/YtIhpHbHnwHz21+SAifAfwi0O6 GHp09aC912gMGYreW8cGe1ciNzUdvGg= X-Google-Smtp-Source: ABdhPJwlzH5FnpW5gFuACYRCgXwx1zp04t0NFKFB7zlleDYaavIKMf2vMBafWFyK3IyvERH6ZyZCVQ== X-Received: by 2002:a65:615a:: with SMTP id o26mr270326pgv.177.1628225410146; Thu, 05 Aug 2021 21:50:10 -0700 (PDT) Received: from localhost.localdomain ([66.218.48.244]) by smtp.gmail.com with ESMTPSA id m11sm11394074pjn.2.2021.08.05.21.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 21:50:09 -0700 (PDT) From: Tony Dinh To: U-Boot Mailing List , Stefan Roese , Simon Glass , Ramon Fried , Joe Hershberger Cc: Tom Rini , Tony Dinh Subject: [PATCH 1/3] Add fdt network helper header file Date: Thu, 5 Aug 2021 21:49:08 -0700 Message-Id: <20210806044910.23500-2-mibodhi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210806044910.23500-1-mibodhi@gmail.com> References: <20210806044910.23500-1-mibodhi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Add include header file include/fdt_support_net.h Signed-off-by: Tony Dinh --- include/fdt_support_net.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/fdt_support_net.h diff --git a/include/fdt_support_net.h b/include/fdt_support_net.h new file mode 100644 index 0000000000..4fe447f803 --- /dev/null +++ b/include/fdt_support_net.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0+ + * + * Copyright (C) 2021 Tony Dinh + */ + +#ifndef __fdt_support_net_h +#define __fdt_support_net_h + +/** + * This file contains convenience functions for decoding network related + * information from FDTs. It is intended to be used by board-specific code + * within U-Boot. + */ + +/* + * fdt_get_phy_addr - Return the Ethernet PHY address + * + * Convenience function to return the PHY address of an + * ethernet device given its full path as defined in the device tree + * + * @path full path to the network device node + * @return PHY address, or -1 if it does not exist + * + * Usage examples: + * + * Get PHY address of eth0 for a Kirkwood board as defined in kirkwood.dtsi + * int phyaddr; + * char *eth0_path = "/ocp@f1000000/ethernet-controller@72000"; + * phyaddr = fdt_get_phy_addr(eth0_path); + * + * Get PHY address of eth1 for a Armada 38x board as defined + * in armada-38x.dtsi + * int phyaddr; + * char *eth1_path = "/soc/ethernet@30000"; + * phyaddr = fdt_get_phy_addr(eth1_path); + */ +int fdt_get_phy_addr(const char *path); + +#endif -- 2.20.1