From patchwork Mon Jul 12 06:12:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472990 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2684606jao; Mon, 12 Jul 2021 00:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynEaWW117LQCo+s3SMre004EofTdpb4JHy8aAYXblmfpqRF0Zw1jmJ69UsrIgDOYH5sgMf X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr48492729ejc.447.1626074764718; Mon, 12 Jul 2021 00:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074764; cv=none; d=google.com; s=arc-20160816; b=uECFr1rEN4kFYMXSqaRn3QjbiuKTXv2SxcZzR52zu9SzBJjtvQtnd8h73JsRTUxZ0i JP8lOpYcUS+c77n72IOQJh5v5FftQbxLPA0gBGA+mSyhSFKj/MJHUxdObvaX+VsUJSrk NEp6KxiVQ3rnxrLniv7InlmJQpspx0Oe/SIEPNR4TEzvIMkALF8a3ioytGxaiUdpj2/X TxXeUokgXfHNnkRmbNJxJH28sPYS/ghdtFMhubhSKDPqv4HSLxSVLMbWRovPe1WUEm9f ahmJEG1siXvhhGUzy45oqtR1j27d5cfPkHHQCU5nfdJI9f3sZMaFM7HArKfLmfx6+vEz r+EQ== 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=VwBReSlgDnbVS/MSJgy/xeHDWzSlWhy1d0RqjXTRJak=; b=lrywzS8xg5gFsaQkYjbJbXsC75eLMSgRHJqQK3xVIb9ZW3OP38/6oC+tEh8RnWy1ac yQg1tgBtKdQUyeLGMz2ij2yZEhiHCewWmCerm1lXykWo2YDSBRvAxMi9cp8h5oN3ojWw jEgLGZPMETVmafMwEYbUTWCMuxPbydRkewiIE8IkJqcpf5BM7D5iS75X3z+z4fgSDOUg ZQvL3d4JyVCJ+Q8Js/OuwAraD2A7LvcVA2b5Rci5FuQWXnWrk6fk10Zf7BzneJbsYxSD AcYHsIWcJ2ENARPdbJkSKzTd9pMn2PLL5jETXXLejWMBYd0Bn1dRXusb/mdj6LdONpS8 l/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y8hutWGk; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 e9si16596658edv.146.2021.07.12.00.26.04; Mon, 12 Jul 2021 00:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=y8hutWGk; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1343707AbhGLH2r (ORCPT + 12 others); Mon, 12 Jul 2021 03:28:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:33068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245505AbhGLH1J (ORCPT ); Mon, 12 Jul 2021 03:27:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAA066146B; Mon, 12 Jul 2021 07:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074606; bh=KlMGQ3e8uTVoH70/r1i913wVeQy3pNxxandWLFVh+yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y8hutWGkiKnLwrssomic2vOjS7xT0C66/3dM6yMRnZks+/cZtramKxevhaUOdCrXl +iSEHIrMSvCmTcq8gS+mxeztItMdxEruYzwpfrYIo/abGOGnoXJ8I6HIq3a4L9YLW9 71R2kO3zMwibURG5TqloT0gV7oB2+mozCsO6JgnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunihiko Hayashi , Vinod Koul , Sasha Levin Subject: [PATCH 5.12 637/700] phy: uniphier-pcie: Fix updating phy parameters Date: Mon, 12 Jul 2021 08:12:00 +0200 Message-Id: <20210712061043.614925570@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kunihiko Hayashi [ Upstream commit 4a90bbb478dbf18ecdec9dcf8eb708e319d24264 ] The current driver uses a value from register TEST_O as the original value for register TEST_I, though, the value is overwritten by "param", so there is a bug that the original value isn't no longer used. The value of TEST_O[7:0] should be masked with "mask", replaced with "param", and placed in the bitfield TESTI_DAT_MASK as new TEST_I value. Fixes: c6d9b1324159 ("phy: socionext: add PCIe PHY driver support") Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1623037842-19363-1-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/socionext/phy-uniphier-pcie.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.30.2 diff --git a/drivers/phy/socionext/phy-uniphier-pcie.c b/drivers/phy/socionext/phy-uniphier-pcie.c index e4adab375c73..6bdbd1f214dd 100644 --- a/drivers/phy/socionext/phy-uniphier-pcie.c +++ b/drivers/phy/socionext/phy-uniphier-pcie.c @@ -24,11 +24,13 @@ #define PORT_SEL_1 FIELD_PREP(PORT_SEL_MASK, 1) #define PCL_PHY_TEST_I 0x2000 -#define PCL_PHY_TEST_O 0x2004 #define TESTI_DAT_MASK GENMASK(13, 6) #define TESTI_ADR_MASK GENMASK(5, 1) #define TESTI_WR_EN BIT(0) +#define PCL_PHY_TEST_O 0x2004 +#define TESTO_DAT_MASK GENMASK(7, 0) + #define PCL_PHY_RESET 0x200c #define PCL_PHY_RESET_N_MNMODE BIT(8) /* =1:manual */ #define PCL_PHY_RESET_N BIT(0) /* =1:deasssert */ @@ -77,11 +79,12 @@ static void uniphier_pciephy_set_param(struct uniphier_pciephy_priv *priv, val = FIELD_PREP(TESTI_DAT_MASK, 1); val |= FIELD_PREP(TESTI_ADR_MASK, reg); uniphier_pciephy_testio_write(priv, val); - val = readl(priv->base + PCL_PHY_TEST_O); + val = readl(priv->base + PCL_PHY_TEST_O) & TESTO_DAT_MASK; /* update value */ - val &= ~FIELD_PREP(TESTI_DAT_MASK, mask); - val = FIELD_PREP(TESTI_DAT_MASK, mask & param); + val &= ~mask; + val |= mask & param; + val = FIELD_PREP(TESTI_DAT_MASK, val); val |= FIELD_PREP(TESTI_ADR_MASK, reg); uniphier_pciephy_testio_write(priv, val); uniphier_pciephy_testio_write(priv, val | TESTI_WR_EN);