Skip to content

Commit

Permalink
ufs-qcom: save controller revision info in internal structure
Browse files Browse the repository at this point in the history
Sometimes, specific information about the UFS controller revision is
required in order to determine certain operations or execute
controller dependent quirks.
In order to avoid reading the controller revision multiple times,
we simply read it once and save this information in internal structure.

Signed-off-by: Yaniv Gardi <[email protected]>
Reviewed-by: Gilad Broner <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
Yaniv Gardi authored and James Bottomley committed Apr 10, 2015
1 parent a776e39 commit bfdbe8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/scsi/ufs/ufs-qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
struct ufs_qcom_host *host = hba->priv;
struct phy *phy = host->generic_phy;
int ret = 0;
u8 major;
u16 minor, step;
bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
? true : false;

Expand All @@ -224,8 +222,6 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
/* provide 1ms delay to let the reset pulse propagate */
usleep_range(1000, 1100);

ufs_qcom_get_controller_revision(hba, &major, &minor, &step);
ufs_qcom_phy_save_controller_version(phy, major, minor, step);
ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B);
if (ret) {
dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret = %d\n",
Expand Down Expand Up @@ -698,10 +694,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
*/
static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
{
u8 major;
u16 minor, step;

ufs_qcom_get_controller_revision(hba, &major, &minor, &step);

/*
* TBD
Expand Down Expand Up @@ -929,6 +922,13 @@ static int ufs_qcom_init(struct ufs_hba *hba)
if (err)
goto out_host_free;

ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
&host->hw_ver.minor, &host->hw_ver.step);

/* update phy revision information before calling phy_init() */
ufs_qcom_phy_save_controller_version(host->generic_phy,
host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step);

phy_init(host->generic_phy);
err = phy_power_on(host->generic_phy);
if (err)
Expand Down
8 changes: 8 additions & 0 deletions drivers/scsi/ufs/ufs-qcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ struct ufs_qcom_bus_vote {
struct device_attribute max_bus_bw;
};

/* Host controller hardware version: major.minor.step */
struct ufs_hw_version {
u16 step;
u16 minor;
u8 major;
};
struct ufs_qcom_host {
struct phy *generic_phy;
struct ufs_hba *hba;
Expand All @@ -161,6 +167,8 @@ struct ufs_qcom_host {
struct clk *rx_l1_sync_clk;
struct clk *tx_l1_sync_clk;
bool is_lane_clks_enabled;

struct ufs_hw_version hw_ver;
};

#define ufs_qcom_is_link_off(hba) ufshcd_is_link_off(hba)
Expand Down

0 comments on commit bfdbe8b

Please sign in to comment.