From patchwork Mon Apr 19 15:46:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 12212157 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 DEB58C43462 for ; Mon, 19 Apr 2021 15:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFF2F61104 for ; Mon, 19 Apr 2021 15:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241619AbhDSPrl (ORCPT ); Mon, 19 Apr 2021 11:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbhDSPri (ORCPT ); Mon, 19 Apr 2021 11:47:38 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 155DAC06174A; Mon, 19 Apr 2021 08:47:07 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id nk8so5025006pjb.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=d6IeN222L2AvMC3BWodguJL4uvfgEGERLTNiOfhrG14=; b=d+KMjGdwLqY1RKsIEwvO2O/+nJyhETXl0eZQN9OgrfAQFOdo0cPkMwuPXUvA849dKX Z0OA/iV0oQNKVvgQASsytNZ+0D/qE25JJIWkIfJ7kVlTwQHmjbP3jXKCfm3fDShGUuzH BwMbic2WtsJxI/z4kZTSglL1GG9kr7BRGT1EajjilM5bSWuFXYYGMZmlUPP/vZlo/cQa LbiBcQ/44cAnK82wqwyA8jH54x8x4Sk2g/n3vIUevFzHqrJN7yWkX1bCPOfG+Nsn3fM2 HSEiRieW7yA7bsKjTbnXiMySGxv8aiWYuhmg6xuTDNhQ3QoIOEVkQfWoDug3V6YnIGzO YVvA== 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=LoararCX2bApbvYwocq6AL6m3TgHqpjxRb1Qve56YT3X2BsS1XDg/mJN/9h7pQkzj5 s3pWuqoefAKBKS1Mka/p/E5ZjFp9hyJZWd5KTpezXVOlkCSTJsdsI7QVtxL+8YWiilzA IP6CFtWm8CVcetxx6OF5zB4L3feql9K5fFG0VpcMsh8LGpfxtqeXpHU5j73i3FMKAGC/ fgEmYyCMN7ucuJfZyZAj/wPOcLZAYQ+z4OHnekQzOBt4aWhvF50JEZhqBO//LCBSXxe3 VUoeOhs+geuHcAJM/vD24di4vAfr1en5rxKmuAgf0hVAOdglYDzZA+X7UxQH4V1Z7wJ4 WBNw== X-Gm-Message-State: AOAM532RITgLd0MDkBqWr8BrXjanrGUCnzLTXaoPWSIP8nxk7HnJ0JiK I6ySvsa+iRzIVWl+lmnWabo= X-Google-Smtp-Source: ABdhPJyQOLYsHUKaECSVkjdiOan+lnRWKTgrZi8x0QQ9DX5p0KE3pkRZKrm4yz1se7ftVYlH6bGPag== X-Received: by 2002:a17:90b:4504:: with SMTP id iu4mr25401047pjb.76.1618847226695; Mon, 19 Apr 2021 08:47:06 -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:06 -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 v2 1/2] dt-bindings: net: mediatek: add optional GMAC labels Date: Mon, 19 Apr 2021 08:46:58 -0700 Message-Id: <20210419154659.44096-2-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 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 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: 12212155 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 45F42C433ED for ; Mon, 19 Apr 2021 15:47:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E23A61104 for ; Mon, 19 Apr 2021 15:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241592AbhDSPrj (ORCPT ); Mon, 19 Apr 2021 11:47:39 -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-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 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 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]);