From: Philip Oberfichtner <pro@denx.de>
To: u-boot@lists.denx.de
Cc: bmeng.cn@gmail.com, caleb.connolly@linaro.org,
christophe.roullier@foss.st.com, epsi@gmx.de,
eugen.hristev@collabora.com, festevam@gmail.com,
forbidden405@outlook.com, ivprusov@salutedevices.com,
joe.hershberger@ni.com, jonas@kwiboo.se,
kever.yang@rock-chips.com, leyfoon.tan@starfivetech.com,
marek.vasut+renesas@mailbox.org,
marjolaine.amate@odyssee-systemes.fr, neil.armstrong@linaro.org,
n-francis@ti.com, patrice.chotard@foss.st.com,
patrick.delaunay@foss.st.com, philipp.tomsich@vrull.eu,
rfried.dev@gmail.com, seanga2@gmail.com,
sebastian.reichel@collabora.com,
sebastien.szymanski@armadeus.com, sjg@chromium.org,
sumit.garg@linaro.org, trini@konsulko.com, xypron.glpk@gmx.de,
yanhong.wang@starfivetech.com, Philip Oberfichtner <pro@denx.de>
Subject: [PATCH 4/5] net: dwc_eth_qos: Implement bind() for PCI devices
Date: Fri, 3 May 2024 10:49:49 +0200 [thread overview]
Message-ID: <20240503084950.70680-5-pro@denx.de> (raw)
In-Reply-To: <20240503084950.70680-1-pro@denx.de>
PCI devices do not necessarily use a device tree. Implement a bind()
function to assign unique device names in that case.
Signed-off-by: Philip Oberfichtner <pro@denx.de>
---
drivers/net/dwc_eth_qos.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 36412d1c83..fdd64f074a 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -1376,6 +1376,21 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)
return 0;
}
+static int eqos_bind(struct udevice *dev)
+{
+ static int dev_num;
+ const size_t name_sz = 16;
+ char name[name_sz];
+
+ /* Device name defaults to DT node name. */
+ if (ofnode_valid(dev_ofnode(dev)))
+ return 0;
+
+ /* Assign unique names in case there is no DT node. */
+ snprintf(name, name_sz, "eth_eqos#%d", dev_num++);
+ return device_set_name(dev, name);
+}
+
/*
* Get driver data based on the device tree. Boards not using a device tree can
* overwrite this function.
@@ -1597,6 +1612,7 @@ U_BOOT_DRIVER(eth_eqos) = {
.name = "eth_eqos",
.id = UCLASS_ETH,
.of_match = of_match_ptr(eqos_ids),
+ .bind = eqos_bind,
.probe = eqos_probe,
.remove = eqos_remove,
.ops = &eqos_ops,
--
2.39.2
next prev parent reply other threads:[~2024-05-03 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 8:49 [PATCH 0/5] net: dwc_eth_qos: Add glue driver for Intel MAC Philip Oberfichtner
2024-05-03 8:49 ` [PATCH 1/5] x86: provide mb() macro Philip Oberfichtner
2024-05-03 8:49 ` [PATCH 2/5] net: dwc_eth_qos: Fix header to be self-contained Philip Oberfichtner
2024-05-03 8:49 ` [PATCH 3/5] net: dwc_eth_qos: Adapt probe() for PCI devices Philip Oberfichtner
2024-05-03 8:49 ` Philip Oberfichtner [this message]
2024-05-03 8:49 ` [PATCH 5/5] net: dwc_eth_qos: Add glue driver for Intel MAC Philip Oberfichtner
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=20240503084950.70680-5-pro@denx.de \
--to=pro@denx.de \
--cc=bmeng.cn@gmail.com \
--cc=caleb.connolly@linaro.org \
--cc=christophe.roullier@foss.st.com \
--cc=epsi@gmx.de \
--cc=eugen.hristev@collabora.com \
--cc=festevam@gmail.com \
--cc=forbidden405@outlook.com \
--cc=ivprusov@salutedevices.com \
--cc=joe.hershberger@ni.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=leyfoon.tan@starfivetech.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marjolaine.amate@odyssee-systemes.fr \
--cc=n-francis@ti.com \
--cc=neil.armstrong@linaro.org \
--cc=patrice.chotard@foss.st.com \
--cc=patrick.delaunay@foss.st.com \
--cc=philipp.tomsich@vrull.eu \
--cc=rfried.dev@gmail.com \
--cc=seanga2@gmail.com \
--cc=sebastian.reichel@collabora.com \
--cc=sebastien.szymanski@armadeus.com \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
--cc=yanhong.wang@starfivetech.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox