Skip to content

Commit e02288e

Browse files
quic-cangmartinkpetersen
authored andcommitted
scsi: ufs: core: mcq: Add Event Specific Interrupt enable and config functions
Add and export two functions to enable ESI and config ESI base addresses. The calls to these exported functions will be added by the next patch in this series. Signed-off-by: Can Guo <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent edb0db0 commit e02288e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i)
246246
{
247247
writel(val, mcq_opr_base(hba, OPR_CQIS, i) + REG_CQIS);
248248
}
249+
EXPORT_SYMBOL_GPL(ufshcd_mcq_write_cqis);
249250

250251
/*
251252
* Current MCQ specification doesn't provide a Task Tag or its equivalent in
@@ -293,6 +294,7 @@ unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
293294

294295
return completed_reqs;
295296
}
297+
EXPORT_SYMBOL_GPL(ufshcd_mcq_poll_cqe_nolock);
296298

297299
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
298300
struct ufs_hw_queue *hwq)
@@ -370,6 +372,20 @@ void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba)
370372
}
371373
}
372374

375+
void ufshcd_mcq_enable_esi(struct ufs_hba *hba)
376+
{
377+
ufshcd_writel(hba, ufshcd_readl(hba, REG_UFS_MEM_CFG) | 0x2,
378+
REG_UFS_MEM_CFG);
379+
}
380+
EXPORT_SYMBOL_GPL(ufshcd_mcq_enable_esi);
381+
382+
void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg)
383+
{
384+
ufshcd_writel(hba, msg->address_lo, REG_UFS_ESILBA);
385+
ufshcd_writel(hba, msg->address_hi, REG_UFS_ESIUBA);
386+
}
387+
EXPORT_SYMBOL_GPL(ufshcd_mcq_config_esi);
388+
373389
int ufshcd_mcq_init(struct ufs_hba *hba)
374390
{
375391
struct Scsi_Host *host = hba->host;

include/ufs/ufshcd.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/blk-crypto-profile.h>
1717
#include <linux/blk-mq.h>
1818
#include <linux/devfreq.h>
19+
#include <linux/msi.h>
1920
#include <linux/pm_runtime.h>
2021
#include <linux/dma-direction.h>
2122
#include <scsi/scsi_device.h>
@@ -1241,6 +1242,11 @@ void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
12411242
void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
12421243
void ufshcd_hba_stop(struct ufs_hba *hba);
12431244
void ufshcd_schedule_eh_work(struct ufs_hba *hba);
1245+
void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
1246+
unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
1247+
struct ufs_hw_queue *hwq);
1248+
void ufshcd_mcq_enable_esi(struct ufs_hba *hba);
1249+
void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg);
12441250

12451251
/**
12461252
* ufshcd_set_variant - set variant specific data to the hba

include/ufs/ufshci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ enum {
5959

6060
REG_UFS_MEM_CFG = 0x300,
6161
REG_UFS_MCQ_CFG = 0x380,
62+
REG_UFS_ESILBA = 0x384,
63+
REG_UFS_ESIUBA = 0x388,
6264
UFSHCI_CRYPTO_REG_SPACE_SIZE = 0x400,
6365
};
6466

0 commit comments

Comments
 (0)