Skip to content

Commit a84a9ba

Browse files
Naomi Chumartinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Add DDR_EN setting
On MT6989 and later platforms, control of DDR_EN has been switched from SPM to EMI. To prevent abnormal access to DRAM, it is necessary to wait for 'ddren_ack' or assert 'ddren_urgent' after sending 'ddren_req'. Introduce the DDR_EN configuration in the UFS initialization flow, utilizing the assertion of 'ddren_urgent' to maintain performance. Signed-off-by: Naomi Chu <naomi.chu@mediatek.com> Link: https://lore.kernel.org/r/20250722030841.1998783-3-peter.wang@mediatek.com Reviewed-by: Peter Wang <peter.wang@mediatek.com> Reviewed-by: Chun-Hung Wu <chun-hung.wu@mediatek.com> Signed-off-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 2628939 commit a84a9ba

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/ufs/host/ufs-mediatek.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
267267
ufshcd_writel(hba,
268268
ufshcd_readl(hba, REG_UFS_XOUFS_CTRL) | 0x80,
269269
REG_UFS_XOUFS_CTRL);
270+
271+
/* DDR_EN setting */
272+
if (host->ip_ver >= IP_VER_MT6989) {
273+
ufshcd_rmwl(hba, UFS_MASK(0x7FFF, 8),
274+
0x453000, REG_UFS_MMIO_OPT_CTRL_0);
275+
}
276+
270277
}
271278

272279
return 0;

drivers/ufs/host/ufs-mediatek.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,16 @@ struct ufs_mtk_host {
192192
/* MTK RTT support number */
193193
#define MTK_MAX_NUM_RTT 2
194194

195+
/* UFSHCI MTK ip version value */
196+
enum {
197+
/* UFSHCI 3.1 */
198+
IP_VER_MT6878 = 0x10420200,
199+
200+
/* UFSHCI 4.0 */
201+
IP_VER_MT6897 = 0x10440000,
202+
IP_VER_MT6989 = 0x10450000,
203+
204+
IP_VER_NONE = 0xFFFFFFFF
205+
};
206+
195207
#endif /* !_UFS_MEDIATEK_H */

0 commit comments

Comments
 (0)