@@ -20,6 +20,8 @@
#include <linux/reset.h>
#include <linux/slab.h>
+#include <ufs/unipro.h>
+
#include <dt-bindings/phy/phy.h>
#include "phy-qcom-qmp.h"
@@ -549,6 +551,8 @@ struct qmp_phy_cfg {
/* Main init sequence for PHY blocks - serdes, tx, rx, pcs */
const struct qmp_phy_cfg_tbls tbls;
+ /* Additional sequence for HS Series B */
+ const struct qmp_phy_cfg_tbls tbls_hs_b;
/* clock ids to be requested */
const char * const *clk_list;
@@ -582,6 +586,7 @@ struct qmp_phy_cfg {
* @rx2: iomapped memory space for second lane's rx (in dual lane PHYs)
* @pcs_misc: iomapped memory space for lane's pcs_misc
* @qmp: QMP phy to which this lane belongs
+ * @mode: PHY mode configured by the UFS driver
*/
struct qmp_phy {
struct phy *phy;
@@ -594,6 +599,7 @@ struct qmp_phy {
void __iomem *rx2;
void __iomem *pcs_misc;
struct qcom_qmp *qmp;
+ u32 mode;
};
/**
@@ -885,6 +891,8 @@ static void qmp_ufs_pcs_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tbls
static void qmp_ufs_init_registers(struct qmp_phy *qphy, const struct qmp_phy_cfg *cfg)
{
qmp_ufs_serdes_init(qphy, &cfg->tbls);
+ if (qphy->mode == PHY_MODE_UFS_HS_B)
+ qmp_ufs_serdes_init(qphy, &cfg->tbls_hs_b);
qmp_ufs_lanes_init(qphy, &cfg->tbls);
qmp_ufs_pcs_init(qphy, &cfg->tbls);
}
@@ -1073,6 +1081,15 @@ static int qmp_ufs_disable(struct phy *phy)
return qmp_ufs_exit(phy);
}
+static int qmp_ufs_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ struct qmp_phy *qphy = phy_get_drvdata(phy);
+
+ qphy->mode = mode;
+
+ return 0;
+}
+
static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg)
{
struct qcom_qmp *qmp = dev_get_drvdata(dev);
@@ -1108,6 +1125,7 @@ static int qmp_ufs_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg)
static const struct phy_ops qcom_qmp_ufs_ops = {
.power_on = qmp_ufs_enable,
.power_off = qmp_ufs_disable,
+ .set_mode = qmp_ufs_set_mode,
.owner = THIS_MODULE,
};