From patchwork Thu Aug 22 11:47:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Sae X-Patchwork-Id: 13773258 X-Patchwork-Delegate: kuba@kernel.org Received: from out28-101.mail.aliyun.com (out28-101.mail.aliyun.com [115.124.28.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AFC817B4E2; Thu, 22 Aug 2024 11:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724327255; cv=none; b=GLqsSbJlZ6bROpPkonCa87Ls+LCCOM9fQemxZGRzo5lId2TjjxAI+/aT8kt0Xa1epfW0eFOzeA5jHbclNhvS95gpPvQq92gFBxzo8vgKMRWLKX26CvBFxpeZhNCrGauL4AsUXdZp0+wWmBzHngNkFMLXAQH7zgMfiKyCBnRIUR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724327255; c=relaxed/simple; bh=d+TqVCIhda5XihCS75OMSE+WdIxrYA1zfGIrkCCMLOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DPn7jiH0KZiZR0LS8RkuEsaVPdpB5zx9rXkYEVTssHXN+EZlSm4MjKz2HQ59ZzWOGyzsZmjzTKNKWpueIwnd8dWABLmc/vy1mBsHuPuM15cX8uGJgI2A4sgjJeV/wNPmTrlfobif5JJZ7uF9sim/gz3ovhJj0JHZpLpj66KPwMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=motor-comm.com; spf=pass smtp.mailfrom=motor-comm.com; arc=none smtp.client-ip=115.124.28.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=motor-comm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=motor-comm.com Received: from ubuntu.localdomain(mailfrom:Frank.Sae@motor-comm.com fp:SMTPD_---.Z-MS8va_1724327239) by smtp.aliyun-inc.com; Thu, 22 Aug 2024 19:47:22 +0800 From: Frank Sae To: Frank.Sae@motor-comm.com, andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yuanlai.cui@motor-comm.com, hua.sun@motor-comm.com, xiaoyong.li@motor-comm.com, suting.hu@motor-comm.com, jie.han@motor-comm.com Subject: [PATCH net-next v3 1/2] net: phy: Optimize phy speed mask to be compatible to yt8821 Date: Thu, 22 Aug 2024 04:47:00 -0700 Message-Id: <20240822114701.61967-2-Frank.Sae@motor-comm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822114701.61967-1-Frank.Sae@motor-comm.com> References: <20240822114701.61967-1-Frank.Sae@motor-comm.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org yt8521 and yt8531s as Gigabit transceiver use bit15:14(bit9 reserved default 0) as phy speed mask, yt8821 as 2.5G transceiver uses bit9 bit15:14 as phy speed mask. Be compatible to yt8821, reform phy speed mask and phy speed macro. Signed-off-by: Frank Sae Reviewed-by: Andrew Lunn Signed-off-by:? Reviewed-by: Andrew Lunn Signed-off-by: Frank Sae --- drivers/net/phy/motorcomm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 7a11fdb687cc..fe0aabe12622 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -46,12 +46,10 @@ /* Specific Status Register */ #define YTPHY_SPECIFIC_STATUS_REG 0x11 -#define YTPHY_SSR_SPEED_MODE_OFFSET 14 - -#define YTPHY_SSR_SPEED_MODE_MASK (BIT(15) | BIT(14)) -#define YTPHY_SSR_SPEED_10M 0x0 -#define YTPHY_SSR_SPEED_100M 0x1 -#define YTPHY_SSR_SPEED_1000M 0x2 +#define YTPHY_SSR_SPEED_MASK ((0x3 << 14) | BIT(9)) +#define YTPHY_SSR_SPEED_10M ((0x0 << 14)) +#define YTPHY_SSR_SPEED_100M ((0x1 << 14)) +#define YTPHY_SSR_SPEED_1000M ((0x2 << 14)) #define YTPHY_SSR_DUPLEX_OFFSET 13 #define YTPHY_SSR_DUPLEX BIT(13) #define YTPHY_SSR_PAGE_RECEIVED BIT(12) @@ -1187,8 +1185,7 @@ static int yt8521_adjust_status(struct phy_device *phydev, int status, else duplex = DUPLEX_FULL; /* for fiber, it always DUPLEX_FULL */ - speed_mode = (status & YTPHY_SSR_SPEED_MODE_MASK) >> - YTPHY_SSR_SPEED_MODE_OFFSET; + speed_mode = status & YTPHY_SSR_SPEED_MASK; switch (speed_mode) { case YTPHY_SSR_SPEED_10M: