mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-01 19:34:35 +08:00
Merge patch series "UFS core patches"
Bart Van Assche <bvanassche@acm.org> says: Hi Martin, Please consider these UFS core patches for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/20230921192335.676924-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
commit
d15dbf0001
@ -2715,27 +2715,23 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba,
|
||||
* for SCSI Purposes
|
||||
* @hba: per adapter instance
|
||||
* @lrbp: pointer to local reference block
|
||||
*
|
||||
* Return: 0 upon success; < 0 upon failure.
|
||||
*/
|
||||
static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
|
||||
static void ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
|
||||
{
|
||||
struct request *rq = scsi_cmd_to_rq(lrbp->cmd);
|
||||
unsigned int ioprio_class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
|
||||
u8 upiu_flags;
|
||||
int ret = 0;
|
||||
|
||||
if (hba->ufs_version <= ufshci_version(1, 1))
|
||||
lrbp->command_type = UTP_CMD_TYPE_SCSI;
|
||||
else
|
||||
lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE;
|
||||
|
||||
if (likely(lrbp->cmd)) {
|
||||
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, lrbp->cmd->sc_data_direction, 0);
|
||||
ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags);
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags,
|
||||
lrbp->cmd->sc_data_direction, 0);
|
||||
if (ioprio_class == IOPRIO_CLASS_RT)
|
||||
upiu_flags |= UPIU_CMD_FLAGS_CP;
|
||||
ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2823,8 +2819,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
|
||||
int err = 0;
|
||||
struct ufs_hw_queue *hwq = NULL;
|
||||
|
||||
WARN_ONCE(tag < 0 || tag >= hba->nutrs, "Invalid tag %d\n", tag);
|
||||
|
||||
switch (hba->ufshcd_state) {
|
||||
case UFSHCD_STATE_OPERATIONAL:
|
||||
break;
|
||||
@ -5098,8 +5092,7 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
|
||||
struct request_queue *q = sdev->request_queue;
|
||||
|
||||
blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
|
||||
if (hba->quirks & UFSHCD_QUIRK_4KB_DMA_ALIGNMENT)
|
||||
blk_queue_update_dma_alignment(q, SZ_4K - 1);
|
||||
|
||||
/*
|
||||
* Block runtime-pm until all consumers are added.
|
||||
* Refer ufshcd_setup_links().
|
||||
@ -5115,6 +5108,9 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
|
||||
*/
|
||||
sdev->silence_suspend = 1;
|
||||
|
||||
if (hba->vops && hba->vops->config_scsi_dev)
|
||||
hba->vops->config_scsi_dev(sdev);
|
||||
|
||||
ufshcd_crypto_register(hba, q);
|
||||
|
||||
return 0;
|
||||
@ -6924,8 +6920,6 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba,
|
||||
spin_lock_irqsave(host->host_lock, flags);
|
||||
|
||||
task_tag = req->tag;
|
||||
WARN_ONCE(task_tag < 0 || task_tag >= hba->nutmrs, "Invalid tag %d\n",
|
||||
task_tag);
|
||||
hba->tmf_rqs[req->tag] = req;
|
||||
treq->upiu_req.req_header.task_tag = task_tag;
|
||||
|
||||
@ -7499,8 +7493,6 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
|
||||
bool outstanding;
|
||||
u32 reg;
|
||||
|
||||
WARN_ONCE(tag < 0, "Invalid tag %d\n", tag);
|
||||
|
||||
ufshcd_hold(hba);
|
||||
|
||||
if (!is_mcq_enabled(hba)) {
|
||||
|
@ -1511,6 +1511,11 @@ static int fsd_ufs_pre_link(struct exynos_ufs *ufs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos_ufs_config_scsi_dev(struct scsi_device *sdev)
|
||||
{
|
||||
blk_queue_update_dma_alignment(sdev->request_queue, SZ_4K - 1);
|
||||
}
|
||||
|
||||
static int fsd_ufs_post_link(struct exynos_ufs *ufs)
|
||||
{
|
||||
int i;
|
||||
@ -1579,6 +1584,7 @@ static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
|
||||
.hibern8_notify = exynos_ufs_hibern8_notify,
|
||||
.suspend = exynos_ufs_suspend,
|
||||
.resume = exynos_ufs_resume,
|
||||
.config_scsi_dev = exynos_ufs_config_scsi_dev,
|
||||
};
|
||||
|
||||
static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops = {
|
||||
@ -1678,8 +1684,7 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = {
|
||||
UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR |
|
||||
UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |
|
||||
UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL |
|
||||
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING |
|
||||
UFSHCD_QUIRK_4KB_DMA_ALIGNMENT,
|
||||
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING,
|
||||
.opts = EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL |
|
||||
EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL |
|
||||
EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX |
|
||||
|
@ -98,9 +98,10 @@ enum upiu_response_transaction {
|
||||
UPIU_TRANSACTION_REJECT_UPIU = 0x3F,
|
||||
};
|
||||
|
||||
/* UPIU Read/Write flags */
|
||||
/* UPIU Read/Write flags. See also table "UPIU Flags" in the UFS standard. */
|
||||
enum {
|
||||
UPIU_CMD_FLAGS_NONE = 0x00,
|
||||
UPIU_CMD_FLAGS_CP = 0x04,
|
||||
UPIU_CMD_FLAGS_WRITE = 0x20,
|
||||
UPIU_CMD_FLAGS_READ = 0x40,
|
||||
};
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#define UFSHCD "ufshcd"
|
||||
|
||||
struct scsi_device;
|
||||
struct ufs_hba;
|
||||
|
||||
enum dev_cmd_type {
|
||||
@ -371,6 +372,7 @@ struct ufs_hba_variant_ops {
|
||||
int (*get_outstanding_cqs)(struct ufs_hba *hba,
|
||||
unsigned long *ocqs);
|
||||
int (*config_esi)(struct ufs_hba *hba);
|
||||
void (*config_scsi_dev)(struct scsi_device *sdev);
|
||||
};
|
||||
|
||||
/* clock gating state */
|
||||
@ -596,11 +598,6 @@ enum ufshcd_quirks {
|
||||
*/
|
||||
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING = 1 << 13,
|
||||
|
||||
/*
|
||||
* Align DMA SG entries on a 4 KiB boundary.
|
||||
*/
|
||||
UFSHCD_QUIRK_4KB_DMA_ALIGNMENT = 1 << 14,
|
||||
|
||||
/*
|
||||
* This quirk needs to be enabled if the host controller does not
|
||||
* support UIC command
|
||||
|
Loading…
Reference in New Issue
Block a user