Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3702602pxb; Mon, 24 Jan 2022 15:48:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJznFhW2IX1r93NOLNBQ4NpMZRk8cE8pIam5BnJ6/Sa1f4xqfH5FxuZI5RbQGpEgGRqQWjMm X-Received: by 2002:a17:902:9894:b0:149:9b36:7c9c with SMTP id s20-20020a170902989400b001499b367c9cmr16648779plp.61.1643068131032; Mon, 24 Jan 2022 15:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068131; cv=none; d=google.com; s=arc-20160816; b=rkni8D5tVe3NN6ZYjNA3qMkDucix++0FKG1m7iN7hqGK0PJCW7UtgCFgkvKsUCgnbn aSUs9BQRmrNqJwNOvtQi1Y7njsSA2M1bjKHWsLXKUrIie2pUlCiGqOiG2h7Zm2kFBGw+ rZXmsXZbcRv7LF43u4t5i1tUmYM6LUYQRwDHoZvo6wJdZATjbtPK2AwRQVruEPs2QVXR VEsrNBoj3u60LddPrddC53LDNjdfzVG437zqC/OzFNDTt7ls1CYOrjuxqKlsKtITcoZq 5SlQ2fxp5qswfJ3R9jzux70X/vNOHltCJyobfbVrCFuWehz4PbIoymJSZdQwC5laE/Dd EAag== 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=ROu5F6VGcdpRk8t+gAIM4LTZGyLTTYMqFhwp7XBIZvbFjvsc92R1fnALI7xYlIL11F 4ythK9/8v0Y/S+v1KIbqzk1sLUPsGOpsGnYcJobTaIz9eqUG//tldEu0wZhcdRyweyk0 jE8NYWY/XIexhACNb5FOpSbqDDj5q7EFMWJg5V+DN9ohWMfxV/6pBW2VUsYK257f/34m 1Tl5fn/5gpxvLhF8zev5yAfvdop3okZxYNRdtvbbqTLic2SEp5IZ1vLKDW4GsgMrGguY EuxkdUBdqX0YnxiPEzEIeAnNZ8v31A7M8mzxbGQBEF5+uRiqRKF9VsmMw0254M3H8JRm TD0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EDeYySaX; 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 v15si15732982pgq.418.2022.01.24.15.48.39; Mon, 24 Jan 2022 15:48:51 -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=EDeYySaX; 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 S2362739AbiAXXmt (ORCPT + 99 others); Mon, 24 Jan 2022 18:42:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844746AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137DCC0A0289; Mon, 24 Jan 2022 13:18:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id CF31CB8105C; Mon, 24 Jan 2022 21:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11577C340E4; Mon, 24 Jan 2022 21:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059106; bh=eBtV3ryZiXUZattGsksT7BmwOVTZlzKcXHsLCTSvJcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDeYySaXQv6nMdJkeBNJpFn3Uhc+znhd+GBL9D5cRkZ0EwYvyOvyT93KEyfL0nnTi IW27OQTkTuDaN8elrJSrWPXdDTbluylV58Bf1OCW5CQtXES+FIcNS7pg1aqoDKe5TK AG68GRV+Thi1DP5x6HWJ8JX68L9rrJxpGoLQ+uc0= 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.16 0505/1039] phy: uniphier-usb3ss: fix unintended writing zeros to PHY register Date: Mon, 24 Jan 2022 19:38:14 +0100 Message-Id: <20220124184142.248564599@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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