From: Tony Dinh <mibodhi@gmail.com>
To: U-Boot Mailing List <u-boot@lists.denx.de>,
Stefan Roese <sr@denx.de>, Simon Glass <sjg@chromium.org>,
Ramon Fried <rfried.dev@gmail.com>,
Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>, Tony Dinh <mibodhi@gmail.com>
Subject: [PATCH v2 2/3] common: Add fdt network helper header file
Date: Sat, 14 Aug 2021 17:17:12 -0700 [thread overview]
Message-ID: <20210815001713.4148-2-mibodhi@gmail.com> (raw)
In-Reply-To: <20210815001713.4148-1-mibodhi@gmail.com>
Add include header file fdt_support_net.h
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Tony Dinh <mibodhi@gmail.com>
---
Changes in v2:
- Return FDT_ERR_NOTFOUND if fdt_get_phy_addr failed to find PHY addr
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..87852ffc41
--- /dev/null
+++ b/include/fdt_support_net.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0+
+ *
+ * Copyright (C) 2021 Tony Dinh <mibodhi@gmail.com>
+ */
+
+#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 -FDT_ERR_NOTFOUND 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
next prev parent reply other threads:[~2021-08-15 0:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 4:49 [PATCH 0/3] common: Add fdt network helper Tony Dinh
2021-08-06 4:49 ` [PATCH 1/3] Add fdt network helper header file Tony Dinh
2021-08-12 6:17 ` Stefan Roese
2021-08-13 22:26 ` Ramon Fried
2021-09-25 15:15 ` Simon Glass
2021-08-06 4:49 ` [PATCH 2/3] Add fdt network helper functions Tony Dinh
2021-08-12 6:15 ` Stefan Roese
2021-08-12 9:12 ` Tony Dinh
2021-08-13 22:27 ` Ramon Fried
2021-08-06 4:49 ` [PATCH 3/3] Add fdt network helper to Makefile Tony Dinh
2021-08-12 6:17 ` Stefan Roese
2021-08-13 22:28 ` Ramon Fried
2021-08-12 6:18 ` [PATCH 0/3] common: Add fdt network helper Stefan Roese
2021-08-15 0:17 ` [PATCH v2 1/3] " Tony Dinh
2021-08-15 0:17 ` Tony Dinh [this message]
2021-08-15 0:17 ` [PATCH v2 3/3] common: Add fdt network helper functions Tony Dinh
2021-08-15 14:09 ` [PATCH 0/3] common: Add fdt network helper Simon Glass
2021-08-15 21:27 ` Tony Dinh
2021-08-16 23:36 ` Tony Dinh
2021-08-17 16:09 ` Simon Glass
2021-08-27 4:00 ` Tony Dinh
2021-09-01 9:21 ` Tony Dinh
2021-09-02 16:41 ` Simon Glass
2021-09-03 2:24 ` Tony Dinh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210815001713.4148-2-mibodhi@gmail.com \
--to=mibodhi@gmail.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.