From patchwork Sat Jun 24 12:10:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TcOlbnMgUnVsbGfDpXJk?= X-Patchwork-Id: 13291640 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63984EB64DA for ; Sat, 24 Jun 2023 12:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbjFXMSP (ORCPT ); Sat, 24 Jun 2023 08:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbjFXMSO (ORCPT ); Sat, 24 Jun 2023 08:18:14 -0400 X-Greylist: delayed 323 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 24 Jun 2023 05:18:13 PDT Received: from unicorn.mansr.com (unicorn.mansr.com [81.2.72.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DA502112; Sat, 24 Jun 2023 05:18:13 -0700 (PDT) Received: from raven.mansr.com (raven.mansr.com [IPv6:2001:8b0:ca0d:1::3]) by unicorn.mansr.com (Postfix) with ESMTPS id A640A15360; Sat, 24 Jun 2023 13:12:48 +0100 (BST) Received: by raven.mansr.com (Postfix, from userid 51770) id 99CBA219FD1; Sat, 24 Jun 2023 13:12:48 +0100 (BST) From: Mans Rullgard To: Grygorii Strashko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , Tony Lindgren Subject: [RESEND][PATCH] net: cpsw: fix obtaining mac address for am3517 Date: Sat, 24 Jun 2023 13:10:59 +0100 Message-ID: <20230624121211.19711-1-mans@mansr.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Jeroen Hofstee Commit b6745f6e4e63 ("drivers: net: cpsw: davinci_emac: move reading mac id to common file") did not only move the code for an am3517, it also added the slave parameter, resulting in an invalid (all zero) mac address being returned for an am3517, since it only has a single emac and the slave parameter is pointing to the second. So simply always read the first and valid mac-address. Signed-off-by: Jeroen Hofstee Acked-by: Tony Lindgren --- drivers/net/ethernet/ti/cpsw-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpsw-common.c b/drivers/net/ethernet/ti/cpsw-common.c index bfa81bbfce3f..465dc15f059d 100644 --- a/drivers/net/ethernet/ti/cpsw-common.c +++ b/drivers/net/ethernet/ti/cpsw-common.c @@ -74,8 +74,12 @@ int ti_cm_get_macid(struct device *dev, int slave, u8 *mac_addr) if (of_machine_is_compatible("ti,am33xx")) return cpsw_am33xx_cm_get_macid(dev, 0x630, slave, mac_addr); + /* + * There is only one emac / mac address on an am3517 so ignore the + * slave = 1 and always get the macid from slave 0. + */ if (of_device_is_compatible(dev->of_node, "ti,am3517-emac")) - return davinci_emac_3517_get_macid(dev, 0x110, slave, mac_addr); + return davinci_emac_3517_get_macid(dev, 0x110, 0, mac_addr); if (of_device_is_compatible(dev->of_node, "ti,dm816-emac")) return cpsw_am33xx_cm_get_macid(dev, 0x30, slave, mac_addr);