From patchwork Mon Apr 19 15:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12212163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C067C433B4 for ; Mon, 19 Apr 2021 15:49:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 76E1D61246 for ; Mon, 19 Apr 2021 15:49:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76E1D61246 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5nyL3iUnXvDxENhIdEc/m1tWXkKxWyrALFNrtbZJk+A=; b=MCmeYCnVqP0k8kAJCeHFttFMK tic0ItOybwBWe1RawHVPUHf2JSZRDeicJlDWq3FyXAtwN+wfHhl+Hvxx85Hg5P7MboJ2QIGjO3P4C Ukz+DBb7kF7/tkKQwJbp44OkvUL+kQ6Sgg+RDLzYAQEzebtu/zFB0LQsJhv6UUCHkFCOcoFbCmHZJ pNb7sVC2KZfsgZjv8nm/U+NiEK+ev3TyjQUp5QzFr7Zik22kmB157qfL6xuyMgIfx9ysDaivcr7tT E0uAtJ7xexOpxz3zTpRZrnxJQM3EQuPXxxWqdvCbZODsu8HBtuTZ3nIxgYL+h8i9elwmspkT7YZIE ebxr6CBWA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYW7Y-00ADGH-MG; Mon, 19 Apr 2021 15:47:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYW7F-00ADED-Av; Mon, 19 Apr 2021 15:47:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=5bzjff+su6HXIaTpyjBroSwlupbpwpZmI0kJmdwR1sA=; b=vCTN+zPWwZMuRi7PMuGN10Thxx yBUcQPqyPzjEJJfkNlTU+mb5rLhb6xwHz5VQ4x6LJxbA0XIzGMOR7w50QRsykmFnF7C8nlyEci2cN wTYFN0q6pomfYq8JUTdtd4NWanLFidK+2Zo7KPsdC1DAixX1ZDX2Lso23kVBV5+17TAki4ggtXoUx oENiFJlvO2x/Ga3KtnTLq9PKQF6XtO2i/e8TlulJBg7lpx/U4m0YS2usYBtfjzEeGWrA8q18HEmrb 1cM5U2gTg+OaRcXeX+b64nrFOlJ/5Bk5pDZrBY4q8hNkLtW9JxSXudIr1pQwx+g9cI7YLgJmqzyui amwuNxnQ==; Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYW7A-00BUwo-2B; Mon, 19 Apr 2021 15:47:12 +0000 Received: by mail-pf1-x435.google.com with SMTP id c3so4653207pfo.3; 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=QpKslXOfxwp0IsIDOKmzFfctL9beCLKX2c2nBgygiAStxes2MAQLFHfZR++FYjOZIa jfV/DXj/6m6EKPN6pB6LqWsEgm+pq1dKQ6UPSPorvC2k+PhtU2u3tmfG6Y5affgNp6on LUQPBeG4uUdTpL2PpOCdl9oW/R3Y8FaWv3xntRmSAXJ0ePTXjpC1a1CkZ0fcEwgM7NoK CXKPbeE7EHYW32B8VdMIooHPEQ7L8T+0MYiUFIvSTwjxCUs4vzIvaUrVjrxRzekIEFqf LH2sd+eODkwhfH4QRAbqk6OOD+1a8IzEPVbQ/rn0UJZBhwqh+hC2i3O4/jgN74Br4fWx f6nw== X-Gm-Message-State: AOAM530q/RKaHsvU2zS09GEMiRa0fd1ZFS2iP+lEXkV0yzn9RMhC+o62 fTlV7tRZCA6lDxnt7ehlZ2Y= X-Google-Smtp-Source: ABdhPJy9R/pUClK4i2RW8B6XQkBUuBDnjzRtHvwyP++1eSHFoDzj6/4ku6ALOfkrnznbdlMghY4OKQ== 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_van_Dor?= =?utf-8?q?st?= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_084708_125375_3609B5F0 X-CRM114-Status: GOOD ( 15.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Andrew Lunn --- 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]);