Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2599850pxb; Mon, 19 Apr 2021 09:16:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylyx5yoWAyO9bMmmtEgfBd0c5BHy96Ug31vXAL16pb3PxjSCoJXEfJoSZQhRrKrmYw68ja X-Received: by 2002:a05:6402:b41:: with SMTP id bx1mr9230593edb.105.1618848965105; Mon, 19 Apr 2021 09:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618848965; cv=none; d=google.com; s=arc-20160816; b=Zlrf05Qp21EkX/jGVkefY58XcW+iahYJY0vEbbEG4j7Q6aFb7tzVviTCjYIeV15bFC 9rt5nHBLgU/gAtQksmN0cxzPlSFIlXVyrhAzTmWlJL6vWirm2m4n0yAG4pmSV/swhYtJ 32ZmEAJIheTmEAI568U6x9L8KRXEx0cUXcxbvhVFiQnmXxa7PFCS9XFKdunLG0e4RtBw Po8tcYyNM4+n/AxAJC4McqfSref9tsA+6Q+xsPnJDx8iE22/spZz/CA7YQqcAn95heD6 GM3HS8292qLhAPjVhFQ3jJ+Qr5Z3csGikgt/T84SeKTV6lqeViIxE12zcYQ7Ah4KTJ/r rwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5bzjff+su6HXIaTpyjBroSwlupbpwpZmI0kJmdwR1sA=; b=rcueLbcW9NVu4eymCWJGTxp/Mz1GMo78VRZZ0nUmDD2moMU6TaE670fE4xe+u0wsJ4 4UdKfHGXS25IRJ+lkW1zlRo6CwyZfEmAeTIUtH/+d8ATYEIqy04/bbt28KdSYu6Ou9SC RYn+U1q/wrwsGAvLijqetXNsjxt7rnCVExcmPfuOnNPtwbllH2z6bPEmL7gCC46CfD5o 7BIg9XrKq8RRQLnwBuBV1E69wIrW6eqXaXexDhcYBKe6dyI8/yZdaTQSGWto5KfrGTZI TuoTD+r+eJFxREV/8QjNQEP7mXyQhrgwFPcaBxV8GF8bfX6NjrtvGagABTh+/XxACov9 044Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B9MXwRU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh8si13803335ejb.639.2021.04.19.09.15.37; Mon, 19 Apr 2021 09:16:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B9MXwRU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241617AbhDSPrk (ORCPT + 99 others); Mon, 19 Apr 2021 11:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241330AbhDSPrh (ORCPT ); Mon, 19 Apr 2021 11:47:37 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A6EC061761; Mon, 19 Apr 2021 08:47:07 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id p12so24533480pgj.10; Mon, 19 Apr 2021 08:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5bzjff+su6HXIaTpyjBroSwlupbpwpZmI0kJmdwR1sA=; b=B9MXwRU5X1n4ceTorijsBBZblGJ8kcjMP43LSuW2efFbARNz7+Zvc5/SDoJ5hYkUKk aruI5gIM/i/+tKcnmSNUbHsG2g78SBSuBs6lKM21q/r0eHxTL9ZjaGzWVDfiT5h+ipAF QJnDmdyQ6htpSA3O8f0eSD7iYufopn+KFNDIg2gvLQPDh4TMQP7rJUSaLJO5JoQFloEm Q0fh76kPDqV6Ad31pVKMMI5PpqI8e4JnyjcWPS7dBdJJD+b2GaohejF+/HJqlPS+M2wA 7aozd+lOFtMVviIWSSiPGlxXG/qsD6rKkGyz77O5HOk03CFUhcxKjmspZZpfa0B3VcbX 8Wbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5bzjff+su6HXIaTpyjBroSwlupbpwpZmI0kJmdwR1sA=; b=CDRUpn0+im4a/QWb7T4A3FMAtn/R8dRLz6iOWN2Amf9X2S6y0z/fdPaii1fMJIj8Jb YEMaDDM/GwRiy2XjUpQePfjDDfhRbJZbF6E14nLEQj3wO+pULXSWs43HZkI94zHpqGwS OTaFTlVejN1sU4EkS/IfxU4ctzeBZOIgVGZKy26WL2n6suVkxRJzWIScQ1PlH71v3Irb MSHN4ck++no2/rSwHd2JDfbuop9lAiewn1HL9WKRR9ErGvaX6J/XACS2ZbPG4rw6Sb6b t6bFthLLtcT5cyOQO3x4/k0vrHgQIlJrOj8QTNLlmde0Bjh+34j+GtMPiOs7kgBAEpbd 0riw== X-Gm-Message-State: AOAM5306M92DghUpN0uSL1NgO2Mgzb8mJRsIJ7eWWRpCAB1ckZA5JZ6V xMq8q/nFbcnYdZHpLm3b2mI= X-Received: by 2002:a63:e405:: with SMTP id a5mr8785503pgi.89.1618847227364; Mon, 19 Apr 2021 08:47:07 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id u1sm15314139pjj.19.2021.04.19.08.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 08:47:07 -0700 (PDT) From: Ilya Lipnitskiy To: "David S. Miller" , Jakub Kicinski , Rob Herring , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: Ilya Lipnitskiy , =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Subject: [PATCH net-next v2 2/2] net: ethernet: mediatek: support custom GMAC label Date: Mon, 19 Apr 2021 08:46:59 -0700 Message-Id: <20210419154659.44096-3-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419154659.44096-1-ilya.lipnitskiy@gmail.com> References: <20210419154659.44096-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The MAC device name can now be set within DTS file instead of always being "ethX". This is helpful for DSA to clearly label the DSA master device and distinguish it from DSA slave ports. For example, some devices, such as the Ubiquiti EdgeRouter X, may have ports labeled ethX. Labeling the master GMAC with a different prefix than DSA ports helps with clarity. Suggested-by: René van Dorst Signed-off-by: Ilya Lipnitskiy --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 6b00c12c6c43..df3cda63a8c5 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2845,6 +2845,7 @@ static const struct net_device_ops mtk_netdev_ops = { static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { + const char *label = of_get_property(np, "label", NULL); const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; @@ -2867,9 +2868,10 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) return -EINVAL; } - eth->netdev[id] = alloc_etherdev(sizeof(*mac)); + eth->netdev[id] = alloc_netdev(sizeof(*mac), label ? label : "eth%d", + NET_NAME_UNKNOWN, ether_setup); if (!eth->netdev[id]) { - dev_err(eth->dev, "alloc_etherdev failed\n"); + dev_err(eth->dev, "alloc_netdev failed\n"); return -ENOMEM; } mac = netdev_priv(eth->netdev[id]); -- 2.31.1