Merge "ufs: ufs-qcom: configure UFS mode based on UFS device version"
This commit is contained in:
commit
80375855c2
@ -3576,6 +3576,39 @@ static void ufs_qcom_parse_broken_ahit_workaround_flag(struct ufs_qcom_host *hos
|
||||
host->broken_ahit_wa = of_property_read_bool(np, str);
|
||||
}
|
||||
|
||||
static void ufs_qcom_set_rate_a(struct ufs_qcom_host *host)
|
||||
{
|
||||
size_t len;
|
||||
u8 *data;
|
||||
struct nvmem_cell *nvmem_cell;
|
||||
|
||||
nvmem_cell = nvmem_cell_get(host->hba->dev, "ufs_dev");
|
||||
if (IS_ERR(nvmem_cell)) {
|
||||
dev_err(host->hba->dev, "(%s) Failed to get nvmem cell\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
data = (u8 *)nvmem_cell_read(nvmem_cell, &len);
|
||||
if (IS_ERR(data)) {
|
||||
dev_err(host->hba->dev, "(%s) Failed to read from nvmem\n", __func__);
|
||||
goto cell_put;
|
||||
}
|
||||
|
||||
/*
|
||||
* data equal to zero shows that ufs 2.x card is connected while
|
||||
* non-zero value shows that ufs 3.x card is connected
|
||||
*/
|
||||
if (*data) {
|
||||
host->limit_rate = PA_HS_MODE_A;
|
||||
dev_dbg(host->hba->dev, "UFS 3.x device is detected, Mode is set to RATE A\n");
|
||||
}
|
||||
|
||||
kfree(data);
|
||||
|
||||
cell_put:
|
||||
nvmem_cell_put(nvmem_cell);
|
||||
}
|
||||
|
||||
/**
|
||||
* ufs_qcom_init - bind phy with controller
|
||||
* @hba: host controller instance
|
||||
@ -4745,6 +4778,9 @@ static void ufs_qcom_parse_limits(struct ufs_qcom_host *host)
|
||||
of_property_read_u32(np, "limit-rx-pwm-gear", &host->limit_rx_pwm_gear);
|
||||
of_property_read_u32(np, "limit-rate", &host->limit_rate);
|
||||
of_property_read_u32(np, "limit-phy-submode", &host->limit_phy_submode);
|
||||
|
||||
if (of_property_read_bool(np, "limit-rate-ufs3"))
|
||||
ufs_qcom_set_rate_a(host);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user