From patchwork Tue Jul 5 06:54:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 588008 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 341D1C43334 for ; Tue, 5 Jul 2022 06:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbiGEG5l (ORCPT ); Tue, 5 Jul 2022 02:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbiGEG5f (ORCPT ); Tue, 5 Jul 2022 02:57:35 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B495211478 for ; Mon, 4 Jul 2022 23:57:29 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220705065723epoutp020a97c3b4e4c92e5e7207aa594bb60479~_3JSbaB-m1078110781epoutp02Y for ; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220705065723epoutp020a97c3b4e4c92e5e7207aa594bb60479~_3JSbaB-m1078110781epoutp02Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657004243; bh=beDNbN5+hVC4ohLyniAKT+fD+NWS3tAHbhrqM23SPvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nqvCkc71j/214rvN968e8DJitYj/9zD8B3mzxcORj7fUY1BMq95rZi64Ex88faVTk NhsDmLoE5DWYp0viXQFe6grLnvPFfz7Cv6EAks6ULkP/qmfl9EAV4/zht5oABGcYB3 PHfszYJiVLRGiffXGvx4j8I7QukpCl3qRd5VogFo= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220705065723epcas2p17b5d5e413f6df7568816389bad9cf079~_3JR8Xjn20425204252epcas2p1O; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.70]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LcYQB6GXRz4x9Q4; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id C2.D4.09662.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epcas2p2973795cc88ee436480abcb48435059a8~_3JRKAGSS2076820768epcas2p2X; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220705065722epsmtrp126994bbd1d4e3de06c09b2d2ba853d92~_3JRJIp-Y0044600446epsmtrp1T; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) X-AuditID: b6c32a48-9f7ff700000025be-20-62c3e0d2aad3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 5B.9C.08905.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epsmtip162659f880acf5aa45d675f4d8dc4184f~_3JQ8u4Zp3025130251epsmtip1C; Tue, 5 Jul 2022 06:57:22 +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 1/3] phy: samsung-ufs: convert phy clk usage to clk_bulk API Date: Tue, 5 Jul 2022 15:54:38 +0900 Message-Id: <20220705065440.117864-2-chanho61.park@samsung.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705065440.117864-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKJsWRmVeSWpSXmKPExsWy7bCmqe6lB4eTDFZ807N4MG8bm8W0Dz+Z LS7v17ZYdGMbk8WFpz1sFntfb2W32PT4GqvFhFXfWCxmnN/HZNF9fQebxfLj/5gsdt45wezA 43H5irfHplWdbB53ru1h85iw6ACjx+Yl9R4fn95i8ejbsorR4/iN7UwenzfJBXBGZdtkpCam pBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAB2spFCWmFMKFApI LC5W0rezKcovLUlVyMgvLrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjOOHBqF3vB d/eK59fqGhg/2nQxcnJICJhILHt+gLGLkYtDSGAHo8S1yV8ZQRJCAp8YJT5N8oBIfGOU+Hq6 mbWLkQOso6lbFCK+l1FiwZHzzBDOR0aJg11TwLrZBHQltjx/BTZWRGAHk8StloksIA6zwGZG ifarO9lAqoQFfCQ6+vYwg9gsAqoS1xZ/AYvzCthLPD+7mB3iQHmJDQe3s4DYnAIOEic/TmeB qBGUODnzCZjNDFTTvHU22BkSAks5JJqnNTBB3OoiceCrEcQcYYlXx7dAzZSSeNnfBmUXSyyd 9YkJoreBUeLytl9sEAljiVnP2hlB5jALaEqs36UPMVJZ4sgtqLV8Eh2H/7JDhHklOtqEIBrV JQ5sh7hSQkBWonvO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UKSWsDItIpRMrWgODc9t9iwwDAvtVyvODG3uDQv XS85P3cTIzhWtDR3MG5f9UHvECMTB+MhRgkOZiUR3lWTDiYJ8aYkVlalFuXHF5XmpBYfYpTm YFES573QdTJeSCA9sSQ1OzW1ILUIJsvEwSnVwKQ9d2NW01KHqfp99ncer55i9UlpwroXE54l nM2yN7ta7mpXzd17ZNfU6Nn5L/vWR+pvbG/XKe3awXwoQpNFVOsE+6wrHZ8eql11jjYRO8b7 rHuh5B+GJXK2i+o9K6008yodKr6UfzYs2q5zanump/t8qa7DKhlvntxwU3m+9X65W5lBr9a8 k9cFN7lkufUxLHY3e8z6IUTa0WPL8/+/O5qFw16+zT8pUnxy4v696U9/ZVlNC1XTEBHmnFB0 ODjuS9JcjvhGxXanSfuLd1Z+VE46sib/48lVJ46fU98UFa69fPes2ac07zW3T8pQfOnnzVR6 4xybcdleoyW+89LLl5VyH/EKvHWCfWH2Fo3dpkosxRmJhlrMRcWJABK429QEAwAA X-CMS-MailID: 20220705065722epcas2p2973795cc88ee436480abcb48435059a8 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220705065722epcas2p2973795cc88ee436480abcb48435059a8 References: <20220705065440.117864-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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 --- 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 Tue Jul 5 06:54:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 587651 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2FEDC433EF for ; Tue, 5 Jul 2022 06:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbiGEG5d (ORCPT ); Tue, 5 Jul 2022 02:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbiGEG5d (ORCPT ); Tue, 5 Jul 2022 02:57:33 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D5911151 for ; Mon, 4 Jul 2022 23:57:28 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220705065724epoutp0482cb335b46b999cea60ce50ecde9638a~_3JStfmxa0599205992epoutp04R for ; Tue, 5 Jul 2022 06:57:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220705065724epoutp0482cb335b46b999cea60ce50ecde9638a~_3JStfmxa0599205992epoutp04R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657004244; bh=GaXk6C5ZPNsJghk/oacoRjHDd45VFdfE52ZJL9lfkPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pci4O45Ge1DRgwKKZMpcdHxUUpc+QPg2EKgfl7j9mQuBrHPDxj7H5hWCCWYcgUJai XUROg6fPni1ZnQhnhjgR5nVk6cfln/LFXMHXj5bvhV+emzlfxbpCTLEw+US+NzcBRA O7vYEhEwZeRmcpH98CMqIn+OqUDC+8YdBLWYwkCM= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220705065723epcas2p115fd9ef18d77c19234b44182cac668a8~_3JSWNshq0422904229epcas2p1u; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.69]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4LcYQC2TK5z4x9Q8; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 46.02.09642.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epcas2p1e93a8511b906d5e111bff48a312d0603~_3JRSIaiI0422904229epcas2p1o; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220705065722epsmtrp266de03dc69b6fac2f1c24830cdd316e5~_3JRQf4oY0175501755epsmtrp2D; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) X-AuditID: b6c32a47-5f7ff700000025aa-b9-62c3e0d2a3a7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7B.9C.08905.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epsmtip1655df47d4a490dea18633e188803e41c~_3JRBuGLG2649026490epsmtip1X; Tue, 5 Jul 2022 06:57:22 +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 2/3] phy: samsung-ufs: ufs: change phy on/off control Date: Tue, 5 Jul 2022 15:54:39 +0900 Message-Id: <20220705065440.117864-3-chanho61.park@samsung.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705065440.117864-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAA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7HERD7LZye4u/2/ppqWH0xaOOB6R19+/vaw26X9rGnPtt g6q/wO6pWw7/rVg+u6RV3sbA67NO6ValUFG2VR2Bkzx/vL29MzGoe0LvrV1H1i3PNt1oay20 Q8f64zx2r1+7vi7R5J9r+Thb7IJg7yEDOZ7zSizFGYmGWsxFxYkAnQdhogUDAAA= X-CMS-MailID: 20220705065722epcas2p1e93a8511b906d5e111bff48a312d0603 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220705065722epcas2p1e93a8511b906d5e111bff48a312d0603 References: <20220705065440.117864-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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 Tue Jul 5 06:54:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 588009 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B9ECCCA47C for ; Tue, 5 Jul 2022 06:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbiGEG5e (ORCPT ); Tue, 5 Jul 2022 02:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbiGEG5d (ORCPT ); Tue, 5 Jul 2022 02:57:33 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBEE10FEE for ; Mon, 4 Jul 2022 23:57:28 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220705065723epoutp04986059e91bf03797fa055da6c82f6ceb~_3JSoZX9r0513605136epoutp04k for ; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220705065723epoutp04986059e91bf03797fa055da6c82f6ceb~_3JSoZX9r0513605136epoutp04k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657004243; bh=z8d5Qytme2DFLhjWK38ZehBSKA0rVhpPVOhXXIjGfF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNYUGRol3eKe41CktGZS+fHTLtYRc52eX3gO8dq4tT31waN6JoFgZ6ifEFF5BzA8k mGTK9Gv11nZL8GWX3FS3ED6e0JadgcxyrKEy/6pJ/6y3WR1/zqgnhkENj17asE85nx +ILnPc2tUGZqh/Q7nCYTddt9b/ytsWyRLP9cBDhQ= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220705065723epcas2p17772464049dbf2a257ece2605c5d3bad~_3JSB5rqA0425204252epcas2p1Q; Tue, 5 Jul 2022 06:57:23 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4LcYQB6kShz4x9QG; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 36.02.09642.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epcas2p3f9970697f6d1f1fed43e10fe17019619~_3JRQplMY1456014560epcas2p3I; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220705065722epsmtrp1b37c0121e5081e6e9fe00075dc363e17~_3JRPwb3r0059400594epsmtrp1k; Tue, 5 Jul 2022 06:57:22 +0000 (GMT) X-AuditID: b6c32a47-dff43a80000025aa-b8-62c3e0d2fdda Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id F4.99.08802.2D0E3C26; Tue, 5 Jul 2022 15:57:22 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220705065722epsmtip1ce49b549e00b1ed9474946930b11ab7b~_3JRGYLFt2746727467epsmtip1k; Tue, 5 Jul 2022 06:57:22 +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 3/3] ufs: ufs-exynos: change ufs phy control sequence Date: Tue, 5 Jul 2022 15:54:40 +0900 Message-Id: <20220705065440.117864-4-chanho61.park@samsung.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705065440.117864-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBJsWRmVeSWpSXmKPExsWy7bCmme6lB4eTDLrajC0ezNvGZjHtw09m i8v7tS0W3djGZHHhaQ+bxd7XW9ktNj2+xmoxYdU3FosZ5/cxWX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ldZ3ARST/qu/hw kOHjhX5Hp4myyL94/i7mlqLrputHfKbcvsK16tyZojolluKMREMt5qLiRACQm/tZBQMAAA== X-CMS-MailID: 20220705065722epcas2p3f9970697f6d1f1fed43e10fe17019619 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220705065722epcas2p3f9970697f6d1f1fed43e10fe17019619 References: <20220705065440.117864-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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 --- drivers/ufs/host/ufs-exynos.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index f971569bafc7..5718296e2521 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -908,6 +908,8 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs) goto out_exit_phy; } + phy_power_on(generic_phy); + return 0; out_exit_phy: @@ -1169,10 +1171,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 +1188,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 +1598,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; }