Skip to content

Commit f92bb74

Browse files
petegriffinmartinkpetersen
authored andcommitted
scsi: ufs: exynos: Disable iocc if dma-coherent property isn't set
If dma-coherent property isn't set then descriptors are non-cacheable and the iocc shareability bits should be disabled. Without this UFS can end up in an incompatible configuration and suffer from random cache related stability issues. Suggested-by: Bart Van Assche <[email protected]> Fixes: cc52e15 ("scsi: ufs: ufs-exynos: Support ExynosAuto v9 UFS") Signed-off-by: Peter Griffin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Chanho Park <[email protected]> Cc: [email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 68f5ef7 commit f92bb74

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

drivers/ufs/host/ufs-exynos.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ static int exynos_ufs_shareability(struct exynos_ufs *ufs)
214214
/* IO Coherency setting */
215215
if (ufs->sysreg) {
216216
return regmap_update_bits(ufs->sysreg,
217-
ufs->shareability_reg_offset,
218-
ufs->iocc_mask, ufs->iocc_mask);
217+
ufs->iocc_offset,
218+
ufs->iocc_mask, ufs->iocc_val);
219219
}
220220

221221
return 0;
@@ -1173,13 +1173,22 @@ static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs)
11731173
ufs->sysreg = NULL;
11741174
else {
11751175
if (of_property_read_u32_index(np, "samsung,sysreg", 1,
1176-
&ufs->shareability_reg_offset)) {
1176+
&ufs->iocc_offset)) {
11771177
dev_warn(dev, "can't get an offset from sysreg. Set to default value\n");
1178-
ufs->shareability_reg_offset = UFS_SHAREABILITY_OFFSET;
1178+
ufs->iocc_offset = UFS_SHAREABILITY_OFFSET;
11791179
}
11801180
}
11811181

11821182
ufs->iocc_mask = ufs->drv_data->iocc_mask;
1183+
/*
1184+
* no 'dma-coherent' property means the descriptors are
1185+
* non-cacheable so iocc shareability should be disabled.
1186+
*/
1187+
if (of_dma_is_coherent(dev->of_node))
1188+
ufs->iocc_val = ufs->iocc_mask;
1189+
else
1190+
ufs->iocc_val = 0;
1191+
11831192
ufs->pclk_avail_min = PCLK_AVAIL_MIN;
11841193
ufs->pclk_avail_max = PCLK_AVAIL_MAX;
11851194

drivers/ufs/host/ufs-exynos.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,9 @@ struct exynos_ufs {
231231
ktime_t entry_hibern8_t;
232232
const struct exynos_ufs_drv_data *drv_data;
233233
struct regmap *sysreg;
234-
u32 shareability_reg_offset;
234+
u32 iocc_offset;
235235
u32 iocc_mask;
236+
u32 iocc_val;
236237

237238
u32 opts;
238239
#define EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL BIT(0)

0 commit comments

Comments
 (0)