Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4553145pxb; Mon, 27 Sep 2021 21:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbTeVT2M1zSUfImKC3vWCtVbM3aY6m4fZrmwkNtdf9CqM3nBsznJsFYxDfoTtiz5Dt4jIv X-Received: by 2002:a50:d80d:: with SMTP id o13mr5143854edj.204.1632802517176; Mon, 27 Sep 2021 21:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632802517; cv=none; d=google.com; s=arc-20160816; b=TtTMc8poWWwlk6S+WIqf0uYVje139pQ3ueewp9dsv8WkjXipaPlSHVcxHuoGMhhlnR Zt3RDLnuzCk699SpiESfimwagkGCux+h+danY0iib6NCzQj+1YKfFQicpEwY1nlzvqS2 faELQZN63Rc1Wf75Wj91XXede37KFf3tgWGB3ZAN0zGons6TBK8FCUvJiXJVDU6E98vn DvRwjfBwSDTMfN9Pwlzcqo6NKN8WVB9ZcG7zdp4vohVDj1qXaJh9ERxQM5F4ijcUcL1X n6rhYdHiC9whkhFA8C5mpIEqG33egXoe51OByFLSLdTyT+MA8sv5PtLovqudmUIIqUcn KMTw== 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 :message-id:date:subject:cc:to:from; bh=/fLEbbBdamgtU9p1WWWpXnhty3LnEGDLfzY4JeG2yQQ=; b=BDUyrDtuI/inmY7uI4wy5eqKIyAU9SqcQJa2IPAxyHsHUwa8JWgUidW0RrzGPOUKM8 k6VWoJ0Z4wPr1c+DRgthyua9rXAZoFPWrBuJnJlHg2FQMa9meyJkVxopFGyv34V4bq8F eXuGfIHQcYRO+XJ9+/BUHEzguPCbsFw1uYf8s7K87/knZZULdHpx/rCwdNYamjQTSayI 2u3+uOmi59PPBB8kIsLqNO9o3eaZI9ElrjgJmdHqmqJ2mjlPIKRFltCzpZ5Rt5+vQEIh NNZMRhApMZlReNJT02yBMuu9Wc6CqyAC3wsOVVisOQPUNVhA4gAKUgR3xKApt+Wu0BWq WsiA== 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 z17si21505611edm.510.2021.09.27.21.14.53; Mon, 27 Sep 2021 21:15:17 -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 S231937AbhI1EPO (ORCPT + 99 others); Tue, 28 Sep 2021 00:15:14 -0400 Received: from mga03.intel.com ([134.134.136.65]:12962 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbhI1EPN (ORCPT ); Tue, 28 Sep 2021 00:15:13 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="224682043" X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="224682043" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2021 21:13:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="476150855" Received: from linux.intel.com ([10.54.29.200]) by orsmga007.jf.intel.com with ESMTP; 27 Sep 2021 21:13:33 -0700 Received: from glass.png.intel.com (glass.png.intel.com [10.158.65.69]) by linux.intel.com (Postfix) with ESMTP id AD2B558073D; Mon, 27 Sep 2021 21:13:31 -0700 (PDT) From: Wong Vee Khee To: Andrew Lunn , Jose Abreu , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Oltean , Wong Vee Khee Subject: [PATCH net-next 1/2] net: pcs: xpcs: introduce xpcs_modify() helper function Date: Tue, 28 Sep 2021 12:19:36 +0800 Message-Id: <20210928041938.3936497-1-vee.khee.wong@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some cases we need to call mdiobus_modify() to avoid calling mdiobus_write() when it is not required. Introduce a xpcs_modify() helper function that allow us to call mdiobus_modify() in the pcs-xpcs module. Signed-off-by: Wong Vee Khee --- drivers/net/pcs/pcs-xpcs.c | 9 +++++++++ drivers/net/pcs/pcs-xpcs.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index fb0a83dc09ac..da8c81d25edd 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -191,6 +191,15 @@ int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val) return mdiobus_write(bus, addr, reg_addr, val); } +int xpcs_modify(struct dw_xpcs *xpcs, int dev, u32 reg, u16 mask, u16 set) +{ + u32 reg_addr = mdiobus_c45_addr(dev, reg); + struct mii_bus *bus = xpcs->mdiodev->bus; + int addr = xpcs->mdiodev->addr; + + return mdiobus_modify(bus, addr, reg_addr, mask, set); +} + static int xpcs_read_vendor(struct dw_xpcs *xpcs, int dev, u32 reg) { return xpcs_read(xpcs, dev, DW_VENDOR | reg); diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h index 35651d32a224..fdb870333395 100644 --- a/drivers/net/pcs/pcs-xpcs.h +++ b/drivers/net/pcs/pcs-xpcs.h @@ -109,6 +109,7 @@ int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg); int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val); +int xpcs_modify(struct dw_xpcs *xpcs, int dev, u32 reg, u16 mask, u16 set); int nxp_sja1105_sgmii_pma_config(struct dw_xpcs *xpcs); int nxp_sja1110_sgmii_pma_config(struct dw_xpcs *xpcs); -- 2.25.1