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: Asutosh Das <asutoshd@codeaurora.org>
This commit is contained in:
Asutosh Das 2019-07-05 16:01:54 +05:30
commit a27ae1c711
3 changed files with 30 additions and 10 deletions

View file

@ -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);

View file

@ -489,21 +489,13 @@ 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);
@ -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");

View file

@ -0,0 +1,15 @@
/* 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_ */