Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4403078pxf; Tue, 23 Mar 2021 09:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaMQjMJaecOhabuAt2ZNftsymdiO47YyaE9NiANVEWN3GY7l7njmlm37bypSl7CNgdoh5A X-Received: by 2002:a17:906:3409:: with SMTP id c9mr5767206ejb.314.1616517855754; Tue, 23 Mar 2021 09:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616517855; cv=none; d=google.com; s=arc-20160816; b=KFskzxjdrNKaSgt5OCJe3/0B7p0JYyHi33uM3PjI8CQIewa5P8zSwvRkwwzFMRojzS 0FgUmazMpaqdUPcKJxntnWAi2nYG9zGCHLAFWW4ufhGTMKBpUJ6MSbgyNnABGbGuSLd6 6nCKEic2G8Jzq9zZ+byYEEF9sr4lOt6LPNBTnj9Mpt+Rz31kQZHYdz2bkDqN6hiHuZml Kum0jXVj7eOlfH2vnk7IDevk6z3CK4mB3gjVT5ZOS6u3GUEW5bxwD3PdLe96eVjegHtC UBe2ruaTtCiOp6zTg5tRfHNEGqOOQBeDyuMUhkpM7cqRgzyxxhdJatIsor54ht/Dz6Y5 JoOA== 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 :ironport-sdr:ironport-sdr; bh=FzfbR+xc6IHt+nhi4IQj6NIZrscOMkeMNp3/gC5WenQ=; b=I6dHm+Ac1oAMa+VB4KzNIXgD6b2LeSdD73Nz+5tRkh27aLZRSRfPL7p9BB5OjbdDnL QuhKOCc5PUrq85JeW0uNs5Vfp1xKHkQv9JXf9zx9eAvtu3jmVAHYQOSRsAb2QLD+gdW5 QSwUmrYauKt8/KlBhJxqJkMSIkZjKleNaGFH/7aS2jy0FC+djdyEAqow4lwG5lVx7W0Z xx44U8hsRMWi7Dyji5bv0JqOgUbqk/VIyCIlDGpM0Grf73mXrAlMe9Hz6YaY0k2iuG6m Xj8sLgTA1yW+MsDIRpiTKEWJJ/qfi9sUd6+4MbV58CNChrmvRfDsnK6vRIln1mW0vkQ6 YHiQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt40si13585789ejc.577.2021.03.23.09.43.50; Tue, 23 Mar 2021 09:44:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233286AbhCWQmz (ORCPT + 99 others); Tue, 23 Mar 2021 12:42:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:14550 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233117AbhCWQmd (ORCPT ); Tue, 23 Mar 2021 12:42:33 -0400 IronPort-SDR: yVVciRJlSFr3BpfE540ygosXLl5AIocNaJghT+KMHnXE/1psc0K1yRChIZ3mOCIdiMCW4Zbr9+ g0Sket0f0mDw== X-IronPort-AV: E=McAfee;i="6000,8403,9932"; a="187198388" X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="187198388" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 09:42:32 -0700 IronPort-SDR: 84xPRr46Uy/BvgfKwPID2GwAGiVxWv/NEowCLPizF12T/LzW9ngxTWO0z9oExR30c7T+MvyVJx h6NH+QauRZ+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="408403259" Received: from linux.intel.com ([10.54.29.200]) by fmsmga008.fm.intel.com with ESMTP; 23 Mar 2021 09:42:31 -0700 Received: from glass.png.intel.com (glass.png.intel.com [10.158.65.59]) by linux.intel.com (Postfix) with ESMTP id 690D8580718; Tue, 23 Mar 2021 09:42:29 -0700 (PDT) From: Wong Vee Khee To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Voon Weifeng , Ong Boon Leong Subject: [PATCH net-next 1/2] net: phy: add genphy_c45_loopback Date: Wed, 24 Mar 2021 00:46:40 +0800 Message-Id: <20210323164641.26059-2-vee.khee.wong@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323164641.26059-1-vee.khee.wong@linux.intel.com> References: <20210323164641.26059-1-vee.khee.wong@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add generic code to enable C45 PHY loopback into the common phy-c45.c file. This will allow C45 PHY drivers aceess this by setting .set_loopback. Suggested-by: Heiner Kallweit Signed-off-by: Wong Vee Khee --- drivers/net/phy/phy-c45.c | 8 ++++++++ include/linux/phy.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 077f2929c45e..91e3acb9e397 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -560,6 +560,14 @@ int gen10g_config_aneg(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(gen10g_config_aneg); +int genphy_c45_loopback(struct phy_device *phydev, bool enable) +{ + return phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1, + MDIO_PCS_CTRL1_LOOPBACK, + enable ? MDIO_PCS_CTRL1_LOOPBACK : 0); +} +EXPORT_SYMBOL_GPL(genphy_c45_loopback); + struct phy_driver genphy_c45_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, diff --git a/include/linux/phy.h b/include/linux/phy.h index 1a12e4436b5b..8e2cf84b2318 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1532,6 +1532,7 @@ int genphy_c45_read_mdix(struct phy_device *phydev); int genphy_c45_pma_read_abilities(struct phy_device *phydev); int genphy_c45_read_status(struct phy_device *phydev); int genphy_c45_config_aneg(struct phy_device *phydev); +int genphy_c45_loopback(struct phy_device *phydev, bool enable); /* Generic C45 PHY driver */ extern struct phy_driver genphy_c45_driver; -- 2.25.1