From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 620AFA0350; Mon, 22 Jun 2020 09:08:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 53E481C43E; Mon, 22 Jun 2020 09:05:45 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6305E1C2FA for ; Mon, 22 Jun 2020 09:05:41 +0200 (CEST) IronPort-SDR: SrijmS3F05+rlcAh3tgXBtrsLkiXdxzVkIKx9TYm06Mo1C5DlxNjHktHIca1PyJiD3F5RwW8Ea sM1Q+7OX4prQ== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="141944747" X-IronPort-AV: E=Sophos;i="5.75,266,1589266800"; d="scan'208";a="141944747" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 00:05:41 -0700 IronPort-SDR: ZWAJaJbd8a3F3QoyRYeOkd3ZmGWvNPV//VO/AlbF955LAQJ923mfmiUVQrT9o/PLD7DYG1RSj5 swJXNXOAzcLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,266,1589266800"; d="scan'208";a="384408844" Received: from dpdk.sh.intel.com ([10.239.255.83]) by fmsmga001.fm.intel.com with ESMTP; 22 Jun 2020 00:05:38 -0700 From: Guinan Sun To: dev@dpdk.org Cc: Jeff Guo , Zhao1 Wei , Guinan Sun , Dany Trakhtenberg Date: Mon, 22 Jun 2020 06:45:39 +0000 Message-Id: <20200622064634.70941-16-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200622064634.70941-1-guinanx.sun@intel.com> References: <20200622064634.70941-1-guinanx.sun@intel.com> Subject: [dpdk-dev] [PATCH 15/70] net/e1000/base: setup copper link function for i225 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A dedicated function for i225 that Configures the link for auto-neg or forced speed and duplex. It was taken from the e1000_setup_copper_link_82575 function in e1000_82575 file and was refactored for i225 only. Signed-off-by: Dany Trakhtenberg Signed-off-by: Guinan Sun --- drivers/net/e1000/base/e1000_i225.c | 30 +++++++++++++++++++++++++++++ drivers/net/e1000/base/e1000_phy.h | 13 +++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/e1000/base/e1000_i225.c b/drivers/net/e1000/base/e1000_i225.c index 4ba6c45be..621dc6863 100644 --- a/drivers/net/e1000/base/e1000_i225.c +++ b/drivers/net/e1000/base/e1000_i225.c @@ -124,6 +124,36 @@ void e1000_release_swfw_sync_i225(struct e1000_hw *hw, u16 mask) e1000_put_hw_semaphore_generic(hw); } +/* + * e1000_setup_copper_link_i225 - Configure copper link settings + * @hw: pointer to the HW structure + * + * Configures the link for auto-neg or forced speed and duplex. Then we check + * for link, once link is established calls to configure collision distance + * and flow control are called. + */ +s32 e1000_setup_copper_link_i225(struct e1000_hw *hw) +{ + u32 phpm_reg; + s32 ret_val; + u32 ctrl; + + DEBUGFUNC("e1000_setup_copper_link_i225"); + + ctrl = E1000_READ_REG(hw, E1000_CTRL); + ctrl |= E1000_CTRL_SLU; + ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + + phpm_reg = E1000_READ_REG(hw, E1000_I225_PHPM); + phpm_reg &= ~E1000_I225_PHPM_GO_LINKD; + E1000_WRITE_REG(hw, E1000_I225_PHPM, phpm_reg); + + ret_val = e1000_setup_copper_link_generic(hw); + + return ret_val; +} + /* e1000_get_hw_semaphore_i225 - Acquire hardware semaphore * @hw: pointer to the HW structure * diff --git a/drivers/net/e1000/base/e1000_phy.h b/drivers/net/e1000/base/e1000_phy.h index 32e9d2620..3321bc0ba 100644 --- a/drivers/net/e1000/base/e1000_phy.h +++ b/drivers/net/e1000/base/e1000_phy.h @@ -122,6 +122,19 @@ s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, #define GS40G_MAC_SPEED_1G 0X0006 #define GS40G_COPPER_SPEC 0x0010 +#endif /* NO_I210_SUPPORT */ +#ifndef NO_I225_SUPPORT +#define E1000_I225_PHPM 0x0E14 /* I225 PHY Power Management */ +#define E1000_I225_PHPM_DIS_1000_D3 0x0008 /* Disable 1G in D3 */ +#define E1000_I225_PHPM_LINK_ENERGY 0x0010 /* Link Energy Detect */ +#define E1000_I225_PHPM_GO_LINKD 0x0020 /* Go Link Disconnect */ +#define E1000_I225_PHPM_DIS_1000 0x0040 /* Disable 1G globally */ +#define E1000_I225_PHPM_SPD_B2B_EN 0x0080 /* Smart Power Down Back2Back */ +#define E1000_I225_PHPM_RST_COMPL 0x0100 /* PHY Reset Completed */ +#define E1000_I225_PHPM_DIS_100_D3 0x0200 /* Disable 100M in D3 */ +#define E1000_I225_PHPM_ULP 0x0400 /* Ultra Low-Power Mode */ +#define E1000_I225_PHPM_DIS_2500 0x0800 /* Disable 2.5G globally */ +#define E1000_I225_PHPM_DIS_2500_D3 0x1000 /* Disable 2.5G in D3 */ /* GPY211 - I225 defines */ #define GPY_MMD_MASK 0xFFFF0000 #define GPY_MMD_SHIFT 16 -- 2.17.1