scsi: ufs: enable ufs driver to support generic PHY framework

In this change, ufs driver is using the generic PHY framework,
by calling the API "devm_phy_get" that returns handle to a generic
PHY driver.

In this change "__maybe_unused" flag of a few callbacks is removed
since those callbacks are now hooked to generic PHY driver APIs that
were added.

This change also includes the required DT changes as in this case,
the driver changes derived from the DT changes and therefor must
be placed within the same change.

Change-Id: I10e15e25d050bedca55a058b79240360564aebcd
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
This commit is contained in:
Yaniv Gardi 2014-07-28 23:06:11 +03:00 committed by Gerrit - the friendly Code Review server
parent 21bd073ffc
commit 41f158e58e
6 changed files with 21 additions and 13 deletions

View file

@ -10,6 +10,8 @@ Required properties:
Optional properties:
- phys : phandle to UFS PHY node
- phy-names : the string "ufs_msm_phy" when is found in a node, along
with "phys" attribute, provides phandle to UFS PHY node
- vdd-hba-supply : phandle to UFS host controller supply regulator node
- vcc-supply : phandle to VCC supply regulator node
- vccq-supply : phandle to VCCQ supply regulator node

View file

@ -4674,6 +4674,7 @@
reg = <0xfc594000 0x800>;
interrupts = <0 28 0>;
phys = <&ufsphy1>;
phy-names = "ufs_msm_phy";
vcc-supply = <&pma8084_l19>;
vccq-supply = <&pma8084_l4>;
vccq2-supply = <&pma8084_s4>;

View file

@ -975,6 +975,7 @@
reg = <0xfc594000 0x2500>;
interrupts = <0 265 0>;
phys = <&ufsphy1>;
phy-names = "ufs_msm_phy";
vdd-hba-supply = <&gdsc_ufs>;
vdd-hba-fixed-regulator;
vcc-supply = <&pm8994_l20>;

View file

@ -158,8 +158,7 @@ static int ufs_msm_phy_qmp_20nm_is_pcs_ready(struct ufs_msm_phy *phy_common)
return err;
}
static void __maybe_unused
ufs_msm_phy_qmp_20nm_advertise_quirks(struct phy *generic_phy)
static void ufs_msm_phy_qmp_20nm_advertise_quirks(struct phy *generic_phy)
{
struct ufs_msm_phy_qmp_20nm *phy = phy_get_drvdata(generic_phy);
struct ufs_msm_phy *phy_common = &(phy->common_cfg);
@ -173,12 +172,13 @@ struct phy_ops ufs_msm_phy_qmp_20nm_phy_ops = {
.exit = ufs_msm_phy_exit,
.power_on = ufs_msm_phy_power_on,
.power_off = ufs_msm_phy_power_off,
.advertise_quirks = ufs_msm_phy_qmp_20nm_advertise_quirks,
.owner = THIS_MODULE,
};
struct ufs_msm_phy_specific_ops phy_20nm_ops = {
.calibrate_phy = ufs_msm_phy_qmp_20nm_phy_calibrate,
.start_serdes = ufs_msm_phy_qmp_20nm_start_serdes,
.calibrate_phy = ufs_msm_phy_qmp_20nm_phy_calibrate,
.start_serdes = ufs_msm_phy_qmp_20nm_start_serdes,
.is_physical_coding_sublayer_ready = ufs_msm_phy_qmp_20nm_is_pcs_ready,
.set_tx_lane_enable = ufs_msm_phy_qmp_20nm_set_tx_lane_enable,
.power_control = ufs_msm_phy_qmp_20nm_power_control,

View file

@ -209,8 +209,7 @@ ufs_msm_phy_qmp_28nm_write_attr(struct phy *generic_phy, u32 attr, u32 val)
writel_relaxed(0x00, phy_common->mmio + UFS_PHY_RMMI_ATTR_CTRL);
}
static void __maybe_unused
ufs_msm_phy_qmp_28nm_restore_attrs(struct phy *generic_phy)
static void ufs_msm_phy_qmp_28nm_restore_attrs(struct phy *generic_phy)
{
int i;
@ -233,9 +232,7 @@ static int ufs_msm_phy_qmp_28nm_is_pcs_ready(struct ufs_msm_phy *phy_common)
return err;
}
static
void __maybe_unused
ufs_msm_phy_qmp_28nm_advertise_quirks(struct phy *generic_phy)
static void ufs_msm_phy_qmp_28nm_advertise_quirks(struct phy *generic_phy)
{
struct ufs_msm_phy_qmp_28nm *phy = phy_get_drvdata(generic_phy);
struct ufs_msm_phy *phy_common = &(phy->common_cfg);
@ -244,7 +241,7 @@ ufs_msm_phy_qmp_28nm_advertise_quirks(struct phy *generic_phy)
| MSM_UFS_PHY_DIS_SIGDET_BEFORE_PWR_COLLAPSE;
}
static int __maybe_unused ufs_msm_phy_qmp_28nm_suspend(struct phy *generic_phy)
static int ufs_msm_phy_qmp_28nm_suspend(struct phy *generic_phy)
{
struct ufs_msm_phy_qmp_28nm *phy = phy_get_drvdata(generic_phy);
struct ufs_msm_phy *phy_common = &(phy->common_cfg);
@ -258,7 +255,7 @@ static int __maybe_unused ufs_msm_phy_qmp_28nm_suspend(struct phy *generic_phy)
return 0;
}
static int __maybe_unused ufs_msm_phy_qmp_28nm_resume(struct phy *generic_phy)
static int ufs_msm_phy_qmp_28nm_resume(struct phy *generic_phy)
{
struct ufs_msm_phy_qmp_28nm *phy = phy_get_drvdata(generic_phy);
struct ufs_msm_phy *phy_common = &phy->common_cfg;
@ -281,6 +278,9 @@ struct phy_ops ufs_msm_phy_qmp_28nm_phy_ops = {
.exit = ufs_msm_phy_exit,
.power_on = ufs_msm_phy_power_on,
.power_off = ufs_msm_phy_power_off,
.advertise_quirks = ufs_msm_phy_qmp_28nm_advertise_quirks,
.suspend = ufs_msm_phy_qmp_28nm_suspend,
.resume = ufs_msm_phy_qmp_28nm_resume,
.owner = THIS_MODULE,
};

View file

@ -496,6 +496,8 @@ static int ufs_msm_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* voltage, current to settle down before starting serdes.
*/
usleep_range(1000, 1100);
err = phy_resume(host->generic_phy);
}
hba->is_sys_suspended = false;
@ -785,7 +787,7 @@ out:
*/
static void ufs_msm_advertise_quirks(struct ufs_hba *hba)
{
struct ufs_msm_host __maybe_unused *host = hba->priv;
struct ufs_msm_host *host = hba->priv;
u8 major;
u16 minor, step;
@ -800,6 +802,8 @@ static void ufs_msm_advertise_quirks(struct ufs_hba *hba)
hba->quirks |= (UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS
| UFSHCD_QUIRK_BROKEN_PA_RXHSUNTERMCAP
| UFSHCD_QUIRK_BROKEN_LCC);
phy_advertise_quirks(host->generic_phy);
}
static int ufs_msm_get_bus_vote(struct ufs_msm_host *host,
@ -1029,7 +1033,7 @@ static int ufs_msm_init(struct ufs_hba *hba)
}
host->hba = hba;
host->generic_phy = NULL;
host->generic_phy = devm_phy_get(dev, "ufs_msm_phy");
if (IS_ERR(host->generic_phy)) {
err = PTR_ERR(host->generic_phy);