Skip to contentSkip to conversation

scsi: ufs-qcom: Remove all direct calls to qcom-ufs phy

PATCH In review Vivek Gautam 4 participants 13 messages Sep 4, 2018 – Sep 26, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover scsi: ufs-qcom: Remove all direct calls to qcom-ufs phy

Cleaning up the ufs-qcom host further to remove all direct calls into qcom-ufs driver.
Only phy-qcom-ufs-qmp-20nm phy handles these direct calls from ufs host and this phy is not used in any supported qcom platform in current kernel. So, while we free up the host from all the ufs_qcom_phy_*() API calls we should declare 20nm phy as broken.
For this we fork out couple of configs from PHY_QCOM_UFS - PHY_QCOM_UFS_14NM and PHY_QCOM_UFS_20NM out of which we declare PHY_QCOM_UFS_20NM as 'broken'.

This series helps in a clean use of ufs phy support for sdm845 and further SoCs that will also use phy-qcom-qmp phy driver.

Vivek Gautam (3):
phy: qcom-ufs: Remove stale methods that handle ref clk scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host
phy: qcom-ufs: Declare 20nm qcom ufs qmp phy as Broken

 drivers/phy/qualcomm/Kconfig          | 17 ++++++++++++
 drivers/phy/qualcomm/Makefile         |  4 +--
 drivers/phy/qualcomm/phy-qcom-ufs-i.h |  2 +-
 drivers/phy/qualcomm/phy-qcom-ufs.c   | 50 -----------------------------------
 drivers/scsi/ufs/ufs-qcom.c           | 28 +-------------------
 drivers/scsi/ufs/ufs-qcom.h           |  5 ----
 include/linux/phy/phy-qcom-ufs.h      | 38 --------------------------
 7 files changed, 21 insertions(+), 123 deletions(-)
 delete mode 100644 include/linux/phy/phy-qcom-ufs.h
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

PATCH 1/3 phy: qcom-ufs: Remove stale methods that handle ref clk

Remove ufs_qcom_phy_enable/(disable)_dev_ref_clk() that are not being used by any code.

---
 drivers/phy/qualcomm/phy-qcom-ufs.c | 50 -------------------------------------
 include/linux/phy/phy-qcom-ufs.h    | 14 -----------
 2 files changed, 64 deletions(-)
drivers/phy/qualcomm/phy-qcom-ufs.c +0 -50
index c5493ea51282..f2979ccad00a 100644
@@ -431,56 +431,6 @@ static void ufs_qcom_phy_disable_ref_clk(struct ufs_qcom_phy *phy)
 	}
 }
 
