Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503030

[PATCH v2 07/10] phy: qcom-ufs-qmp-xx: Move clock and regulator init out of phy init

From Vivek Gautam <vivek.gautam@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH v2 07/10] phy: qcom-ufs-qmp-xx: Move clock and regulator init out of phy init
Date 2016-10-18 16:30 +0200
Message-ID <stDyW-2Sj-13@gated-at.bofh.it> (permalink)
References <stDyW-2Sj-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The phy init is meant to do phy initialization rather than
just getting the clock and regulator. Move these clock and
regulator get to probe(), to make room for actual phy
initialization sequence.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
---

No change since v1.

 drivers/phy/phy-qcom-ufs-qmp-14nm.c | 52 ++++++++++++++++++-------------------
 drivers/phy/phy-qcom-ufs-qmp-20nm.c | 46 +++++++++++++++-----------------
 2 files changed, 46 insertions(+), 52 deletions(-)

diff --git a/drivers/phy/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
index 55fecbb..a60cf34 100644
--- a/drivers/phy/phy-qcom-ufs-qmp-14nm.c
+++ b/drivers/phy/phy-qcom-ufs-qmp-14nm.c
@@ -44,30 +44,7 @@ void ufs_qcom_phy_qmp_14nm_advertise_quirks(struct ufs_qcom_phy *phy_common)
 
 static int ufs_qcom_phy_qmp_14nm_init(struct phy *generic_phy)
 {
-	struct ufs_qcom_phy_qmp_14nm *phy = phy_get_drvdata(generic_phy);
-	struct ufs_qcom_phy *phy_common = &phy->common_cfg;
-	int err;
-
-	err = ufs_qcom_phy_init_clks(phy_common);
-	if (err) {
-		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
-			__func__, err);
-		goto out;
-	}
-
-	err = ufs_qcom_phy_init_vregulators(phy_common);
-	if (err) {
-		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
-			__func__, err);
-		goto out;
-	}
-	phy_common->vdda_phy.max_uV = UFS_PHY_VDDA_PHY_UV;
-	phy_common->vdda_phy.min_uV = UFS_PHY_VDDA_PHY_UV;
-
-	ufs_qcom_phy_qmp_14nm_advertise_quirks(phy_common);
-
-out:
-	return err;
+	return 0;
 }
 
 static
@@ -136,6 +113,7 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct phy *generic_phy;
 	struct ufs_qcom_phy_qmp_14nm *phy;
+	struct ufs_qcom_phy *phy_common;
 	int err = 0;
 
 	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
@@ -143,8 +121,9 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
 		err = -ENOMEM;
 		goto out;
 	}
+	phy_common = &phy->common_cfg;
 
-	generic_phy = ufs_qcom_phy_generic_probe(pdev, &phy->common_cfg,
+	generic_phy = ufs_qcom_phy_generic_probe(pdev, phy_common,
 				&ufs_qcom_phy_qmp_14nm_phy_ops, &phy_14nm_ops);
 
 	if (!generic_phy) {
@@ -154,10 +133,29 @@ static int ufs_qcom_phy_qmp_14nm_probe(struct platform_device *pdev)
 		goto out;
 	}
 
+	err = ufs_qcom_phy_init_clks(phy_common);
+	if (err) {
+		dev_err(phy_common->dev,
+			"%s: ufs_qcom_phy_init_clks() failed %d\n",
+			__func__, err);
+		goto out;
+	}
+
+	err = ufs_qcom_phy_init_vregulators(phy_common);
+	if (err) {
+		dev_err(phy_common->dev,
+			"%s: ufs_qcom_phy_init_vregulators() failed %d\n",
+			__func__, err);
+		goto out;
+	}
+	phy_common->vdda_phy.max_uV = UFS_PHY_VDDA_PHY_UV;
+	phy_common->vdda_phy.min_uV = UFS_PHY_VDDA_PHY_UV;
+
+	ufs_qcom_phy_qmp_14nm_advertise_quirks(phy_common);
+
 	phy_set_drvdata(generic_phy, phy);
 
-	strlcpy(phy->common_cfg.name, UFS_PHY_NAME,
-		sizeof(phy->common_cfg.name));
+	strlcpy(phy_common->name, UFS_PHY_NAME, sizeof(phy_common->name));
 
 out:
 	return err;
diff --git a/drivers/phy/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
index 9a2f53d..dfc5175 100644
--- a/drivers/phy/phy-qcom-ufs-qmp-20nm.c
+++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
@@ -63,28 +63,7 @@ void ufs_qcom_phy_qmp_20nm_advertise_quirks(struct ufs_qcom_phy *phy_common)
 
 static int ufs_qcom_phy_qmp_20nm_init(struct phy *generic_phy)
 {
-	struct ufs_qcom_phy_qmp_20nm *phy = phy_get_drvdata(generic_phy);
-	struct ufs_qcom_phy *phy_common = &phy->common_cfg;
-	int err = 0;
-
-	err = ufs_qcom_phy_init_clks(phy_common);
-	if (err) {
-		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
-			__func__, err);
-		goto out;
-	}
-
-	err = ufs_qcom_phy_init_vregulators(phy_common);
-	if (err) {
-		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
-			__func__, err);
-		goto out;
-	}
-
-	ufs_qcom_phy_qmp_20nm_advertise_quirks(phy_common);
-
-out:
-	return err;
+	return 0;
 }
 
 static
