Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7370415rwb; Tue, 6 Dec 2022 05:04:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HAIiZocnJecRKmAoGi5w72zgkXtG1N/KVO6vOp/AVg73/KT5Yaug9Xy3lZdpve/hSIxtZ X-Received: by 2002:a17:902:b611:b0:189:1c94:99c3 with SMTP id b17-20020a170902b61100b001891c9499c3mr69834904pls.140.1670331853607; Tue, 06 Dec 2022 05:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670331853; cv=none; d=google.com; s=arc-20160816; b=wyQEU0AkZgRlDKjlhezBEzn5o2J/nA5rxaRQNg4n7AoF9kB1HayZhgOrNwlx+Asifl 5LzqLeBi9+zRhF96v8ef2dXhChIRGgdPsjoDvgpjcjhUxXKYE6EO5vOJ1cIV3JBezCoi M8ksXufjPw1ZffTaImwMmkyrUNvwiGTAAzecQl0p0itGHCkuVRVc6tJyh0pkQyDJmjOR W6yH6V0dMcTHTjWhCS8yPTnWvQnesQ88HUK6ILxkmelHm1TT0WGFIk7Lniw8gAoKt8JS Yi+QDYqg3EB+Hddln51stVW89VyjGX7KzafQrEhu4P8rirJ6c0Mks0N5N2xD3OKuHlbI DNqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FXBmcabeWV8OKzX28uoLmsQs7tuaar1G2adsb2jdhL4=; b=ux7m7etCVlecTSqmyUJXBW7gAp7NAQU2jAV8yr8V27/zeC0PJkKlAnXREYQx9q28Z0 wfIPwfk5qz9hJa+6O+Ihrt6T4gcrOIclKcZQsCQuHpqMMaoGTZlpklFf0mq+oTo4CZmD M8vyeeHflKcbdXmkGMV/GLFhaB5tPjZN5Ru14+uW+qCCr2vQzAErm9EqmyA7SmhnDcqW l6+GaMWcE6L+p8djMArCQrGzdaK3WVtEIvmx0Yqgdspp9xpnaPJ3QPaizl9Y81b0uzFd UdZbzGDRm9uANi4FAH2B3AdMpIeMTwdq9RDSC6rM8qVZWiEbisw+OfyEF/0fMXfey5UU adKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fgAhRp0Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 32-20020a631760000000b004782b471222si16380099pgx.223.2022.12.06.05.04.01; Tue, 06 Dec 2022 05:04:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fgAhRp0Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234494AbiLFMxQ (ORCPT + 79 others); Tue, 6 Dec 2022 07:53:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234387AbiLFMxC (ORCPT ); Tue, 6 Dec 2022 07:53:02 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D33872BD8; Tue, 6 Dec 2022 04:52:48 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id e13so20087506edj.7; Tue, 06 Dec 2022 04:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FXBmcabeWV8OKzX28uoLmsQs7tuaar1G2adsb2jdhL4=; b=fgAhRp0Zxgbh1QGUw5CSaxFoSJuAGkigAjZ+JI4KvUbGXZwe6i+MHIkxEBfGYG+Nvc 068rPdcUb/JkwZnSFqv7Tc82aYVr51PJ4B/ba0LdRU5K1Q4LTS/jKpy03WoEksA4rEt7 ZBOTKVP8aZlqfzPvKwsL3uTzBa9mF1wdyoBAV6emerCyt/EzJajgroDjLb6WN21Zio1h LAwUDo13VRPP+eNAWL3wFpMyTiMEhk4+Yt8UCIDkrYhPnCdpv74r6sQJCF2HNXx6lF3q wollQGeuCGZ/iLlCNCe4aWHl7t36E22K70C5Saa5dBw0uKikXZrNnE4VpFrylXxnAD69 KiTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FXBmcabeWV8OKzX28uoLmsQs7tuaar1G2adsb2jdhL4=; b=xgyx2b9oQhK8UcKFzMNn1AGEDtU6kaxurytZdIrlT3fzWfKk1mmIpbWlDZiPswgBcM YyXFI5eq3ZvHr8rZ4HsQ5epc6/OeRGS/oGEou68pAl+oTKqZnD57UdEZwb8CDDxf/WvF J6OM31igg7CADV76tzKUwnq+bo1anYhWe0yHrdQovG4xiTFq14wsQAM+Fp2fKDrKhNca emgIZI5krYxopeurTxGmkJhuojR+vE3UPYoe+aodZ72sgbKlybm1+pBlOjoNkskADGg8 25CfZ1JtNn07YrylZ7qZG0MsM1A7dVYAivILDv9dWZPbSag+dpIL9mjY9jdU21ZF+2Dc hsaQ== X-Gm-Message-State: ANoB5plV8JCC9YzupDFsEj9QQk54tdmL+LUHaGkuisuQRy4S/YopHh6w MnYxQ29FxvSRQp5R1FnT9H4= X-Received: by 2002:a05:6402:e04:b0:469:e6ef:9164 with SMTP id h4-20020a0564020e0400b00469e6ef9164mr29387573edh.185.1670331167169; Tue, 06 Dec 2022 04:52:47 -0800 (PST) Received: from gvm01 (net-2-45-26-236.cust.vodafonedsl.it. [2.45.26.236]) by smtp.gmail.com with ESMTPSA id a2-20020a170906684200b007bf71053d97sm7412434ejs.40.2022.12.06.04.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 04:52:46 -0800 (PST) Date: Tue, 6 Dec 2022 13:52:57 +0100 From: Piergiorgio Beruto To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Oleksij Rempel Subject: [PATCH v4 net-next 2/5] drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY Message-ID: <9dd727e8bfb3c1e9f0e7c13f101d7c6d040b9651.1670329232.git.piergiorgio.beruto@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the link modes for the IEEE 802.3cg Clause 147 10BASE-T1S Ethernet PHY. According to the specifications, the 10BASE-T1S supports Point-To-Point Full-Duplex, Point-To-Point Half-Duplex and/or Point-To-Multipoint (AKA Multi-Drop) Half-Duplex operations. Signed-off-by: Piergiorgio Beruto --- drivers/net/phy/phy-core.c | 5 ++++- drivers/net/phy/phylink.c | 6 +++++- include/linux/phy.h | 11 +++++++++++ include/uapi/linux/ethtool.h | 3 +++ net/ethtool/common.c | 8 ++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 5d08c627a516..a64186dc53f8 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -13,7 +13,7 @@ */ const char *phy_speed_to_str(int speed) { - BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 99, + BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 102, "Enum ethtool_link_mode_bit_indices and phylib are out of sync. " "If a speed or mode has been added please update phy_speed_to_str " "and the PHY settings array.\n"); @@ -260,6 +260,9 @@ static const struct phy_setting settings[] = { PHY_SETTING( 10, FULL, 10baseT_Full ), PHY_SETTING( 10, HALF, 10baseT_Half ), PHY_SETTING( 10, FULL, 10baseT1L_Full ), + PHY_SETTING( 10, FULL, 10baseT1S_Full ), + PHY_SETTING( 10, HALF, 10baseT1S_Half ), + PHY_SETTING( 10, HALF, 10baseT1S_P2MP_Half ), }; #undef PHY_SETTING diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 09cc65c0da93..319790221d7f 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -241,12 +241,16 @@ void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps) if (caps & MAC_ASYM_PAUSE) __set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes); - if (caps & MAC_10HD) + if (caps & MAC_10HD) { __set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, linkmodes); + __set_bit(ETHTOOL_LINK_MODE_10baseT1S_Half_BIT, linkmodes); + __set_bit(ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT, linkmodes); + } if (caps & MAC_10FD) { __set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, linkmodes); __set_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, linkmodes); + __set_bit(ETHTOOL_LINK_MODE_10baseT1S_Full_BIT, linkmodes); } if (caps & MAC_100HD) { diff --git a/include/linux/phy.h b/include/linux/phy.h index f3ecc9a86e67..49d0488bf480 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1036,6 +1036,17 @@ struct phy_driver { int (*get_sqi)(struct phy_device *dev); /** @get_sqi_max: Get the maximum signal quality indication */ int (*get_sqi_max)(struct phy_device *dev); + + /* PLCA RS interface */ + /** @get_plca_cfg: Return the current PLCA configuration */ + int (*get_plca_cfg)(struct phy_device *dev, + struct phy_plca_cfg *plca_cfg); + /** @set_plca_cfg: Set the PLCA configuration */ + int (*set_plca_cfg)(struct phy_device *dev, + const struct phy_plca_cfg *plca_cfg); + /** @get_plca_status: Return the current PLCA status info */ + int (*get_plca_status)(struct phy_device *dev, + struct phy_plca_status *plca_st); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 58e587ba0450..5f414deacf23 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -1741,6 +1741,9 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96, ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97, ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98, + ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99, + ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100, + ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101, /* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 21cfe8557205..c586db0c5e68 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -208,6 +208,9 @@ const char link_mode_names[][ETH_GSTRING_LEN] = { __DEFINE_LINK_MODE_NAME(800000, DR8_2, Full), __DEFINE_LINK_MODE_NAME(800000, SR8, Full), __DEFINE_LINK_MODE_NAME(800000, VR8, Full), + __DEFINE_LINK_MODE_NAME(10, T1S, Full), + __DEFINE_LINK_MODE_NAME(10, T1S, Half), + __DEFINE_LINK_MODE_NAME(10, T1S_P2MP, Half), }; static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS); @@ -244,6 +247,8 @@ static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS); #define __LINK_MODE_LANES_X 1 #define __LINK_MODE_LANES_FX 1 #define __LINK_MODE_LANES_T1L 1 +#define __LINK_MODE_LANES_T1S 1 +#define __LINK_MODE_LANES_T1S_P2MP 1 #define __LINK_MODE_LANES_VR8 8 #define __LINK_MODE_LANES_DR8_2 8 @@ -366,6 +371,9 @@ const struct link_mode_info link_mode_params[] = { __DEFINE_LINK_MODE_PARAMS(800000, DR8_2, Full), __DEFINE_LINK_MODE_PARAMS(800000, SR8, Full), __DEFINE_LINK_MODE_PARAMS(800000, VR8, Full), + __DEFINE_LINK_MODE_PARAMS(10, T1S, Full), + __DEFINE_LINK_MODE_PARAMS(10, T1S, Half), + __DEFINE_LINK_MODE_PARAMS(10, T1S_P2MP, Half), }; static_assert(ARRAY_SIZE(link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS); -- 2.35.1