-#define UFS_REF_CLK_EN	(1 << 5)
-
-static void ufs_qcom_phy_dev_ref_clk_ctrl(struct phy *generic_phy, bool enable)
-{
-	struct ufs_qcom_phy *phy = get_ufs_qcom_phy(generic_phy);
-
-	if (phy->dev_ref_clk_ctrl_mmio &&
-	    (enable ^ phy->is_dev_ref_clk_enabled)) {
-		u32 temp = readl_relaxed(phy->dev_ref_clk_ctrl_mmio);
-
-		if (enable)
-			temp |= UFS_REF_CLK_EN;
-		else
-			temp &= ~UFS_REF_CLK_EN;
-
-		/*
-		 * If we are here to disable this clock immediately after
-		 * entering into hibern8, we need to make sure that device
-		 * ref_clk is active atleast 1us after the hibern8 enter.
-		 */
-		if (!enable)
-			udelay(1);
-
-		writel_relaxed(temp, phy->dev_ref_clk_ctrl_mmio);
-		/* ensure that ref_clk is enabled/disabled before we return */
-		wmb();
-		/*
-		 * If we call hibern8 exit after this, we need to make sure that
-		 * device ref_clk is stable for atleast 1us before the hibern8
-		 * exit command.
-		 */
-		if (enable)
-			udelay(1);
-
-		phy->is_dev_ref_clk_enabled = enable;
-	}
-}
-
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
-
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
-
 /* Turn ON M-PHY RMMI interface clocks */
 static int ufs_qcom_phy_enable_iface_clk(struct ufs_qcom_phy *phy)
 {
include/linux/phy/phy-qcom-ufs.h +0 -14
index 0a2c18a9771d..9dd85071bcce 100644
@@ -17,20 +17,6 @@
 
 #include "phy.h"
 
-/**
- * ufs_qcom_phy_enable_dev_ref_clk() - Enable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *phy);
-
-/**
- * ufs_qcom_phy_disable_dev_ref_clk() - Disable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *phy);
-
 int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
 void ufs_qcom_phy_save_controller_version(struct phy *phy,
 			u8 major, u16 minor, u16 step);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] phy: qcom-ufs: Remove stale methods that handle ref clk

Quoted 4 lines · Vivek Gautam

Remove ufs_qcom_phy_enable/(disable)_dev_ref_clk() that are not being used by any code.

Thanks for the ping Vivek, I didn't spot these when you posted them.

Regards,
Bjorn

Quoted 95 lines
---
 drivers/phy/qualcomm/phy-qcom-ufs.c | 50 -------------------------------------
 include/linux/phy/phy-qcom-ufs.h    | 14 -----------
 2 files changed, 64 deletions(-)
drivers/phy/qualcomm/phy-qcom-ufs.c +0 -50
index c5493ea51282..f2979ccad00a 100644
@@ -431,56 +431,6 @@ static void ufs_qcom_phy_disable_ref_clk(struct ufs_qcom_phy *phy)
 	}
 }
 
-#define UFS_REF_CLK_EN	(1 << 5)
-
-static void ufs_qcom_phy_dev_ref_clk_ctrl(struct phy *generic_phy, bool enable)
-{
-	struct ufs_qcom_phy *phy = get_ufs_qcom_phy(generic_phy);
-
-	if (phy->dev_ref_clk_ctrl_mmio &&
-	    (enable ^ phy->is_dev_ref_clk_enabled)) {
-		u32 temp = readl_relaxed(phy->dev_ref_clk_ctrl_mmio);
-
-		if (enable)
-			temp |= UFS_REF_CLK_EN;
-		else
-			temp &= ~UFS_REF_CLK_EN;
-
-		/*
-		 * If we are here to disable this clock immediately after
-		 * entering into hibern8, we need to make sure that device
-		 * ref_clk is active atleast 1us after the hibern8 enter.
-		 */
-		if (!enable)
-			udelay(1);
-
-		writel_relaxed(temp, phy->dev_ref_clk_ctrl_mmio);
-		/* ensure that ref_clk is enabled/disabled before we return */
-		wmb();
-		/*
-		 * If we call hibern8 exit after this, we need to make sure that
-		 * device ref_clk is stable for atleast 1us before the hibern8
-		 * exit command.
-		 */
-		if (enable)
-			udelay(1);
-
-		phy->is_dev_ref_clk_enabled = enable;
-	}
-}
-
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
-
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
-
 /* Turn ON M-PHY RMMI interface clocks */
 static int ufs_qcom_phy_enable_iface_clk(struct ufs_qcom_phy *phy)
 {
include/linux/phy/phy-qcom-ufs.h +0 -14
index 0a2c18a9771d..9dd85071bcce 100644
@@ -17,20 +17,6 @@
 
 #include "phy.h"
 
-/**
- * ufs_qcom_phy_enable_dev_ref_clk() - Enable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *phy);
-
-/**
- * ufs_qcom_phy_disable_dev_ref_clk() - Disable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *phy);
-
 int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
 void ufs_qcom_phy_save_controller_version(struct phy *phy,
 			u8 major, u16 minor, u16 step);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#3 lore raw

Re: [PATCH 1/3] phy: qcom-ufs: Remove stale methods that handle ref clk

Quoted 9 lines · Bjorn Andersson
Quoted 4 lines · Vivek Gautam

Remove ufs_qcom_phy_enable/(disable)_dev_ref_clk() that are not being used by any code.

Thanks for the ping Vivek, I didn't spot these when you posted them.

Thanks for reviewing the series, Bjorn.

Best regards
Vivek

Quoted 99 lines

Regards,
Bjorn

Quoted 95 lines
---
  drivers/phy/qualcomm/phy-qcom-ufs.c | 50 -------------------------------------
  include/linux/phy/phy-qcom-ufs.h    | 14 -----------
  2 files changed, 64 deletions(-)
drivers/phy/qualcomm/phy-qcom-ufs.c +0 -50
index c5493ea51282..f2979ccad00a 100644
@@ -431,56 +431,6 @@ static void ufs_qcom_phy_disable_ref_clk(struct ufs_qcom_phy *phy)
  	}
  }
 
-#define UFS_REF_CLK_EN	(1 << 5)
-
-static void ufs_qcom_phy_dev_ref_clk_ctrl(struct phy *generic_phy, bool enable)
-{
-	struct ufs_qcom_phy *phy = get_ufs_qcom_phy(generic_phy);
-
-	if (phy->dev_ref_clk_ctrl_mmio &&
-	    (enable ^ phy->is_dev_ref_clk_enabled)) {
-		u32 temp = readl_relaxed(phy->dev_ref_clk_ctrl_mmio);
-
-		if (enable)
-			temp |= UFS_REF_CLK_EN;
-		else
-			temp &= ~UFS_REF_CLK_EN;
-
-		/*
-		 * If we are here to disable this clock immediately after
-		 * entering into hibern8, we need to make sure that device
-		 * ref_clk is active atleast 1us after the hibern8 enter.
-		 */
-		if (!enable)
-			udelay(1);
-
-		writel_relaxed(temp, phy->dev_ref_clk_ctrl_mmio);
-		/* ensure that ref_clk is enabled/disabled before we return */
-		wmb();
-		/*
-		 * If we call hibern8 exit after this, we need to make sure that
-		 * device ref_clk is stable for atleast 1us before the hibern8
-		 * exit command.
-		 */
-		if (enable)
-			udelay(1);
-
-		phy->is_dev_ref_clk_enabled = enable;
-	}
-}
-
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
-
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
-{
-	ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
-}
-EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
-
  /* Turn ON M-PHY RMMI interface clocks */
  static int ufs_qcom_phy_enable_iface_clk(struct ufs_qcom_phy *phy)
  {
include/linux/phy/phy-qcom-ufs.h +0 -14
index 0a2c18a9771d..9dd85071bcce 100644
@@ -17,20 +17,6 @@
 
  #include "phy.h"
 
-/**
- * ufs_qcom_phy_enable_dev_ref_clk() - Enable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_enable_dev_ref_clk(struct phy *phy);
-
-/**
- * ufs_qcom_phy_disable_dev_ref_clk() - Disable the device
- * ref clock.
- * @phy: reference to a generic phy.
- */
-void ufs_qcom_phy_disable_dev_ref_clk(struct phy *phy);
-
  int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
  void ufs_qcom_phy_save_controller_version(struct phy *phy,
  			u8 major, u16 minor, u16 step);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#4 lore raw

PATCH 2/3 scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host

In reply to Vivek Gautam

The host makes direct calls into phy using ufs_qcom_phy_*() APIs. These APIs are only defined for 20nm qcom-ufs-qmp phy which is not being used by any architecture as yet. Future architectures too are not going to use 20nm ufs phy. So remove these ufs_qcom_phy_*() calls from host to let further change declare the 20nm phy as broken.
Also remove couple of stale enum defines for ufs phy.

---
 drivers/phy/qualcomm/phy-qcom-ufs-i.h |  2 +-
 drivers/scsi/ufs/ufs-qcom.c           | 28 +---------------------------
 drivers/scsi/ufs/ufs-qcom.h           |  5 -----
 include/linux/phy/phy-qcom-ufs.h      | 24 ------------------------
 4 files changed, 2 insertions(+), 57 deletions(-)
 delete mode 100644 include/linux/phy/phy-qcom-ufs.h
drivers/phy/qualcomm/phy-qcom-ufs-i.h +1 -1
index 822c83b8efcd..681644e43248 100644
@@ -17,9 +17,9 @@
 
 #include <linux/module.h>
 #include <linux/clk.h>
+#include <linux/phy/phy.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
-#include <linux/phy/phy-qcom-ufs.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/delay.h>
drivers/scsi/ufs/ufs-qcom.c +1 -27
index 75ee5906b966..3dc4501c6945 100644
@@ -16,7 +16,6 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/phy/phy.h>
-#include <linux/phy/phy-qcom-ufs.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -189,22 +188,9 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host)
 
 static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
 {
-	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
 	u32 tx_lanes;
-	int err = 0;
-
-	err = ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
-	if (err)
-		goto out;
 
-	err = ufs_qcom_phy_set_tx_lane_enable(phy, tx_lanes);
-	if (err)
-		dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable failed\n",
-			__func__);
-
-out:
-	return err;
+	return ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
 }
 
 static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
@@ -932,10 +918,8 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 {
 	u32 val;
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
 	struct ufs_qcom_dev_params ufs_qcom_cap;
 	int ret = 0;
-	int res = 0;
 
 	if (!dev_req_params) {
 		pr_err("%s: incoming dev_req_params is NULL\n", __func__);
@@ -1002,12 +986,6 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 		}
 
 		val = ~(MAX_U32 << dev_req_params->lane_tx);
-		res = ufs_qcom_phy_set_tx_lane_enable(phy, val);
-		if (res) {
-			dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable() failed res = %d\n",
-				__func__, res);
-			ret = res;
-		}
 
 		/* cache the power mode parameters to use internally */
 		memcpy(&host->dev_req_params,
@@ -1264,10 +1242,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 		}
 	}
 
-	/* update phy revision information before calling phy_init() */
-	ufs_qcom_phy_save_controller_version(host->generic_phy,
-		host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step);
-
 	err = ufs_qcom_init_lane_clks(host);
 	if (err)
 		goto out_variant_clear;
drivers/scsi/ufs/ufs-qcom.h +0 -5
index 295f4bef6a0e..c114826316eb 100644
@@ -129,11 +129,6 @@ enum {
 	MASK_CLK_NS_REG                     = 0xFFFC00,
 };
 
-enum ufs_qcom_phy_init_type {
-	UFS_PHY_INIT_FULL,
-	UFS_PHY_INIT_CFG_RESTORE,
-};
-
 /* QCOM UFS debug print bit mask */
 #define UFS_QCOM_DBG_PRINT_REGS_EN	BIT(0)
 #define UFS_QCOM_DBG_PRINT_ICE_REGS_EN	BIT(1)
include/linux/phy/phy-qcom-ufs.h deleted +0 -24
deleted file mode 100644
index 9dd85071bcce..000000000000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2013-2015, Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef PHY_QCOM_UFS_H_
-#define PHY_QCOM_UFS_H_
-
-#include "phy.h"
-
-int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
-void ufs_qcom_phy_save_controller_version(struct phy *phy,
-			u8 major, u16 minor, u16 step);
-
-#endif /* PHY_QCOM_UFS_H_ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host

Quoted 9 lines · Vivek Gautam

The host makes direct calls into phy using ufs_qcom_phy_*() APIs. These APIs are only defined for 20nm qcom-ufs-qmp phy which is not being used by any architecture as yet. Future architectures too are not going to use 20nm ufs phy. So remove these ufs_qcom_phy_*() calls from host to let further change declare the 20nm phy as broken.
Also remove couple of stale enum defines for ufs phy.

Regards,
Bjorn

Quoted 144 lines
---
 drivers/phy/qualcomm/phy-qcom-ufs-i.h |  2 +-
 drivers/scsi/ufs/ufs-qcom.c           | 28 +---------------------------
 drivers/scsi/ufs/ufs-qcom.h           |  5 -----
 include/linux/phy/phy-qcom-ufs.h      | 24 ------------------------
 4 files changed, 2 insertions(+), 57 deletions(-)
 delete mode 100644 include/linux/phy/phy-qcom-ufs.h
drivers/phy/qualcomm/phy-qcom-ufs-i.h +1 -1
index 822c83b8efcd..681644e43248 100644
@@ -17,9 +17,9 @@
 
 #include <linux/module.h>
 #include <linux/clk.h>
+#include <linux/phy/phy.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
-#include <linux/phy/phy-qcom-ufs.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/delay.h>
drivers/scsi/ufs/ufs-qcom.c +1 -27
index 75ee5906b966..3dc4501c6945 100644
@@ -16,7 +16,6 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/phy/phy.h>
-#include <linux/phy/phy-qcom-ufs.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -189,22 +188,9 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host)
 
 static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
 {
-	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
 	u32 tx_lanes;
-	int err = 0;
-
-	err = ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
-	if (err)
-		goto out;
 
-	err = ufs_qcom_phy_set_tx_lane_enable(phy, tx_lanes);
-	if (err)
-		dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable failed\n",
-			__func__);
-
-out:
-	return err;
+	return ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
 }
 
 static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
@@ -932,10 +918,8 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 {
 	u32 val;
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
 	struct ufs_qcom_dev_params ufs_qcom_cap;
 	int ret = 0;
-	int res = 0;
 
 	if (!dev_req_params) {
 		pr_err("%s: incoming dev_req_params is NULL\n", __func__);
@@ -1002,12 +986,6 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 		}
 
 		val = ~(MAX_U32 << dev_req_params->lane_tx);
-		res = ufs_qcom_phy_set_tx_lane_enable(phy, val);
-		if (res) {
-			dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable() failed res = %d\n",
-				__func__, res);
-			ret = res;
-		}
 
 		/* cache the power mode parameters to use internally */
 		memcpy(&host->dev_req_params,
@@ -1264,10 +1242,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 		}
 	}
 
-	/* update phy revision information before calling phy_init() */
-	ufs_qcom_phy_save_controller_version(host->generic_phy,
-		host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step);
-
 	err = ufs_qcom_init_lane_clks(host);
 	if (err)
 		goto out_variant_clear;
drivers/scsi/ufs/ufs-qcom.h +0 -5
index 295f4bef6a0e..c114826316eb 100644
@@ -129,11 +129,6 @@ enum {
 	MASK_CLK_NS_REG                     = 0xFFFC00,
 };
 
-enum ufs_qcom_phy_init_type {
-	UFS_PHY_INIT_FULL,
-	UFS_PHY_INIT_CFG_RESTORE,
-};
-
 /* QCOM UFS debug print bit mask */
 #define UFS_QCOM_DBG_PRINT_REGS_EN	BIT(0)
 #define UFS_QCOM_DBG_PRINT_ICE_REGS_EN	BIT(1)
include/linux/phy/phy-qcom-ufs.h deleted +0 -24
deleted file mode 100644
index 9dd85071bcce..000000000000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2013-2015, Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef PHY_QCOM_UFS_H_
-#define PHY_QCOM_UFS_H_
-
-#include "phy.h"
-
-int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
-void ufs_qcom_phy_save_controller_version(struct phy *phy,
-			u8 major, u16 minor, u16 step);
-
-#endif /* PHY_QCOM_UFS_H_ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#6 lore raw

Re: [PATCH 2/3] scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host

Hi Martin,

Quoted 11 lines · Bjorn Andersson
Quoted 8 lines · Vivek Gautam

The host makes direct calls into phy using ufs_qcom_phy_*() APIs. These APIs are only defined for 20nm qcom-ufs-qmp phy which is not being used by any architecture as yet. Future architectures too are not going to use 20nm ufs phy. So remove these ufs_qcom_phy_*() calls from host to let further change declare the 20nm phy as broken.
Also remove couple of stale enum defines for ufs phy.

Quoted 6 lines
Quoted 1 line

Regards,
Bjorn

Kishon is looking to pick this series through linux-phy tree. Will you please consider giving your ack for this patch? Thanks.

Best regards
Vivek

Quoted 145 lines
Quoted 145 lines
---
 drivers/phy/qualcomm/phy-qcom-ufs-i.h |  2 +-
 drivers/scsi/ufs/ufs-qcom.c           | 28 +---------------------------
 drivers/scsi/ufs/ufs-qcom.h           |  5 -----
 include/linux/phy/phy-qcom-ufs.h      | 24 ------------------------
 4 files changed, 2 insertions(+), 57 deletions(-)
 delete mode 100644 include/linux/phy/phy-qcom-ufs.h
drivers/phy/qualcomm/phy-qcom-ufs-i.h +1 -1
index 822c83b8efcd..681644e43248 100644
@@ -17,9 +17,9 @@
 
 #include <linux/module.h>
 #include <linux/clk.h>
+#include <linux/phy/phy.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
-#include <linux/phy/phy-qcom-ufs.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/delay.h>
drivers/scsi/ufs/ufs-qcom.c +1 -27
index 75ee5906b966..3dc4501c6945 100644
@@ -16,7 +16,6 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/phy/phy.h>
-#include <linux/phy/phy-qcom-ufs.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -189,22 +188,9 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host)
 
 static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
 {
-     struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-     struct phy *phy = host->generic_phy;
      u32 tx_lanes;
-     int err = 0;
-
-     err = ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
-     if (err)
-             goto out;
 
-     err = ufs_qcom_phy_set_tx_lane_enable(phy, tx_lanes);
-     if (err)
-             dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable failed\n",
-                     __func__);
-
-out:
-     return err;
+     return ufs_qcom_get_connected_tx_lanes(hba, &tx_lanes);
 }
 
 static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
@@ -932,10 +918,8 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 {
      u32 val;
      struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-     struct phy *phy = host->generic_phy;
      struct ufs_qcom_dev_params ufs_qcom_cap;
      int ret = 0;
-     int res = 0;
 
      if (!dev_req_params) {
              pr_err("%s: incoming dev_req_params is NULL\n", __func__);
@@ -1002,12 +986,6 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
              }
 
              val = ~(MAX_U32 << dev_req_params->lane_tx);
-             res = ufs_qcom_phy_set_tx_lane_enable(phy, val);
-             if (res) {
-                     dev_err(hba->dev, "%s: ufs_qcom_phy_set_tx_lane_enable() failed res = %d\n",
-                             __func__, res);
-                     ret = res;
-             }
 
              /* cache the power mode parameters to use internally */
              memcpy(&host->dev_req_params,
@@ -1264,10 +1242,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
              }
      }
 
-     /* update phy revision information before calling phy_init() */
-     ufs_qcom_phy_save_controller_version(host->generic_phy,
-             host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step);
-
      err = ufs_qcom_init_lane_clks(host);
      if (err)
              goto out_variant_clear;
drivers/scsi/ufs/ufs-qcom.h +0 -5
index 295f4bef6a0e..c114826316eb 100644
@@ -129,11 +129,6 @@ enum {
      MASK_CLK_NS_REG                     = 0xFFFC00,
 };
 
-enum ufs_qcom_phy_init_type {
-     UFS_PHY_INIT_FULL,
-     UFS_PHY_INIT_CFG_RESTORE,
-};
-
 /* QCOM UFS debug print bit mask */
 #define UFS_QCOM_DBG_PRINT_REGS_EN   BIT(0)
 #define UFS_QCOM_DBG_PRINT_ICE_REGS_EN       BIT(1)
include/linux/phy/phy-qcom-ufs.h deleted +0 -25
deleted file mode 100644
index 9dd85071bcce..000000000000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2013-2015, Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef PHY_QCOM_UFS_H_
-#define PHY_QCOM_UFS_H_
-
-#include "phy.h"
-
-int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes);
-void ufs_qcom_phy_save_controller_version(struct phy *phy,
-                     u8 major, u16 minor, u16 step);
-
-#endif /* PHY_QCOM_UFS_H_ */
--

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#7 lore raw

Re: [PATCH 2/3] scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host

Vivek,

Quoted 2 lines

Kishon is looking to pick this series through linux-phy tree. Will you please consider giving your ack for this patch? Thanks.

Looks fine.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#8 lore raw

Re: [PATCH 2/3] scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host

Quoted 10 lines · Martin K. Petersen

Vivek,

Quoted 2 lines

Kishon is looking to pick this series through linux-phy tree. Will you please consider giving your ack for this patch? Thanks.

Looks fine.

Thanks Martin.

Best regards
Vivek

Quoted 3 lines

--
Martin K. Petersen Oracle Linux Engineering

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#9 lore raw

PATCH 3/3 phy: qcom-ufs: Declare 20nm qcom ufs qmp phy as Broken

In reply to Vivek Gautam

Fork out separate configs for 14nm and 20nm qcom ufs qmp phys to declare the 20nm phy as broken.

---
 drivers/phy/qualcomm/Kconfig  | 17 +++++++++++++++++
 drivers/phy/qualcomm/Makefile |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/phy/qualcomm/Kconfig +17 -0
index 632a0e73ee10..32f7d34eb784 100644
@@ -50,6 +50,23 @@ config PHY_QCOM_UFS
 	help
 	  Support for UFS PHY on QCOM chipsets.
 
+if PHY_QCOM_UFS
+
+config PHY_QCOM_UFS_14NM
+	tristate
+	default PHY_QCOM_UFS
+	help
+	  Support for 14nm UFS QMP phy present on QCOM chipsets.
+
+config PHY_QCOM_UFS_20NM
+	tristate
+	default PHY_QCOM_UFS
+	depends on BROKEN
+	help
+	  Support for 20nm UFS QMP phy present on QCOM chipsets.
+
+endif
+
 config PHY_QCOM_USB_HS
 	tristate "Qualcomm USB HS PHY module"
 	depends on USB_ULPI_BUS
drivers/phy/qualcomm/Makefile +2 -2
index deb831f453ae..c56efd3af205 100644
@@ -5,7 +5,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)	+= phy-qcom-ipq806x-sata.o
 obj-$(CONFIG_PHY_QCOM_QMP)		+= phy-qcom-qmp.o
 obj-$(CONFIG_PHY_QCOM_QUSB2)		+= phy-qcom-qusb2.o
 obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs.o
-obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs-qmp-14nm.o
-obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs-qmp-20nm.o
+obj-$(CONFIG_PHY_QCOM_UFS_14NM)		+= phy-qcom-ufs-qmp-14nm.o
+obj-$(CONFIG_PHY_QCOM_UFS_20NM)		+= phy-qcom-ufs-qmp-20nm.o
 obj-$(CONFIG_PHY_QCOM_USB_HS) 		+= phy-qcom-usb-hs.o
 obj-$(CONFIG_PHY_QCOM_USB_HSIC) 	+= phy-qcom-usb-hsic.o
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] phy: qcom-ufs: Declare 20nm qcom ufs qmp phy as Broken

Quoted 4 lines · Vivek Gautam

Fork out separate configs for 14nm and 20nm qcom ufs qmp phys to declare the 20nm phy as broken.

Regards,
Bjorn

Quoted 51 lines
---
 drivers/phy/qualcomm/Kconfig  | 17 +++++++++++++++++
 drivers/phy/qualcomm/Makefile |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/phy/qualcomm/Kconfig +17 -0
index 632a0e73ee10..32f7d34eb784 100644
@@ -50,6 +50,23 @@ config PHY_QCOM_UFS
 	help
 	  Support for UFS PHY on QCOM chipsets.
 
+if PHY_QCOM_UFS
+
+config PHY_QCOM_UFS_14NM
+	tristate
+	default PHY_QCOM_UFS
+	help
+	  Support for 14nm UFS QMP phy present on QCOM chipsets.
+
+config PHY_QCOM_UFS_20NM
+	tristate
+	default PHY_QCOM_UFS
+	depends on BROKEN
+	help
+	  Support for 20nm UFS QMP phy present on QCOM chipsets.
+
+endif
+
 config PHY_QCOM_USB_HS
 	tristate "Qualcomm USB HS PHY module"
 	depends on USB_ULPI_BUS
drivers/phy/qualcomm/Makefile +2 -2
index deb831f453ae..c56efd3af205 100644
@@ -5,7 +5,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)	+= phy-qcom-ipq806x-sata.o
 obj-$(CONFIG_PHY_QCOM_QMP)		+= phy-qcom-qmp.o
 obj-$(CONFIG_PHY_QCOM_QUSB2)		+= phy-qcom-qusb2.o
 obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs.o
-obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs-qmp-14nm.o
-obj-$(CONFIG_PHY_QCOM_UFS)		+= phy-qcom-ufs-qmp-20nm.o
+obj-$(CONFIG_PHY_QCOM_UFS_14NM)		+= phy-qcom-ufs-qmp-14nm.o
+obj-$(CONFIG_PHY_QCOM_UFS_20NM)		+= phy-qcom-ufs-qmp-20nm.o
 obj-$(CONFIG_PHY_QCOM_USB_HS) 		+= phy-qcom-usb-hs.o
 obj-$(CONFIG_PHY_QCOM_USB_HSIC) 	+= phy-qcom-usb-hsic.o
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#11 lore raw
In reply to Vivek Gautam

Hi all,

Quoted 11 lines · Vivek Gautam

Cleaning up the ufs-qcom host further to remove all direct calls into qcom-ufs driver.
Only phy-qcom-ufs-qmp-20nm phy handles these direct calls from ufs host and this phy is not used in any supported qcom platform in current kernel. So, while we free up the host from all the ufs_qcom_phy_*() API calls we should declare 20nm phy as broken.
For this we fork out couple of configs from PHY_QCOM_UFS - PHY_QCOM_UFS_14NM and PHY_QCOM_UFS_20NM out of which we declare PHY_QCOM_UFS_20NM as 'broken'.

Quoted 2 lines

This series helps in a clean use of ufs phy support for sdm845 and further SoCs that will also use phy-qcom-qmp phy driver.

Gentle ping, any inputs on this series?

Thanks
Vivek

Quoted 20 lines

Vivek Gautam (3):
phy: qcom-ufs: Remove stale methods that handle ref clk scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host
phy: qcom-ufs: Declare 20nm qcom ufs qmp phy as Broken

 drivers/phy/qualcomm/Kconfig          | 17 ++++++++++++
 drivers/phy/qualcomm/Makefile         |  4 +--
 drivers/phy/qualcomm/phy-qcom-ufs-i.h |  2 +-
 drivers/phy/qualcomm/phy-qcom-ufs.c   | 50 -----------------------------------
 drivers/scsi/ufs/ufs-qcom.c           | 28 +-------------------
 drivers/scsi/ufs/ufs-qcom.h           |  5 ----
 include/linux/phy/phy-qcom-ufs.h      | 38 --------------------------
 7 files changed, 21 insertions(+), 123 deletions(-)
 delete mode 100644 include/linux/phy/phy-qcom-ufs.h

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#12 lore raw
In reply to Vivek Gautam

Hi Vivek,

Quoted 10 lines · Vivek Gautam

Cleaning up the ufs-qcom host further to remove all direct calls into qcom-ufs driver.
Only phy-qcom-ufs-qmp-20nm phy handles these direct calls from ufs host and this phy is not used in any supported qcom platform in current kernel. So, while we free up the host from all the ufs_qcom_phy_*() API calls we should declare 20nm phy as broken.
For this we fork out couple of configs from PHY_QCOM_UFS - PHY_QCOM_UFS_14NM and PHY_QCOM_UFS_20NM out of which we declare PHY_QCOM_UFS_20NM as 'broken'.

Quoted 2 lines

This series helps in a clean use of ufs phy support for sdm845 and further SoCs that will also use phy-qcom-qmp phy driver.

I think this entire series should go via linux-phy tree. I need ACK from UFS MAINTAINER for the second patch.

Thanks
Kishon