[PATCH v1] scsi: ufs: ufs-mediatek: Change dbg select by check hw version
Bart Van Assche
bvanassche at acm.org
Mon Aug 30 19:47:35 PDT 2021
On 8/30/21 05:11, peter.wang at mediatek.com wrote:
> +static void ufs_mtk_dbg_sel(struct ufs_hba *hba)
> +{
> + static u32 hw_ver;
> +
> + if (!hw_ver)
> + hw_ver = ufshcd_readl(hba, REG_UFS_MTK_HW_VER);
> +
> + if (((hw_ver >> 16) & 0xFF) >= 0x36) {
> + ufshcd_writel(hba, 0x820820, REG_UFS_DEBUG_SEL);
> + ufshcd_writel(hba, 0x0, REG_UFS_DEBUG_SEL_B0);
> + ufshcd_writel(hba, 0x55555555, REG_UFS_DEBUG_SEL_B1);
> + ufshcd_writel(hba, 0xaaaaaaaa, REG_UFS_DEBUG_SEL_B2);
> + ufshcd_writel(hba, 0xffffffff, REG_UFS_DEBUG_SEL_B3);
> + } else {
> + ufshcd_writel(hba, 0x20, REG_UFS_DEBUG_SEL);
> + }
> +}
Can ufs_mtk_dbg_sel() be called from multiple threads at the same time?
Does the 'hw_ver' variable need to be protected against concurrent writes?
Thanks,
Bart.
More information about the Linux-mediatek
mailing list