Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408002rwa; Tue, 23 Aug 2022 04:23:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR5m00KD0LGX6PlXLw5bUpmYOwq1/nkiCWNuPlEoe8Pw43/HexitF/Y0Mq5fQ9OGguO14ZgG X-Received: by 2002:a17:90a:9401:b0:1fa:af9c:20db with SMTP id r1-20020a17090a940100b001faaf9c20dbmr2877517pjo.190.1661253827133; Tue, 23 Aug 2022 04:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253827; cv=none; d=google.com; s=arc-20160816; b=HWpSP4aeI/L3JbnWYFYKV9FTPbyzgzdQ6IC3FLABFH76u7nfR/E+WDY0QJFvaREW2G +M6LR1LVIl+HZGNrOTz+EksXv4Iem65tvM6rcKZAuXZcbb0RtNa4damqNaY7kY2IPfPi nbDF/9JLI4mDckOHbR9UP/sRNSWyH1vMIlw6WKAe0aaaNrqgf01wDJB8NKz2ZXFvt120 c8g5Nar9Mbz7+8Kl/FvB1B6r1KvuRHrrdBwD5Aembk+kNA06HM/NVw8LRmhvWep421Wz T7qZ7bP2/rs3U+A1U4O2sHT25g7XB6J5US3WswdVQG04ocxlzFSRRldMo9VC5giOnbF7 UHMg== 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=rTcyw4FZRRG2l9RCxdduIZvNO+iP0tEB+IrzppFWQy0=; b=jD7fDAvIuAGzR1ddXVgWb1l+5WYAvU9SYI4eZKNAD3JESf1wYsmOB3BULopLE/kFuk amGumZogKBi/mCAPnWwltp/teNMG6c06xgvz/EMYL1LDrFm3XRci6vYBoGZjY66V4n0u grZwep0T2Tp25ShIgvy1RNqkfF0c54qK3m58yFGNb1xyuvrJ7ve+8FYQh4j97ObLovEC roZ/RaQQT6Nf8GhHtRgluWd0loF2SrgzCqlTzgUnAEi1VWIJxMc61tPwGgeKZ+DjtHBL 9xRyIKSuCKXjePOscRlO0debaYPMIQEjKyOq3rEZRZ812Lx0+tLLzVqgAQSQRvfqIYOV 4lYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QW9zXnqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i189-20020a6387c6000000b00415d1eeabc6si14163976pge.344.2022.08.23.04.23.35; Tue, 23 Aug 2022 04:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QW9zXnqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236091AbiHWJSP (ORCPT + 99 others); Tue, 23 Aug 2022 05:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349447AbiHWJQC (ORCPT ); Tue, 23 Aug 2022 05:16:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A2617538E; Tue, 23 Aug 2022 01:32:23 -0700 (PDT) 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 B1B2E614C2; Tue, 23 Aug 2022 08:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97E44C433D6; Tue, 23 Aug 2022 08:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243542; bh=dA6ZEuwj7DPqjItnEoT4QchiUOKqV/ohRsxC0LHDOW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QW9zXnqgBK7T8Dyhvku0wDnc0sA85R29MiJl+hn4feKR/+PRezn6rWcvdZuWlDpQF sBy0SOJV3nFKDdQHYSjsdRv/QVD/f0YmwDYBMR8S8icKQCDBcgj3pjBgq2Q6+rOTQl ZTFbXG/rvel1ozQf+mOayGKD/XiU73KPhHbgdWp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Helgaas , Marek Szyprowski , Bjorn Helgaas , Chanho Park , Krzysztof Kozlowski , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 310/365] phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks Date: Tue, 23 Aug 2022 10:03:31 +0200 Message-Id: <20220823080131.142708441@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski [ Upstream commit f2812227bb07e2eaee74253f11cea1576945df31 ] The exynos-pcie driver called phy_power_on() before phy_init() for some historical reasons. However the generic PHY framework assumes that the proper sequence is to call phy_init() first, then phy_power_on(). The operations done by both functions should be considered as one action and as such they are called by the exynos-pcie driver (without doing anything between them). The initialization is just a sequence of register writes, which cannot be altered without breaking the hardware operation. To match the generic PHY framework requirement, simply move all register writes to the phy_init()/phy_exit() and drop power_on()/power_off() callbacks. This way the driver will also work with the old (incorrect) PHY initialization call sequence. Link: https://lore.kernel.org/r/20220628220409.26545-1-m.szyprowski@samsung.com Reported-by: Bjorn Helgaas Signed-off-by: Marek Szyprowski Signed-off-by: Bjorn Helgaas Reviewed-by: Chanho Park Acked-by: Krzysztof Kozlowski Acked-By: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/samsung/phy-exynos-pcie.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos-pcie.c b/drivers/phy/samsung/phy-exynos-pcie.c index 578cfe07d07a..53c9230c2907 100644 --- a/drivers/phy/samsung/phy-exynos-pcie.c +++ b/drivers/phy/samsung/phy-exynos-pcie.c @@ -51,6 +51,13 @@ static int exynos5433_pcie_phy_init(struct phy *phy) { struct exynos_pcie_phy *ep = phy_get_drvdata(phy); + regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, + BIT(0), 1); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, + PCIE_APP_REQ_EXIT_L1_MODE, 0); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, + PCIE_REFCLK_GATING_EN, 0); + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_COMMON_RESET, PCIE_PHY_RESET, 1); regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET, @@ -109,20 +116,7 @@ static int exynos5433_pcie_phy_init(struct phy *phy) return 0; } -static int exynos5433_pcie_phy_power_on(struct phy *phy) -{ - struct exynos_pcie_phy *ep = phy_get_drvdata(phy); - - regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, - BIT(0), 1); - regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, - PCIE_APP_REQ_EXIT_L1_MODE, 0); - regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, - PCIE_REFCLK_GATING_EN, 0); - return 0; -} - -static int exynos5433_pcie_phy_power_off(struct phy *phy) +static int exynos5433_pcie_phy_exit(struct phy *phy) { struct exynos_pcie_phy *ep = phy_get_drvdata(phy); @@ -135,8 +129,7 @@ static int exynos5433_pcie_phy_power_off(struct phy *phy) static const struct phy_ops exynos5433_phy_ops = { .init = exynos5433_pcie_phy_init, - .power_on = exynos5433_pcie_phy_power_on, - .power_off = exynos5433_pcie_phy_power_off, + .exit = exynos5433_pcie_phy_exit, .owner = THIS_MODULE, }; -- 2.35.1