@@ -192,6 +171,7 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct phy *generic_phy;
 	struct ufs_qcom_phy_qmp_20nm *phy;
+	struct ufs_qcom_phy *phy_common;
 	int err = 0;
 
 	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
@@ -199,8 +179,9 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
 		err = -ENOMEM;
 		goto out;
 	}
+	phy_common = &phy->common_cfg;
 
-	generic_phy = ufs_qcom_phy_generic_probe(pdev, &phy->common_cfg,
+	generic_phy = ufs_qcom_phy_generic_probe(pdev, phy_common,
 				&ufs_qcom_phy_qmp_20nm_phy_ops, &phy_20nm_ops);
 
 	if (!generic_phy) {
@@ -210,10 +191,25 @@ static int ufs_qcom_phy_qmp_20nm_probe(struct platform_device *pdev)
 		goto out;
 	}
 
+	err = ufs_qcom_phy_init_clks(phy_common);
+	if (err) {
+		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_clks() failed %d\n",
+			__func__, err);
+		goto out;
+	}
+
+	err = ufs_qcom_phy_init_vregulators(phy_common);
+	if (err) {
+		dev_err(phy_common->dev, "%s: ufs_qcom_phy_init_vregulators() failed %d\n",
+			__func__, err);
+		goto out;
+	}
+
+	ufs_qcom_phy_qmp_20nm_advertise_quirks(phy_common);
+
 	phy_set_drvdata(generic_phy, phy);
 
-	strlcpy(phy->common_cfg.name, UFS_PHY_NAME,
-			sizeof(phy->common_cfg.name));
+	strlcpy(phy_common->name, UFS_PHY_NAME, sizeof(phy_common->name));
 
 out:
 	return err;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/10] ufs-qcom: phy/hcd: Clean up qcom-ufs phy and ufs-qcom hcd Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
  [PATCH v2 07/10] phy: qcom-ufs-qmp-xx: Move clock and regulator init out of phy init Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
  [PATCH v2 02/10] phy: qcom-ufs: Remove unnecessary BUG_ON Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
  [PATCH v2 01/10] phy: qcom-ufs: remove failure when rx/tx_iface_clk are absent Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
    Re: [PATCH v2 01/10] phy: qcom-ufs: remove failure when  rx/tx_iface_clk are absent Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-18 20:40 +0200
    Re: [PATCH v2 01/10] phy: qcom-ufs: remove failure when  rx/tx_iface_clk are absent Stephen Boyd <sboyd@codeaurora.org> - 2016-10-18 23:20 +0200
      Re: [PATCH v2 01/10] phy: qcom-ufs: remove failure when  rx/tx_iface_clk are absent Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-19 19:30 +0200
  [PATCH v2 10/10] phy: qcom-ufs: Remove common layer phy exit callback Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
    Re: [PATCH v2 10/10] phy: qcom-ufs: Remove common layer phy exit  callback Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-19 02:10 +0200
  [PATCH 08/10] ufs-qcom: phy/hcd: Refactoring phy clock handling Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
    Re: [PATCH 08/10] ufs-qcom: phy/hcd: Refactoring phy clock handling Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-18 22:20 +0200
      Re: [PATCH 08/10] ufs-qcom: phy/hcd: Refactoring phy clock handling Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-19 19:50 +0200
        Re: [PATCH 08/10] ufs-qcom: phy/hcd: Refactoring phy clock handling Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-19 21:20 +0200
          Re: [PATCH 08/10] ufs-qcom: phy/hcd: Refactoring phy clock handling Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-20 05:50 +0200
  [PATCH v2 06/10] phy: qcom-ufs: Remove unnecessary function declarations Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:30 +0200
    Re: [PATCH v2 06/10] phy: qcom-ufs: Remove unnecessary function  declarations Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-18 20:50 +0200
  [PATCH v2 05/10] phy: qcom-ufs: Cleanup clock and regulator initialization Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:40 +0200
  [PATCH v2 04/10] phy: qcom-ufs-qmp-xx: Discard remove callback for drivers. Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:40 +0200
    Re: [PATCH v2 04/10] phy: qcom-ufs-qmp-xx: Discard remove callback  for drivers. Kishon Vijay Abraham I <kishon@ti.com> - 2016-10-26 22:30 +0200
  [PATCH v2 09/10] scsi/ufs: qcom: Add phy_exit call in hcd exit path Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-18 16:40 +0200
    Re: [PATCH v2 09/10] scsi/ufs: qcom: Add phy_exit call in hcd exit  path Subhash Jadavani <subhashj@codeaurora.org> - 2016-10-18 22:20 +0200
  Re: [PATCH v2 00/10] ufs-qcom: phy/hcd: Clean up qcom-ufs phy and ufs-qcom hcd "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-10-25 02:50 +0200
    Re: [PATCH v2 00/10] ufs-qcom: phy/hcd: Clean up qcom-ufs phy and  ufs-qcom hcd Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-10-25 08:10 +0200

csiph-web