Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3669844pxb; Mon, 24 Jan 2022 14:58:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwm/X4JZNYzOzm3+Td5bRotb7litBMBmuQZtMGjP3/8W2BW9ED0xEO+o1OAsUvqhIR+JyK0 X-Received: by 2002:a63:7d43:: with SMTP id m3mr13095175pgn.301.1643065091709; Mon, 24 Jan 2022 14:58:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065091; cv=none; d=google.com; s=arc-20160816; b=R/cBQ5829mdtOpBlk3M81x0dcYiNueBMBpcnjCQEgHYdnbOKlrUMMQUY7X67Ig375y liH0iqTdmKZjzJp0TI+CwIjH9UvsbLyEQGnHtUhwQvA8R/J8Peoy9gQtfPdFeOEiT/F8 UXpvc3vY5AmEeq/7Lec/1RltC6TeESYBJeGv7/rJeHeqoiAiXPxOFmfp4v9LnYjdcGjd frbUhjjPeS7Z+jV8i7c/LaRFqJTxT+DSV0L31EgtaBQbeYc5xPLUm3pt8pFDbRqjPY9d TcQw1jhdPKgdHDehsOVGGqR2+YtbWVMky9gyJpL67h5X/o+Fj7ZVA9upJh0Lr7Ctq1Mr UqsQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G6+wPn3UiwjVfsNRQV3Pz134i9/YyD/2YamzxLY1FbI=; b=yBU2ZPSEryOPxpD8ClC1N4lWovYS5BJhm84esyAJl5fZlmaWl+dFy/tWvD5f2HURYT XHZzFI3yOMg92EZLGj9Rfh/6iGT1jZYoLEi5XOPUQFRs+7TMcHSM3MRHM4Xr90DVf893 lzuojQoPYkWgWw6uG+BChuD14HVOIca4EEU41yWRIomvysvVHfQH99yzLEvcxdvdFLgi mCxOvybcPdTNKiJlikfbnmCZrsk8S3bort4BOZIcU8oV8P98Ns2jxKSjdAZFXNitV/Qy 5487s9Mok1CisiS95B91GCwqrawBCr7KLkNyFpbN2viT5OjqxzpH3pMQ0+0cqjwJS55l gcfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mu9ANdvX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w76si11931309pff.130.2022.01.24.14.57.59; Mon, 24 Jan 2022 14:58:11 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mu9ANdvX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839521AbiAXWvM (ORCPT + 99 others); Mon, 24 Jan 2022 17:51:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458155AbiAXVms (ORCPT ); Mon, 24 Jan 2022 16:42:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0254EC07A95C; Mon, 24 Jan 2022 12:31:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 956ED61505; Mon, 24 Jan 2022 20:31:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF02C340E5; Mon, 24 Jan 2022 20:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056280; bh=eBtV3ryZiXUZattGsksT7BmwOVTZlzKcXHsLCTSvJcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mu9ANdvXh7NsOvVONejRR6ig2OfyrIg+yfVQB8E1OnX0XZgfUK91xFewbbKCbiqqL NNN0PUKrEuiWLK5M2667pI4guEse51IUOSUDsYZFCXJs9+50LU29WtgwqyKeql2gES LkcmVrMfvRglI1ST/DLlcExGvokRP14LpjXBMNnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 430/846] phy: uniphier-usb3ss: fix unintended writing zeros to PHY register Date: Mon, 24 Jan 2022 19:39:07 +0100 Message-Id: <20220124184115.814621705@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ryuta NAKANISHI [ Upstream commit 898c7a9ec81620125f2463714a0f4dea18ad6e54 ] Similar to commit 4a90bbb478db ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers. Fixes: 5ab43d0f8697 ("phy: socionext: add USB3 PHY driver for UniPhier SoC") Signed-off-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1640150369-4134-1-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/socionext/phy-uniphier-usb3ss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c index 6700645bcbe6b..3b5ffc16a6947 100644 --- a/drivers/phy/socionext/phy-uniphier-usb3ss.c +++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c @@ -22,11 +22,13 @@ #include #define SSPHY_TESTI 0x0 -#define SSPHY_TESTO 0x4 #define TESTI_DAT_MASK GENMASK(13, 6) #define TESTI_ADR_MASK GENMASK(5, 1) #define TESTI_WR_EN BIT(0) +#define SSPHY_TESTO 0x4 +#define TESTO_DAT_MASK GENMASK(7, 0) + #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ @@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv, val = FIELD_PREP(TESTI_DAT_MASK, 1); val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); - val = readl(priv->base + SSPHY_TESTO); + val = readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; /* update value */ - val &= ~FIELD_PREP(TESTI_DAT_MASK, field_mask); + val &= ~field_mask; data = field_mask & (p->value << p->field.lsb); - val = FIELD_PREP(TESTI_DAT_MASK, data); + val = FIELD_PREP(TESTI_DAT_MASK, data | val); val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); -- 2.34.1