From patchwork Thu Oct 28 13:49:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12590243 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 454C1C433EF for ; Thu, 28 Oct 2021 13:52:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C0BB61039 for ; Thu, 28 Oct 2021 13:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbhJ1Ny1 (ORCPT ); Thu, 28 Oct 2021 09:54:27 -0400 Received: from mslow1.mail.gandi.net ([217.70.178.240]:58431 "EHLO mslow1.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231148AbhJ1NyW (ORCPT ); Thu, 28 Oct 2021 09:54:22 -0400 Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 7AC1EC5142; Thu, 28 Oct 2021 13:51:27 +0000 (UTC) Received: (Authenticated sender: clement.leger@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id A81E6FF816; Thu, 28 Oct 2021 13:51:02 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: "David S. Miller" , Jakub Kicinski , Rob Herring , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , 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 Message-Id: <20211028134932.658167-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211028134932.658167-1-clement.leger@bootlin.com> References: <20211028134932.658167-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add support to get mac from device-tree using of_get_mac_address. Signed-off-by: Clément Léger --- 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;