From patchwork Wed Jul 6 02:02:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12907234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F0B2C43334 for ; Wed, 6 Jul 2022 02:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wbvCRTHZ39L4+LlFrEKxoFaLqFDfGpITN1o9VfVkGAI=; b=U+GevMFdY6WsCY lyiWhhWOFJUXBC+StbG/4tewRmg1mt01+UzVsBXa7ZZWf3Cs6t7vkWf0+PEYKtFSR10lP0PIsasDP NBkowpOZQ1oHbHS+YhxU+cp7XJ0klFIthMnYzmGW0yK4k8AsZWMgMkM/0NaSbyDzHpTSMsnicfIbq 4uqA8wPbQL0QKls0MaCZHlSGqGtoEntV/Oj+nuPD1Z8d0x5EHw9R4REjSsEmqalpMwJDd5Gx5Ch8/ WGN6skNRRLCCqBrdTZ1b/dQ+i/XrTvmfdg/L4IQei+BdTbUmV1MvXQI9IebLIqS05TnfLe44EcbyB QbHMgZ7LfFQJnzC+qWQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQj-005J0F-9I; Wed, 06 Jul 2022 02:06:17 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQH-005Iqc-7a for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 02:05:52 +0000 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220706020542epoutp01756fa1173b76031577ea170809d091c0~-Gz5E-_ib2247622476epoutp01V for ; Wed, 6 Jul 2022 02:05:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220706020542epoutp01756fa1173b76031577ea170809d091c0~-Gz5E-_ib2247622476epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657073142; bh=q20ZZ9pb7pfwaxV6xHa3nvjdiyNTQxWPgMn8xQLBB/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=obV6EVjMHJGrDhJwJ9EQVyd14Fz2jKb5w2WXO2PvCSHir+9UJT6F//qm1Yqozn7s7 UgZDYw55WzTkAvJZkvP7K2/PRUbeo1U9wGj1Vh9V9lLshIKiyMFv73E/3zcSG0dmGt in9J7QUu+2S36nyz685kwqSHZr7xZtK1QecS05iQ= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220706020541epcas2p3c0274b610c61348c736819e3a3cfcb3a~-Gz4y1Vg02761727617epcas2p3N; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.102]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Ld2v93d0zz4x9QC; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 64.C8.09642.5FDE4C26; Wed, 6 Jul 2022 11:05:41 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220706020540epcas2p15efea24c0f670514785b991e3c1118e8~-Gz38AcBb0308403084epcas2p15; Wed, 6 Jul 2022 02:05:40 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220706020540epsmtrp29cbd243140a292f9808197fd65722c6b~-Gz37N2mg3159231592epsmtrp27; Wed, 6 Jul 2022 02:05:40 +0000 (GMT) X-AuditID: b6c32a47-5f7ff700000025aa-b6-62c4edf516fc Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EA.6E.08905.4FDE4C26; Wed, 6 Jul 2022 11:05:40 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220706020540epsmtip236434bcc806cd2fa78c2d3e7034fa3e2~-Gz3skejZ1055210552epsmtip2E; Wed, 6 Jul 2022 02:05:40 +0000 (GMT) From: Chanho Park To: Kishon Vijay Abraham I , Vinod Koul , Krzysztof Kozlowski , "James E . J . Bottomley" , "Martin K . Petersen" , Alim Akhtar , Bart Van Assche Cc: linux-phy@lists.infradead.org, linux-scsi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Chanho Park Subject: [PATCH v2 2/3] phy: samsung-ufs: ufs: change phy on/off control Date: Wed, 6 Jul 2022 11:02:54 +0900 Message-Id: <20220706020255.151177-3-chanho61.park@samsung.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220706020255.151177-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOJsWRmVeSWpSXmKPExsWy7bCmhe7Xt0eSDObOlrJ4MG8bm8W0Dz+Z LS7v17ZYdGMbk8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syOxFVqd6cHcxsXfu26WLJwx+efi97vLX8aJvnrUvDe jz6PecJXFP8K+nb5lmx1jYNJB1dcpaPau6le9kosxRmJhlrMRcWJABWowkcGAwAA X-CMS-MailID: 20220706020540epcas2p15efea24c0f670514785b991e3c1118e8 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220706020540epcas2p15efea24c0f670514785b991e3c1118e8 References: <20220706020255.151177-1-chanho61.park@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220705_190549_632476_EC1FE28B X-CRM114-Status: GOOD ( 19.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The sequence of controlling ufs phy block should be below: 1) Power On - Turn off pmu isolation - Clock enable 2) Power Off - Clock disable - Turn on pmu isolation Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski --- drivers/phy/samsung/phy-samsung-ufs.c | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c index 14cce2f2487e..183c88e3d1ec 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.c +++ b/drivers/phy/samsung/phy-samsung-ufs.c @@ -151,37 +151,43 @@ static int samsung_ufs_phy_clks_init(struct samsung_ufs_phy *phy) static int samsung_ufs_phy_init(struct phy *phy) { struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); - int ret; ss_phy->lane_cnt = phy->attrs.bus_width; ss_phy->ufs_phy_state = CFG_PRE_INIT; + return 0; +} + +static int samsung_ufs_phy_power_on(struct phy *phy) +{ + struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); + int ret; + + samsung_ufs_phy_ctrl_isol(ss_phy, false); + ret = clk_bulk_prepare_enable(ss_phy->drvdata->num_clks, ss_phy->clks); if (ret) { dev_err(ss_phy->dev, "failed to enable ufs phy clocks\n"); return ret; } - ret = samsung_ufs_phy_calibrate(phy); - if (ret) - dev_err(ss_phy->dev, "ufs phy calibration failed\n"); + if (ss_phy->ufs_phy_state == CFG_PRE_INIT) { + ret = samsung_ufs_phy_calibrate(phy); + if (ret) + dev_err(ss_phy->dev, "ufs phy calibration failed\n"); + } return ret; } -static int samsung_ufs_phy_power_on(struct phy *phy) -{ - struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); - - samsung_ufs_phy_ctrl_isol(ss_phy, false); - return 0; -} - static int samsung_ufs_phy_power_off(struct phy *phy) { struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); + clk_bulk_disable_unprepare(ss_phy->drvdata->num_clks, ss_phy->clks); + samsung_ufs_phy_ctrl_isol(ss_phy, true); + return 0; } @@ -202,7 +208,7 @@ static int samsung_ufs_phy_exit(struct phy *phy) { struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); - clk_bulk_disable_unprepare(ss_phy->drvdata->num_clks, ss_phy->clks); + ss_phy->ufs_phy_state = CFG_TAG_MAX; return 0; }