Merge "scsi: ufshcd: Move to ufshcd core"

This commit is contained in:
qctecmdr 2020-06-03 12:43:51 -07:00 • committed by Gerrit - the friendly Code Review server
commit b89d97ac1d
6 changed files with 29 additions and 46 deletions

View file

@ -54,7 +54,7 @@ CONFIG_I2C_RTC6226_QCA=m
CONFIG_SCSI_UFSHCD_QTI=y
CONFIG_SCSI_UFS_BSG=y
CONFIG_MSM_EXT_DISPLAY=y
# CONFIG_SCSI_UFSHCD is not set
CONFIG_SCSI_UFSHCD=y
# CONFIG_RADIO_SI470X is not set
# CONFIG_RADIO_SI4713 is not set
# CONFIG_USB_MR800 is not set

View file

@ -52,7 +52,7 @@ config SCSI_UFSHCD
config SCSI_UFSHCD_QTI
tristate "Universal Flash Storage Controller Driver Core QTI"
depends on SCSI && SCSI_DMA && QGKI && !SCSI_UFSHCD
depends on SCSI && SCSI_DMA && QGKI && SCSI_UFSHCD
select PM_DEVFREQ
select DEVFREQ_GOV_SIMPLE_ONDEMAND
select NLS
@ -171,7 +171,7 @@ config SCSI_UFS_BSG
config SCSI_UFS_CRYPTO
bool "UFS Crypto Engine Support"
depends on (SCSI_UFSHCD || SCSI_UFSHCD_QTI) && BLK_INLINE_ENCRYPTION
depends on SCSI_UFSHCD && BLK_INLINE_ENCRYPTION
help
Enable Crypto Engine Support in UFS.
Enabling this makes it possible for the kernel to use the crypto

View file

@ -11,9 +11,5 @@ obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o
obj-$(CONFIG_SCSI_UFS_MEDIATEK) += ufs-mediatek.o
obj-$(CONFIG_SCSI_UFSHCD_QTI) += ufshcd-qti-core.o
ufshcd-qti-core-y += ufshcd-qti.o ufs-sysfs.o
ufshcd-qti-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o
ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o
ufshcd-qti-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o
obj-$(CONFIG_SCSI_UFS_CRYPTO_QTI) += ufshcd-crypto-qti.o

View file

@ -8214,7 +8214,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
int ret;
ktime_t start = ktime_get();
dev_err(hba->dev, "*** This is %s ***\n", __FILE__);
dev_err(hba->dev, "Using %s: Move to upstream ufs core --\n", __FILE__);
return -EPERM;
ret = ufshcd_link_startup(hba);
if (ret)

View file

@ -2062,6 +2062,8 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
/* Write UIC Cmd */
ufshcd_writel(hba, uic_cmd->command & COMMAND_OPCODE_MASK,
REG_UIC_COMMAND);
/* Ensure that the command is written */
wmb();
}
/**
@ -7153,11 +7155,8 @@ static int ufshcd_device_params_init(struct ufs_hba *hba)
__func__, ret);
goto out;
}
ufs_fixup_device_setup(hba);
/* Clear any previous UFS device information */
memset(&hba->dev_info, 0, sizeof(hba->dev_info));
if (!ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_READ_FLAG,
QUERY_FLAG_IDN_PWR_ON_WPE, &flag))
hba->dev_info.f_power_on_wp_en = flag;
@ -7219,6 +7218,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
int ret;
ktime_t start = ktime_get();
dev_err(hba->dev, "*** This is %s ***\n", __FILE__);
ret = ufshcd_link_startup(hba);
if (ret)
goto out;
@ -8026,6 +8026,23 @@ out:
return ret;
}
#if defined(CONFIG_SCSI_UFSHCD_QTI)
static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba)
{
if (ufshcd_is_link_off(hba) ||
(ufshcd_is_link_hibern8(hba)
&& ufshcd_is_power_collapse_during_hibern8_allowed(hba)))
ufshcd_setup_hba_vreg(hba, false);
}
static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba)
{
if (ufshcd_is_link_off(hba) ||
(ufshcd_is_link_hibern8(hba)
&& ufshcd_is_power_collapse_during_hibern8_allowed(hba)))
ufshcd_setup_hba_vreg(hba, true);
}
#else
static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba)
{
if (ufshcd_is_link_off(hba))
@ -8037,6 +8054,7 @@ static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba)
if (ufshcd_is_link_off(hba))
ufshcd_setup_hba_vreg(hba, true);
}
#endif
/**
* ufshcd_suspend - helper function for suspend operations

View file

@ -432,14 +432,13 @@ enum clk_gating_state {
struct ufs_clk_gating {
#ifdef CONFIG_SCSI_UFSHCD_QTI
struct hrtimer gate_hrtimer;
struct work_struct gate_work;
unsigned long delay_ms_pwr_save;
unsigned long delay_ms_perf;
struct device_attribute delay_pwr_save_attr;
struct device_attribute delay_perf_attr;
#else
struct delayed_work gate_work;
#endif
struct delayed_work gate_work;
struct work_struct ungate_work;
enum clk_gating_state state;
unsigned long delay_ms;
@ -513,19 +512,6 @@ struct ufshcd_cmd_log {
u32 seq_num;
};
#define UIC_ERR_REG_HIST_LENGTH 20
/**
* struct ufs_uic_err_reg_hist - keeps history of uic errors
* @pos: index to indicate cyclic buffer position
* @reg: cyclic buffer for registers value
* @tstamp: cyclic buffer for time stamp
*/
struct ufs_uic_err_reg_hist {
int pos;
u32 reg[UIC_ERR_REG_HIST_LENGTH];
ktime_t tstamp[UIC_ERR_REG_HIST_LENGTH];
};
/* UFS Host Controller debug print bitmask */
#define UFSHCD_DBG_PRINT_CLK_FREQ_EN UFS_BIT(0)
#define UFSHCD_DBG_PRINT_UIC_ERR_HIST_EN UFS_BIT(1)
@ -647,21 +633,15 @@ struct ufs_stats {
u32 power_mode_change_cnt;
struct ufshcd_clk_ctx clk_hold;
struct ufshcd_clk_ctx clk_rel;
struct ufs_uic_err_reg_hist pa_err;
struct ufs_uic_err_reg_hist dl_err;
struct ufs_uic_err_reg_hist nl_err;
struct ufs_uic_err_reg_hist tl_err;
struct ufs_uic_err_reg_hist dme_err;
u32 last_intr_status;
ktime_t last_intr_ts;
#else
#endif
/* uic specific errors */
struct ufs_err_reg_hist pa_err;
struct ufs_err_reg_hist dl_err;
struct ufs_err_reg_hist nl_err;
struct ufs_err_reg_hist tl_err;
struct ufs_err_reg_hist dme_err;
#endif
/* fatal errors */
struct ufs_err_reg_hist auto_hibern8_err;
@ -1246,18 +1226,6 @@ void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
int ufshcd_hold(struct ufs_hba *hba, bool async);
void ufshcd_release(struct ufs_hba *hba);
#ifdef CONFIG_SCSI_UFSHCD_QTI
void ufshcd_scsi_block_requests(struct ufs_hba *hba);
void ufshcd_scsi_unblock_requests(struct ufs_hba *hba);
int ufshcd_wait_for_doorbell_clr(struct ufs_hba *hba, u64 wait_timeout_us);
int ufshcd_change_power_mode(struct ufs_hba *hba,
struct ufs_pa_layer_attr *pwr_mode);
extern void ufshcd_apply_pm_quirks(struct ufs_hba *hba);
extern int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up);
extern int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size);
#endif
int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
int *desc_length);