From patchwork Mon Apr 19 04:03:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12210693 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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 AD0CAC43461 for ; Mon, 19 Apr 2021 04:04:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7538160E09 for ; Mon, 19 Apr 2021 04:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233643AbhDSEEk (ORCPT ); Mon, 19 Apr 2021 00:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233148AbhDSEEg (ORCPT ); Mon, 19 Apr 2021 00:04:36 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A00C06174A; Sun, 18 Apr 2021 21:04:07 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id p12so23328338pgj.10; Sun, 18 Apr 2021 21:04: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=d6IeN222L2AvMC3BWodguJL4uvfgEGERLTNiOfhrG14=; b=hp1kcgZxFWT8L4BFkOKZifS1WtozMEz2JHpzcAYKcXyohrFfbFPqyKBqsn6UVaaE92 ujAG3bWmhL7fMQVAsynqU56t4V8rqWcZM2VbZgtgwennO/CJhtf1sTkk6FGc3altf0Ke 1UwCM7LXFIO9ZJSvQcL2W0XjXxaG3YIjDYXnPO1G4BE4HKn4BKET0yY9EiWLcBlntNmS 1S6AyBdFKVYPoAwXDqWVaD5gSI8grL8VtmgZ3YMIEgEFDklO0tDT8J4YWoy+/VZ/ExRZ XtHqAm4SXDdMYLHfBTTo4Axxo02/L/eko/10X4PPiPJsffZ4902yw7hixvGgfRFgB1H5 i9XQ== 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=d6IeN222L2AvMC3BWodguJL4uvfgEGERLTNiOfhrG14=; b=tC05CetO6PGGnBSj7P6lMdw+FUGfhFm5B003R3Tbq2aL+VcTXhAlJyHwO+89VHzQ1m cFvzLhUZzfTFQ3JnL0wuZaAeK9Ko6+QOj4DcphP5rWr+Lg5QUBqeUy1oeerI1tZrDYO0 SeOkbuo+nZf7Wa/flOTo3IeMwKXwIPleP0N63huWvTLIfrGT7jenQBQHyob4QgsuOgiv QCwVXskiBHqlUWcvGCLLjAcQoFeLF4IMLvP01AKeSI9vBev0VHcouJCjwZwTHkVyzgVV Ee6lfCI4+K32m9fknlQsB/d84LTT/80M6QzHqZtC863eG+vI+kNSb/NV6vq/iHdFOA9T 93gw== X-Gm-Message-State: AOAM532sieXMX5f9sxxBibH4p9hjkX1bZn1PtECo82NdO7KDAke7MR7/ cl68vbIwzWzD1Nt5gBQoaS0= X-Google-Smtp-Source: ABdhPJySGEplzNOMXbX8mZJ9ih1HgpaLsQcB9orNv5Od5eujgBSB/bPGQSA2iseT8Vp27TAWSqWWcQ== X-Received: by 2002:a65:42c3:: with SMTP id l3mr8072387pgp.258.1618805047563; Sun, 18 Apr 2021 21:04:07 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id 25sm12169423pgx.72.2021.04.18.21.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 21:04: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 Subject: [PATCH net-next 1/2] dt-bindings: net: mediatek: add optional GMAC labels Date: Sun, 18 Apr 2021 21:03:51 -0700 Message-Id: <20210419040352.2452-2-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419040352.2452-1-ilya.lipnitskiy@gmail.com> References: <20210419040352.2452-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Document the mediatek ethernet driver change that adds support for custom labels and provide an example. Signed-off-by: Ilya Lipnitskiy --- Documentation/devicetree/bindings/net/mediatek-net.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt index 72d03e07cf7c..500bf9351010 100644 --- a/Documentation/devicetree/bindings/net/mediatek-net.txt +++ b/Documentation/devicetree/bindings/net/mediatek-net.txt @@ -51,6 +51,10 @@ Required properties: is equal to 0 and the MAC uses fixed-link to connect with internal switch such as MT7530. +Optional properties: +- label: overrides the default netdevice name. Useful when a custom name for the + DSA master interface is desired. + Example: eth: ethernet@1b100000 { @@ -74,12 +78,14 @@ eth: ethernet@1b100000 { gmac1: mac@0 { compatible = "mediatek,eth-mac"; + label = "gmac1"; reg = <0>; phy-handle = <&phy0>; }; gmac2: mac@1 { compatible = "mediatek,eth-mac"; + label = "gmac2"; reg = <1>; phy-handle = <&phy1>; }; From patchwork Mon Apr 19 04:03:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12210695 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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 E0240C43461 for ; Mon, 19 Apr 2021 04:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5A2460E09 for ; Mon, 19 Apr 2021 04:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234750AbhDSEEt (ORCPT ); Mon, 19 Apr 2021 00:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbhDSEEj (ORCPT ); Mon, 19 Apr 2021 00:04:39 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A3A7C06174A; Sun, 18 Apr 2021 21:04:09 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id g16so9000970pfq.5; Sun, 18 Apr 2021 21:04:09 -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=nooF0bh3uQe/ilf/ttra6OUts5vU91KPBygIK+rN8CU=; b=lAE1M2kH8mYGvH4QI2ZOpm39wWa82gcbp2UhP0pd8YfHtS/cOHPn9k/+8vBbmYjPJQ B7YLOHcKKQodQni2ID6ZRG2C0cTCaYNx0r8PsACXLeUGRwGlqUl6sFPiguWqasIDKqv7 9sQbY2hmfpnYLHWq9rpDcQ8NcaTO9VZfmP6dzOiwAOykn5lV7XDx4ktxT1rTQzVPy/K8 EoGHHeIwtJ2vkaSTMK03l0Ffalq/2ItfJ/UjGYt33pY8UzUOtJc4ki8GM+TECddbVxH9 gZBsQUe370IvM+hutvbSC+uZlHx4BTSlVKqXbdZ4kLdJaD68OVyJoBhG9DWErIBZWrLm Ucbg== 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=nooF0bh3uQe/ilf/ttra6OUts5vU91KPBygIK+rN8CU=; b=pZsKj0eAEPdjU+IouHOAPGGdSDQGwSmTdIl+LheHsfKZh/BA8wR9sBsPHkY3tdMycd apb2m5oq46OATYz224ivbInrAlZJnBaKdV38L+dblG41urlQXnWCqEn4quhwrt7TSFrX EUq/TNCxQHq3XQgJgCmb2SdzQdEwYPkHUrDrnYKgLhbhdN3Y3BTGnZiEfSLK0UlOJOwU PNAtd3WvXI3SeNL5JG8pTVOr3fTM9CZMwBt6kjtLn2R99GU/25UY+du9WugRr1fH5c1K T4Z8IF1KSyKxb4U2K2UhgtrCunvA97u2GKyWGhzzY7HnxhHsU9QWA7MNjLX3jgsEtUs7 ZEIQ== X-Gm-Message-State: AOAM533oNstQZktnlU5NLsziM0pRVwPSJisMipSrL5ySPpqLIqF2l0Gn a+h2JsXIxe1DW5lAIAHGFRM= X-Google-Smtp-Source: ABdhPJz2bKhFE3qPTDDPaQXc8tpwKJvnnZWr0+4qR2uTa5yoJE0Y33ONufXaKA1nPG7HARQ8c5C9Tw== X-Received: by 2002:a63:5f54:: with SMTP id t81mr3727918pgb.286.1618805048816; Sun, 18 Apr 2021 21:04:08 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id 25sm12169423pgx.72.2021.04.18.21.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 21:04:08 -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 2/2] net: ethernet: mediatek: support custom GMAC label Date: Sun, 18 Apr 2021 21:03:52 -0700 Message-Id: <20210419040352.2452-3-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419040352.2452-1-ilya.lipnitskiy@gmail.com> References: <20210419040352.2452-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 6b00c12c6c43..4c0ce4fb7735 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; @@ -2940,6 +2941,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) else eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; + if (label) + strscpy(eth->netdev[id]->name, label, IFNAMSIZ); + return 0; free_netdev: