Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a27ae1c7 authored by Asutosh Das's avatar Asutosh Das
Browse files

phy: phy-qcom-ufs: add receive line configuration



This is a snapshot of UFS phy driver taken as of commit
<Iece7757565b>
("ufs: Porting UFS driver's changes from kernel msm-4.14
to msm-kona")

Exposes a receive line configuration function.
This is to make sure that the RX LineCfg is enabled
before link-startup.

Change-Id: I73eb0caf65f14d7444c1c90228d2384e028ddbdc
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent e3225c64
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/phy/phy-qcom-ufs.h>

#define UFS_QCOM_PHY_CAL_ENTRY(reg, val)	\
	{				\
@@ -104,6 +105,8 @@ struct ufs_qcom_phy {
 * @set_tx_lane_enable: pointer to a function that enable tx lanes
 * @power_control: pointer to a function that controls analog rail of phy
 * and writes to QSERDES_RX_SIGDET_CNTRL attribute
 * @ctrl_rx_linecfg: pointer to a function that controls the enable/disable of
 * Rx line config
 */
struct ufs_qcom_phy_specific_ops {
	int (*calibrate)(struct ufs_qcom_phy *ufs_qcom_phy, bool is_rate_B);
@@ -111,6 +114,7 @@ struct ufs_qcom_phy_specific_ops {
	int (*is_physical_coding_sublayer_ready)(struct ufs_qcom_phy *phy);
	void (*set_tx_lane_enable)(struct ufs_qcom_phy *phy, u32 val);
	void (*power_control)(struct ufs_qcom_phy *phy, bool val);
	void (*ctrl_rx_linecfg)(struct ufs_qcom_phy *phy, bool ctrl);
};

struct ufs_qcom_phy *get_ufs_qcom_phy(struct phy *generic_phy);
+11 −10
Original line number Diff line number Diff line
@@ -489,22 +489,14 @@ static int ufs_qcom_phy_start_serdes(struct ufs_qcom_phy *ufs_qcom_phy)
	return ret;
}

int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
void ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
{
	struct ufs_qcom_phy *ufs_qcom_phy = get_ufs_qcom_phy(generic_phy);
	int ret = 0;

	if (!ufs_qcom_phy->phy_spec_ops->set_tx_lane_enable) {
		dev_err(ufs_qcom_phy->dev, "%s: set_tx_lane_enable() callback is not supported\n",
			__func__);
		ret = -ENOTSUPP;
	} else {
	if (ufs_qcom_phy->phy_spec_ops->set_tx_lane_enable)
		ufs_qcom_phy->phy_spec_ops->set_tx_lane_enable(ufs_qcom_phy,
							       tx_lanes);
}

	return ret;
}
EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);

void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
@@ -642,6 +634,15 @@ int ufs_qcom_phy_power_off(struct phy *generic_phy)
}
EXPORT_SYMBOL_GPL(ufs_qcom_phy_power_off);

void ufs_qcom_phy_ctrl_rx_linecfg(struct phy *generic_phy, bool ctrl)
{
	struct ufs_qcom_phy *ufs_qcom_phy = get_ufs_qcom_phy(generic_phy);

	if (ufs_qcom_phy->phy_spec_ops->ctrl_rx_linecfg)
		ufs_qcom_phy->phy_spec_ops->ctrl_rx_linecfg(ufs_qcom_phy, ctrl);
}
EXPORT_SYMBOL(ufs_qcom_phy_ctrl_rx_linecfg);

MODULE_AUTHOR("Yaniv Gardi <ygardi@codeaurora.org>");
MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>");
MODULE_DESCRIPTION("Universal Flash Storage (UFS) QCOM PHY");
+15 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2013-2019, Linux Foundation. All rights reserved.
 */

#ifndef PHY_QCOM_UFS_H_
#define PHY_QCOM_UFS_H_

#include "phy.h"

void ufs_qcom_phy_ctrl_rx_linecfg(struct phy *generic_phy, bool ctrl);
void ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes);

#endif /* PHY_QCOM_UFS_H_ */