From: "Clément Léger" <clement.leger@bootlin.com>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>
Cc: "Clément Léger" <clement.leger@bootlin.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] net: ocelot: add support to get mac from device-tree
Date: Thu, 28 Oct 2021 15:49:30 +0200 [thread overview]
Message-ID: <20211028134932.658167-2-clement.leger@bootlin.com> (raw)
In-Reply-To: <20211028134932.658167-1-clement.leger@bootlin.com>
Add support to get mac from device-tree using of_get_mac_address.
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
drivers/net/ethernet/mscc/ocelot_vsc7514.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
index d51f799e4e86..c39118e5b3ee 100644
--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
+++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
@@ -526,7 +526,10 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
ocelot_pll5_init(ocelot);
- eth_random_addr(ocelot->base_mac);
+ ret = of_get_mac_address(ocelot->dev->of_node, ocelot->base_mac);
+ if (ret)
+ eth_random_addr(ocelot->base_mac);
+
ocelot->base_mac[5] &= 0xf0;
return 0;
--
2.33.0
next prev parent reply other threads:[~2021-10-28 13:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 13:49 [PATCH 0/3] Add FDMA support on ocelot switch driver Clément Léger
2021-10-28 13:49 ` Clément Léger [this message]
2021-10-28 14:06 ` [PATCH 1/3] net: ocelot: add support to get mac from device-tree Vladimir Oltean
2021-10-28 14:15 ` Clément Léger
2021-10-28 14:22 ` Vladimir Oltean
2021-10-28 14:38 ` Clément Léger
2021-10-28 14:51 ` Vladimir Oltean
2021-10-28 15:28 ` Clément Léger
2021-10-29 6:09 ` Clément Léger
2021-10-29 11:35 ` Vladimir Oltean
2021-10-29 11:53 ` Clément Léger
2021-10-28 13:49 ` [PATCH 2/3] dt-bindings: net: convert mscc,vsc7514-switch bindings to yaml Clément Léger
2021-10-28 13:49 ` [PATCH 3/3] net: ocelot: add FDMA support Clément Léger
2021-10-28 14:12 ` Vladimir Oltean
2021-10-28 14:31 ` Clément Léger
2021-10-28 14:54 ` Vladimir Oltean
2021-10-28 14:07 ` [PATCH 0/3] Add FDMA support on ocelot switch driver Vladimir Oltean
2021-10-28 14:23 ` Clément Léger
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=20211028134932.658167-2-clement.leger@bootlin.com \
--to=clement.leger@bootlin.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=vladimir.oltean@nxp.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;
as well as URLs for NNTP newsgroup(s).