From patchwork Mon Jul 12 06:11:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472858 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647919jao; Sun, 11 Jul 2021 23:29:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3N7ec6lipNNev8ukaouFPciX+7Can8F3WlMXVQ7vQSSWK6TsKv/IaBg6EwCHjNPNju+lK X-Received: by 2002:a17:906:51d4:: with SMTP id v20mr30930035ejk.107.1626071397430; Sun, 11 Jul 2021 23:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071397; cv=none; d=google.com; s=arc-20160816; b=zmo+tqAZBLltppEOYd9/i4BlSLjDUS0GBPL1/490eJxcVcU7JVWZTnfHc+jo36WqsL v7eTDaNzYyNA0VgPrXwMlx6niYOrCWDfP5fzFCXLcZ2LznAmkwKjEc5OgpemsuuoSCct wU6JjQRotbVvdg/HUMNiKJRL5KKRaUVDYyon3pq8sRAxAUi8dn6r6KB6LgkXd2CCDJLQ hDe/YyZ256wcLy3uWm0NQbFImTkyiiHZRScYYtccV/lS1EZAPkpFhbZyxScfYdJWpUhi TSK2yjegR7LS8tMrqmwNF1n0j7YHA031SLFffeq3Os08Ax6k3pZ8HCawu7q8MgUusU73 XYPQ== 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=GLYEUCPjM85iWU36q3zC2hHQ2Xpghf/PhJEhbA2Wlr0=; b=Rv5jgWtSoVyEeWYs2kc4gI8ewGldWYSIvk/fc0SQw3/U9TEm6vqcRh+3ZHI4+vi2Ue YwhtILbjTgSUaFt+FU7S6WDSCT8IhVaXCNVdctlgLDsQO0tKThWTNQwMvxjRFd224Xcd SZzRlSv/n32wRLybwIuOqSeqMvQkv+5/tXemKQLJOs0yqKW7C5zeorTTYGOVTW6R5TxX vTJYaKEnScNrHlp0Ll93kd5lUyUxTQRQzPFUiQ0t3FdAKYx+Hver9GpAxo+EhUFlUiX0 IOzSq1Gyikbx/zWx42cUf6tmx2R/pV0g5gVE76aDEneVmR89ARG04nDl8XAOGUMU3Nqd KNLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaIBhInx; 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 bz6si16420285ejc.610.2021.07.11.23.29.57; Sun, 11 Jul 2021 23:29:57 -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=NaIBhInx; 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 S235448AbhGLGcf (ORCPT + 12 others); Mon, 12 Jul 2021 02:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:52386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236190AbhGLG3v (ORCPT ); Mon, 12 Jul 2021 02:29:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62C4C60238; Mon, 12 Jul 2021 06:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071223; bh=Kirr2XwDqQz73EXYCxaEJgvQxfZ8RscfOnn0xySKMSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaIBhInxuJXSwrdu9UA7wbrMpYpui8TG9mR/oDQcwPL/3CF38ZSXMLiMOtBrst2Z/ vJh/x5+oHOijIDPh5i8Z1n0x2K81KTevmL67bRyhUIPtuPvQvgqhf6xKswCEwvVpNq oy7bekuKFxGy7lmSmGkgy3jOX4wkKDkb/f5SeBwE= 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.4 327/348] phy: uniphier-pcie: Fix updating phy parameters Date: Mon, 12 Jul 2021 08:11:51 +0200 Message-Id: <20210712060747.532234715@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@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 93ffbd2940fa..0bad0e01279a 100644 --- a/drivers/phy/socionext/phy-uniphier-pcie.c +++ b/drivers/phy/socionext/phy-uniphier-pcie.c @@ -20,11 +20,13 @@ /* PHY */ #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 */ @@ -72,11 +74,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);