From patchwork Wed Jul 6 02:02:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12907233 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 D40A0CCA47B for ; Wed, 6 Jul 2022 02:07:09 +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=Cn08KPsNUxeD233hyHWmUKl07fKnzuau7VUP8AR4deY=; b=YRqg9TRVc2/3kn 1CF4cTWh0ULOTxVCHJzIJQNx/OcJ/Ku6JoMGBPouTZpbms6oSLeeysmBUqgvZ10xghoV3zdFA2fXx KyfI1751dBmQK5PJ6OJGmjWLKVi1gFivj/ZnK/aPfOfbuMFVvp9ui/ZEzRD0ry7hsVtFqNQr1sW4U na/LaCJfHEu3xd3kJRYXQfuOQ41fDrm4VAsTXbTC/lf6BMgMP0IluolRU8pajwQK9xs3BLxb4Qpl2 +sEII7ZiXYFPv7vB5ULjYEykuFTbDK9OM8rgg/L6nMM6vuiMp/eM8fkmLcFyEbmnlVhAepv8F3mWI DG3EtHmS5i2XBo85sWkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQa-005IyN-H1; Wed, 06 Jul 2022 02:06:08 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQG-005IqM-LQ for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 02:05:52 +0000 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220706020542epoutp036eccc92399ad58695002928bd8f183f4~-Gz5GTJAW2652726527epoutp03G for ; Wed, 6 Jul 2022 02:05:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220706020542epoutp036eccc92399ad58695002928bd8f183f4~-Gz5GTJAW2652726527epoutp03G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657073142; bh=SgyZ8l5ilZvt4lKHDTMUJsYr0/9AZoIdsir7I5NlDow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e6orWYVbvPlGAI2XYCsprX/aV2E8qKtLBxr241+PhURI4a0eabngI3o1wO0frRhNI mjEgDaI5cTwajwDxGTztmSbkcIK77tIv+tC2fKwZmdddHeg6ff+dhr1xycrTzNrHnN kxeXYTQcdCybfxOVBUOWVs6mBOHthCfvTi2+/NOM= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220706020541epcas2p372b09352fac23d8623fe61dd10585068~-Gz4ud5wt0174501745epcas2p3F; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.89]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Ld2v92x6cz4x9Pr; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 18.B2.09666.5FDE4C26; Wed, 6 Jul 2022 11:05:41 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20220706020540epcas2p2895857d7b056a456b3cd02bd5dd967b5~-Gz33EdY_3183331833epcas2p2V; Wed, 6 Jul 2022 02:05:40 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220706020540epsmtrp13898be2eb7284c370e32ae8dfb58ac4a~-Gz32LJCu1465814658epsmtrp1d; Wed, 6 Jul 2022 02:05:40 +0000 (GMT) X-AuditID: b6c32a45-45bff700000025c2-07-62c4edf53959 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 08.5B.08802.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 20220706020540epsmtip2fe5a9356d2fbd7266d96292872d4bb25~-Gz3mQjFl1055610556epsmtip2C; 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 1/3] phy: samsung-ufs: convert phy clk usage to clk_bulk API Date: Wed, 6 Jul 2022 11:02:53 +0900 Message-Id: <20220706020255.151177-2-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+NgFtrKJsWRmVeSWpSXmKPExsWy7bCmme7Xt0eSDFZvELV4MG8bm8W0Dz+Z LS7v17ZYdGMbk8WFpz1sFnt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gpU1yBk+l3uS6 U4dOt1sE5m/4LpS0061hXatlfJHJ36Oiy2/bcu+YpsRSnJFoqMVcVJwIAAB0qDoFAwAA X-CMS-MailID: 20220706020540epcas2p2895857d7b056a456b3cd02bd5dd967b5 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220706020540epcas2p2895857d7b056a456b3cd02bd5dd967b5 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_158212_C7558073 X-CRM114-Status: GOOD ( 25.81 ) 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 Instead of using separated clock manipulation, this converts the phy clock usage to be clk_bulk APIs. By using this, we can completely remove has_symbol_clk check and symbol clk variables. Furthermore, clk_get should be moved to probe because there is no need to get them in the phy_init callback. Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski --- drivers/phy/samsung/phy-exynos7-ufs.c | 7 +- drivers/phy/samsung/phy-exynosautov9-ufs.c | 7 +- drivers/phy/samsung/phy-fsd-ufs.c | 7 +- drivers/phy/samsung/phy-samsung-ufs.c | 99 +++++----------------- drivers/phy/samsung/phy-samsung-ufs.h | 10 +-- 5 files changed, 42 insertions(+), 88 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos7-ufs.c b/drivers/phy/samsung/phy-exynos7-ufs.c index 72854336f59d..a982e7c128c5 100644 --- a/drivers/phy/samsung/phy-exynos7-ufs.c +++ b/drivers/phy/samsung/phy-exynos7-ufs.c @@ -68,6 +68,10 @@ static const struct samsung_ufs_phy_cfg *exynos7_ufs_phy_cfgs[CFG_TAG_MAX] = { [CFG_POST_PWR_HS] = exynos7_post_pwr_hs_cfg, }; +static const char * const exynos7_ufs_phy_clks[] = { + "tx0_symbol_clk", "rx0_symbol_clk", "rx1_symbol_clk", "ref_clk", +}; + const struct samsung_ufs_phy_drvdata exynos7_ufs_phy = { .cfgs = exynos7_ufs_phy_cfgs, .isol = { @@ -75,6 +79,7 @@ const struct samsung_ufs_phy_drvdata exynos7_ufs_phy = { .mask = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_MASK, .en = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_EN, }, - .has_symbol_clk = 1, + .clk_list = exynos7_ufs_phy_clks, + .num_clks = ARRAY_SIZE(exynos7_ufs_phy_clks), .cdr_lock_status_offset = EXYNOS7_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS, }; diff --git a/drivers/phy/samsung/phy-exynosautov9-ufs.c b/drivers/phy/samsung/phy-exynosautov9-ufs.c index 2b256070d657..49e2bcbef0b4 100644 --- a/drivers/phy/samsung/phy-exynosautov9-ufs.c +++ b/drivers/phy/samsung/phy-exynosautov9-ufs.c @@ -57,6 +57,10 @@ static const struct samsung_ufs_phy_cfg *exynosautov9_ufs_phy_cfgs[CFG_TAG_MAX] [CFG_PRE_PWR_HS] = exynosautov9_pre_pwr_hs_cfg, }; +static const char * const exynosautov9_ufs_phy_clks[] = { + "ref_clk", +}; + const struct samsung_ufs_phy_drvdata exynosautov9_ufs_phy = { .cfgs = exynosautov9_ufs_phy_cfgs, .isol = { @@ -64,6 +68,7 @@ const struct samsung_ufs_phy_drvdata exynosautov9_ufs_phy = { .mask = EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL_MASK, .en = EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL_EN, }, - .has_symbol_clk = 0, + .clk_list = exynosautov9_ufs_phy_clks, + .num_clks = ARRAY_SIZE(exynosautov9_ufs_phy_clks), .cdr_lock_status_offset = EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS, }; diff --git a/drivers/phy/samsung/phy-fsd-ufs.c b/drivers/phy/samsung/phy-fsd-ufs.c index c78b6c16027d..d36cabd53434 100644 --- a/drivers/phy/samsung/phy-fsd-ufs.c +++ b/drivers/phy/samsung/phy-fsd-ufs.c @@ -46,6 +46,10 @@ static const struct samsung_ufs_phy_cfg *fsd_ufs_phy_cfgs[CFG_TAG_MAX] = { [CFG_POST_PWR_HS] = fsd_post_pwr_hs_cfg, }; +static const char * const fsd_ufs_phy_clks[] = { + "ref_clk", +}; + const struct samsung_ufs_phy_drvdata fsd_ufs_phy = { .cfgs = fsd_ufs_phy_cfgs, .isol = { @@ -53,6 +57,7 @@ const struct samsung_ufs_phy_drvdata fsd_ufs_phy = { .mask = FSD_EMBEDDED_COMBO_PHY_CTRL_MASK, .en = FSD_EMBEDDED_COMBO_PHY_CTRL_EN, }, - .has_symbol_clk = 0, + .clk_list = fsd_ufs_phy_clks, + .num_clks = ARRAY_SIZE(fsd_ufs_phy_clks), .cdr_lock_status_offset = FSD_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS, }; diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c index e4334529ffbc..14cce2f2487e 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.c +++ b/drivers/phy/samsung/phy-samsung-ufs.c @@ -131,73 +131,21 @@ static int samsung_ufs_phy_calibrate(struct phy *phy) return err; } -static int samsung_ufs_phy_symbol_clk_init(struct samsung_ufs_phy *phy) -{ - int ret; - - phy->tx0_symbol_clk = devm_clk_get(phy->dev, "tx0_symbol_clk"); - if (IS_ERR(phy->tx0_symbol_clk)) { - dev_err(phy->dev, "failed to get tx0_symbol_clk clock\n"); - return PTR_ERR(phy->tx0_symbol_clk); - } - - phy->rx0_symbol_clk = devm_clk_get(phy->dev, "rx0_symbol_clk"); - if (IS_ERR(phy->rx0_symbol_clk)) { - dev_err(phy->dev, "failed to get rx0_symbol_clk clock\n"); - return PTR_ERR(phy->rx0_symbol_clk); - } - - phy->rx1_symbol_clk = devm_clk_get(phy->dev, "rx1_symbol_clk"); - if (IS_ERR(phy->rx1_symbol_clk)) { - dev_err(phy->dev, "failed to get rx1_symbol_clk clock\n"); - return PTR_ERR(phy->rx1_symbol_clk); - } - - ret = clk_prepare_enable(phy->tx0_symbol_clk); - if (ret) { - dev_err(phy->dev, "%s: tx0_symbol_clk enable failed %d\n", __func__, ret); - goto out; - } - - ret = clk_prepare_enable(phy->rx0_symbol_clk); - if (ret) { - dev_err(phy->dev, "%s: rx0_symbol_clk enable failed %d\n", __func__, ret); - goto out_disable_tx0_clk; - } - - ret = clk_prepare_enable(phy->rx1_symbol_clk); - if (ret) { - dev_err(phy->dev, "%s: rx1_symbol_clk enable failed %d\n", __func__, ret); - goto out_disable_rx0_clk; - } - - return 0; - -out_disable_rx0_clk: - clk_disable_unprepare(phy->rx0_symbol_clk); -out_disable_tx0_clk: - clk_disable_unprepare(phy->tx0_symbol_clk); -out: - return ret; -} - static int samsung_ufs_phy_clks_init(struct samsung_ufs_phy *phy) { - int ret; - - phy->ref_clk = devm_clk_get(phy->dev, "ref_clk"); - if (IS_ERR(phy->ref_clk)) - dev_err(phy->dev, "failed to get ref_clk clock\n"); + int i; + const struct samsung_ufs_phy_drvdata *drvdata = phy->drvdata; + int num_clks = drvdata->num_clks; - ret = clk_prepare_enable(phy->ref_clk); - if (ret) { - dev_err(phy->dev, "%s: ref_clk enable failed %d\n", __func__, ret); - return ret; - } + phy->clks = devm_kcalloc(phy->dev, num_clks, sizeof(*phy->clks), + GFP_KERNEL); + if (!phy->clks) + return -ENOMEM; - dev_dbg(phy->dev, "UFS MPHY ref_clk_rate = %ld\n", clk_get_rate(phy->ref_clk)); + for (i = 0; i < num_clks; i++) + phy->clks[i].id = drvdata->clk_list[i]; - return 0; + return devm_clk_bulk_get(phy->dev, num_clks, phy->clks); } static int samsung_ufs_phy_init(struct phy *phy) @@ -208,16 +156,12 @@ static int samsung_ufs_phy_init(struct phy *phy) ss_phy->lane_cnt = phy->attrs.bus_width; ss_phy->ufs_phy_state = CFG_PRE_INIT; - if (ss_phy->has_symbol_clk) { - ret = samsung_ufs_phy_symbol_clk_init(ss_phy); - if (ret) - dev_err(ss_phy->dev, "failed to set ufs phy symbol clocks\n"); + 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_clks_init(ss_phy); - if (ret) - dev_err(ss_phy->dev, "failed to set ufs phy clocks\n"); - ret = samsung_ufs_phy_calibrate(phy); if (ret) dev_err(ss_phy->dev, "ufs phy calibration failed\n"); @@ -258,13 +202,7 @@ static int samsung_ufs_phy_exit(struct phy *phy) { struct samsung_ufs_phy *ss_phy = get_samsung_ufs_phy(phy); - clk_disable_unprepare(ss_phy->ref_clk); - - if (ss_phy->has_symbol_clk) { - clk_disable_unprepare(ss_phy->tx0_symbol_clk); - clk_disable_unprepare(ss_phy->rx0_symbol_clk); - clk_disable_unprepare(ss_phy->rx1_symbol_clk); - } + clk_bulk_disable_unprepare(ss_phy->drvdata->num_clks, ss_phy->clks); return 0; } @@ -330,7 +268,6 @@ static int samsung_ufs_phy_probe(struct platform_device *pdev) phy->dev = dev; phy->drvdata = drvdata; phy->cfgs = drvdata->cfgs; - phy->has_symbol_clk = drvdata->has_symbol_clk; memcpy(&phy->isol, &drvdata->isol, sizeof(phy->isol)); if (!of_property_read_u32_index(dev->of_node, "samsung,pmu-syscon", 1, @@ -339,6 +276,12 @@ static int samsung_ufs_phy_probe(struct platform_device *pdev) phy->lane_cnt = PHY_DEF_LANE_CNT; + err = samsung_ufs_phy_clks_init(phy); + if (err) { + dev_err(dev, "failed to get phy clocks\n"); + goto out; + } + phy_set_drvdata(gen_phy, phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/phy-samsung-ufs.h index 6320ac852f29..e122960cfee8 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.h +++ b/drivers/phy/samsung/phy-samsung-ufs.h @@ -109,7 +109,8 @@ struct samsung_ufs_phy_pmu_isol { struct samsung_ufs_phy_drvdata { const struct samsung_ufs_phy_cfg **cfgs; struct samsung_ufs_phy_pmu_isol isol; - bool has_symbol_clk; + const char * const *clk_list; + int num_clks; u32 cdr_lock_status_offset; }; @@ -117,15 +118,10 @@ struct samsung_ufs_phy { struct device *dev; void __iomem *reg_pma; struct regmap *reg_pmu; - struct clk *ref_clk; - struct clk *ref_clk_parent; - struct clk *tx0_symbol_clk; - struct clk *rx0_symbol_clk; - struct clk *rx1_symbol_clk; + struct clk_bulk_data *clks; const struct samsung_ufs_phy_drvdata *drvdata; const struct samsung_ufs_phy_cfg * const *cfgs; struct samsung_ufs_phy_pmu_isol isol; - bool has_symbol_clk; u8 lane_cnt; int ufs_phy_state; enum phy_mode mode; 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 LS7v17ZYdGMbk8WFpz1sFntfb2W32PT4GqvFhFXfWCxmnN/HZNF9fQebxfLj/5gsdt45wezA 43H5irfHplWdbB53ru1h85iw6ACjx+Yl9R4fn95i8ejbsorR4/iN7UwenzfJBXBGZdtkpCam pBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAB2spFCWmFMKFApI LC5W0rezKcovLUlVyMgvLrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjOaNn3jLng ulDF21MbmBoYT/B3MXJySAiYSKzsfMsOYgsJ7GCU6F8k08XIBWR/YpQ4fPYDVOIbo8TWWaww DY3PDjFCFO1llHj5fSOU8xHIWdLCBlLFJqArseX5K7CEiMAOJolbLRNZQBxmgc2MEu1Xd4JV CQt4SJyf3Am2g0VAVeLvgTVgO3gF7CWu9u5mgtgnL7Hh4HYWEJtTwEHi9+9eZogaQYmTM5+A xZmBapq3zmYGWSAhsJRDouHLOUaIZheJrs+7WSBsYYlXx7ewQ9hSEp/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RKWMBD4vzkTrBRLAKqEn8PrAHr5hWwl7jauxtqnbzEhoPbweo5BRwkfv/uZQaxhYBq7n1a zQJRLyhxcuYTMJsZqL5562zmCYwCs5CkZiFJLWBkWsUomVpQnJueW2xYYJiXWq5XnJhbXJqX rpecn7uJERwvWpo7GLev+qB3iJGJg/EQowQHs5II76pJB5OEeFMSK6tSi/Lji0pzUosPMUpz sCiJ817oOhkvJJCeWJKanZpakFoEk2Xi4JRqYFr3I6Mrc//7Xo2HjQ/4tDl29B6p+1dwYWK8 6G3BQzlMB43N9qzqe/jW9tYJv4v7Hktwck/m2qJb8EUp48fB99eqJU9lnamZ3cm/yD5oUVu+ u3Sn2ckegTbXLcndeZYLDVhnnF4aw/DkxsL/fx8d18x5NOu8ZMENvl/sc3blyf5uE7GYfIt5 6a8OSTOLIK6rZ7Ju1Su98Vs413q1sdv1wH4BXSvhlEzRM/U3d4Yq1tl69rkqixjd/Pvw7zqW 4uztaiXBBhfO5fpWsJ494qWg/OKZwsyOxFVqd6cHcxsXfu26WLJwx+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; } From patchwork Wed Jul 6 02:02:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12907232 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 C5708C43334 for ; Wed, 6 Jul 2022 02:07:09 +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=cQh0sqvDhzFWgUfQmEGKZp4cUg2XUDQHGzB2zocR1Io=; b=K561T17nuf//zE A2e8R1GtAwmra872F0AaBd8BrgZ+gIrWMyiziXpPKexte1CfUWuoeEg3Hq8KVV/816tR26tV7osoP IjarHIiaA+mwphhCsFeiG5XgB8jRv1ffRT11Uj4PQZK39D+fKQZFd43chpFFO52d8zB+hRCIVNWaA mQRaLVa7Jp4UvGpyeqrebSRVaFU/G3WqLtfMoDJ/ZIrUhfVX/b0KsVMT0BtTwVdBvdsP2kR0wsvXS dWbdd1p/wJ7/oL8QJuSaNccv4oDlbzbL6JcMPiZ8FMP7yeseu0upbiP1Pg1zFcECab6QjHyzqRvzT 65NZFbf5HPoRyfuGNpag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQR-005IwU-UT; Wed, 06 Jul 2022 02:06:00 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8uQG-005IqN-LQ for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 02:05:50 +0000 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220706020542epoutp03889a7408fd7588e88bdb392b92eaeb54~-Gz5Vm4Lz2652226522epoutp03J for ; Wed, 6 Jul 2022 02:05:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220706020542epoutp03889a7408fd7588e88bdb392b92eaeb54~-Gz5Vm4Lz2652226522epoutp03J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657073142; bh=4WVMidKDt46NeEqlGcQQblUJcueMO5seurJwZWyKKCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAidpDx7GNmQmqwnjXqzvkWpXJcaHZ+LqJlIgKpp6AkbmYRqXl4jI6nDFUApNyN7j tHxAP9x3hcii7jHjVfMdBmE8+opgCIxDKISMm6AnTmSq11sjCXe3Vzmaa0NEwz4dv9 hsZMwbslYZfFh0pouehakLPSeYpC2EOt3JSu9urk= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220706020541epcas2p1e5cbbb9553b612da8f9ca01020c77029~-Gz4z6iha0309303093epcas2p1t; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.69]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Ld2v941pDz4x9QJ; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 09.B2.09666.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 20220706020541epcas2p1c74a1d1b5ca37ee4795bf9ec0da23fa9~-Gz4CwDpV0308403084epcas2p16; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220706020541epsmtrp2e90554a8be70f454977286ad7481b9ac~-Gz4B_sEm3159231592epsmtrp28; Wed, 6 Jul 2022 02:05:41 +0000 (GMT) X-AuditID: b6c32a45-471ff700000025c2-0a-62c4edf5d3fd Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id E8.5B.08802.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 20220706020540epsmtip2a84f95c5fab56304ce9e9eab073eb1ad~-Gz3yh33M1055210552epsmtip2F; 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 3/3] ufs: ufs-exynos: change ufs phy control sequence Date: Wed, 6 Jul 2022 11:02:55 +0900 Message-Id: <20220706020255.151177-4-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+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmhe7Xt0eSDNbukbN4MG8bm8W0Dz+Z LS7v17ZYdGMbk8WFpz1sFntfb2W32PT4GqvFhFXfWCxmnN/HZNF9fQebxfLj/5gsdt45wezA 43H5irfHplWdbB53ru1h85iw6ACjx+Yl9R4fn95i8ejbsorR4/iN7UwenzfJBXBGZdtkpCam pBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAB2spFCWmFMKFApI LC5W0rezKcovLUlVyMgvLrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjO2PVkJUvB Wb6Kj4/OsjQwfuXuYuTkkBAwkXj75QRzFyMXh5DADkaJLZMus0I4nxglJh37AeV8ZpSY3zOf Eabl1toVUC27GCW2Hf0N5XxklJhxfikzSBWbgK7EluevGEESIgI7mCRutUxkAXGYBTYzSrRf 3ckGUiUs4CEx5fszsA4WAVWJVQfWsIDYvAL2Egd3PmCG2CcvseHgdrA4p4CDxO/fvcwQNYIS J2c+AYszA9U0b50NdoaEwEoOic+zvkEd6yIx4eIlNghbWOLV8S3sELaUxOd3e6HixRJLZ31i gmhuYJS4vO0XVMJYYtazdqBBHEAbNCXW79IHMSUElCWO3ILayyfRcfgvO0SYV6KjTQiiUV3i wPbpLBC2rET3nM+sELaHxNyHf9ggoTWZUeLQllOsExgVZiF5ZxaSd2YhLF7AyLyKUSy1oDg3 PbXYqMAQHsnJ+bmbGMFpWMt1B+Pktx/0DjEycTAeYpTgYFYS4V016WCSEG9KYmVValF+fFFp TmrxIUZTYGBPZJYSTc4HZoK8knhDE0sDEzMzQ3MjUwNzJXFer5QNiUIC6YklqdmpqQWpRTB9 TBycUg1M258dU5G+Fdn3YHKo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0d7NqUsjgyvvv1Wu+B3rpLA3Pw/Wo9L Z94Q/vbg2OvFh+uO7kwulDzo7/7z1lkD70PqnLMcP2pX8L54OH/LHHZx9mlFvO+veAlN1dFV 4Aj9s/lxxFOP7+/OpXNXik8TMq4O5+Z62ymhvmCrQNyFY+wtCV8OnPvZ+G/vmi3/Zaa7WgXu vHK3z0z1x+1ZM+98Eliwo0e0JXXRzcSOEibHSaxf0k5E3nqSYXXcNat74t1dBq/cd85kZjnD lS333zXvk53FjKmXu4P3mJkGf+3NFdt9YMPM5H4lluKMREMt5qLiRACla7frBgMAAA== X-CMS-MailID: 20220706020541epcas2p1c74a1d1b5ca37ee4795bf9ec0da23fa9 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220706020541epcas2p1c74a1d1b5ca37ee4795bf9ec0da23fa9 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_143427_BF84BC12 X-CRM114-Status: GOOD ( 17.91 ) 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 Since commit 1599069a62c6 ("phy: core: Warn when phy_power_on is called before phy_init"), below warning has been reported. phy_power_on was called before phy_init To address this, we need to remove phy_power_on from exynos_ufs_phy_init and move it after phy_init. phy_power_off and phy_exit are also necessary in exynos_ufs_remove. Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski --- drivers/ufs/host/ufs-exynos.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index f971569bafc7..eced97538082 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -905,9 +905,13 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs) if (ret) { dev_err(hba->dev, "%s: phy init failed, ret = %d\n", __func__, ret); - goto out_exit_phy; + return ret; } + ret = phy_power_on(generic_phy); + if (ret) + goto out_exit_phy; + return 0; out_exit_phy: @@ -1169,10 +1173,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) goto out; } - ret = phy_power_on(ufs->phy); - if (ret) - goto phy_off; - exynos_ufs_priv_init(hba, ufs); if (ufs->drv_data->drv_init) { @@ -1190,8 +1190,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) exynos_ufs_config_smu(ufs); return 0; -phy_off: - phy_power_off(ufs->phy); out: hba->priv = NULL; return ret; @@ -1602,9 +1600,14 @@ static int exynos_ufs_probe(struct platform_device *pdev) static int exynos_ufs_remove(struct platform_device *pdev) { struct ufs_hba *hba = platform_get_drvdata(pdev); + struct exynos_ufs *ufs = ufshcd_get_variant(hba); pm_runtime_get_sync(&(pdev)->dev); ufshcd_remove(hba); + + phy_power_off(ufs->phy); + phy_exit(ufs->phy); + return 0; }