Skip to content

Commit 858231b

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Move the 4K alignment code into the Exynos driver
The DMA alignment for the Exynos controller follows directly from the PRDT segment size configured in ufs-exynos.c. Hence, move the DMA alignment code into the Exynos driver source code. Cc: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230921192335.676924-3-bvanassche@acm.org Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Tested-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent cdaaff6 commit 858231b

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5095,8 +5095,7 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
50955095
struct request_queue *q = sdev->request_queue;
50965096

50975097
blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
5098-
if (hba->quirks & UFSHCD_QUIRK_4KB_DMA_ALIGNMENT)
5099-
blk_queue_update_dma_alignment(q, SZ_4K - 1);
5098+
51005099
/*
51015100
* Block runtime-pm until all consumers are added.
51025101
* Refer ufshcd_setup_links().
@@ -5112,6 +5111,9 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
51125111
*/
51135112
sdev->silence_suspend = 1;
51145113

5114+
if (hba->vops && hba->vops->config_scsi_dev)
5115+
hba->vops->config_scsi_dev(sdev);
5116+
51155117
ufshcd_crypto_register(hba, q);
51165118

51175119
return 0;

drivers/ufs/host/ufs-exynos.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,11 @@ static int fsd_ufs_pre_link(struct exynos_ufs *ufs)
15111511
return 0;
15121512
}
15131513

1514+
static void exynos_ufs_config_scsi_dev(struct scsi_device *sdev)
1515+
{
1516+
blk_queue_update_dma_alignment(sdev->request_queue, SZ_4K - 1);
1517+
}
1518+
15141519
static int fsd_ufs_post_link(struct exynos_ufs *ufs)
15151520
{
15161521
int i;
@@ -1579,6 +1584,7 @@ static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
15791584
.hibern8_notify = exynos_ufs_hibern8_notify,
15801585
.suspend = exynos_ufs_suspend,
15811586
.resume = exynos_ufs_resume,
1587+
.config_scsi_dev = exynos_ufs_config_scsi_dev,
15821588
};
15831589

15841590
static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops = {
@@ -1680,8 +1686,7 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = {
16801686
UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR |
16811687
UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |
16821688
UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL |
1683-
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING |
1684-
UFSHCD_QUIRK_4KB_DMA_ALIGNMENT,
1689+
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING,
16851690
.opts = EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL |
16861691
EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL |
16871692
EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX |

include/ufs/ufshcd.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#define UFSHCD "ufshcd"
3030

31+
struct scsi_device;
3132
struct ufs_hba;
3233

3334
enum dev_cmd_type {
@@ -371,6 +372,7 @@ struct ufs_hba_variant_ops {
371372
int (*get_outstanding_cqs)(struct ufs_hba *hba,
372373
unsigned long *ocqs);
373374
int (*config_esi)(struct ufs_hba *hba);
375+
void (*config_scsi_dev)(struct scsi_device *sdev);
374376
};
375377

376378
/* clock gating state */
@@ -596,11 +598,6 @@ enum ufshcd_quirks {
596598
*/
597599
UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING = 1 << 13,
598600

599-
/*
600-
* Align DMA SG entries on a 4 KiB boundary.
601-
*/
602-
UFSHCD_QUIRK_4KB_DMA_ALIGNMENT = 1 << 14,
603-
604601
/*
605602
* This quirk needs to be enabled if the host controller does not
606603
* support UIC command

0 commit comments

Comments
 (0)