Message ID | 20240308070241.9163-4-peter.wang@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ufs: host: mediatek: Provide features and fixes in MediaTek platforms | expand |
> From: Peter Wang <peter.wang@mediatek.com> > > From: Po-Wen Kao <powen.kao@mediatek.com> > > Add new mediatek host cap UFS_MTK_CAP_DISABLE_MCQ to allow disable > MCQ feature by assigning dts boolean property "mediatek,ufs-disable-mcq"" > > Reviewed-by: Peter Wang <peter.wang@mediatek.com> > Signed-off-by: Peter Wang <peter.wang@mediatek.com> > Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> > --- > drivers/ufs/host/ufs-mediatek.c | 12 ++++++++++++ drivers/ufs/host/ufs- > mediatek.h | 1 + > 2 files changed, 13 insertions(+) > > diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c > index 0262e8994236..cdf29cfa490b 100644 > --- a/drivers/ufs/host/ufs-mediatek.c > +++ b/drivers/ufs/host/ufs-mediatek.c > @@ -640,6 +640,9 @@ static void ufs_mtk_init_host_caps(struct ufs_hba *hba) > if (of_property_read_bool(np, "mediatek,ufs-tx-skew-fix")) > host->caps |= UFS_MTK_CAP_TX_SKEW_FIX; > > + if (of_property_read_bool(np, "mediatek,ufs-disable-mcq")) > + host->caps |= UFS_MTK_CAP_DISABLE_MCQ; > + > dev_info(hba->dev, "caps: 0x%x", host->caps); } > > @@ -874,6 +877,9 @@ static void ufs_mtk_init_mcq_irq(struct ufs_hba *hba) > host->mcq_nr_intr = UFSHCD_MAX_Q_NR; > pdev = container_of(hba->dev, struct platform_device, dev); > > + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) > + goto failed; > + > for (i = 0; i < host->mcq_nr_intr; i++) { > /* irq index 0 is legacy irq, sq/cq irq start from index 1 */ > irq = platform_get_irq(pdev, i + 1); @@ -1585,6 +1591,12 @@ static > int ufs_mtk_clk_scale_notify(struct ufs_hba *hba, bool scale_up, > > static int ufs_mtk_get_hba_mac(struct ufs_hba *hba) { > + struct ufs_mtk_host *host = ufshcd_get_variant(hba); > + > + /* MCQ operation not permitted */ > + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) > + return -EPERM; > + > return MAX_SUPP_MAC; > } > > diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-mediatek.h > index 146c25080599..79c64de25254 100644 > --- a/drivers/ufs/host/ufs-mediatek.h > +++ b/drivers/ufs/host/ufs-mediatek.h > @@ -143,6 +143,7 @@ enum ufs_mtk_host_caps { > UFS_MTK_CAP_ALLOW_VCCQX_LPM = 1 << 5, > UFS_MTK_CAP_PMC_VIA_FASTAUTO = 1 << 6, > UFS_MTK_CAP_TX_SKEW_FIX = 1 << 7, > + UFS_MTK_CAP_DISABLE_MCQ = 1 << 8, > }; > > struct ufs_mtk_crypt_cfg { > -- > 2.18.0
On Fri, 2024-03-08 at 15:02 +0800, peter.wang@mediatek.com wrote: > From: Peter Wang <peter.wang@mediatek.com> > > From: Po-Wen Kao <powen.kao@mediatek.com> > > Add new mediatek host cap UFS_MTK_CAP_DISABLE_MCQ to allow disable > MCQ feature by assigning dts boolean property > "mediatek,ufs-disable-mcq"" > > Reviewed-by: Peter Wang <peter.wang@mediatek.com> > Signed-off-by: Peter Wang <peter.wang@mediatek.com> > Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> > --- > drivers/ufs/host/ufs-mediatek.c | 12 ++++++++++++ > drivers/ufs/host/ufs-mediatek.h | 1 + > 2 files changed, 13 insertions(+) > > diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs- > mediatek.c > index 0262e8994236..cdf29cfa490b 100644 > --- a/drivers/ufs/host/ufs-mediatek.c > +++ b/drivers/ufs/host/ufs-mediatek.c > @@ -640,6 +640,9 @@ static void ufs_mtk_init_host_caps(struct ufs_hba > *hba) > if (of_property_read_bool(np, "mediatek,ufs-tx-skew-fix")) > host->caps |= UFS_MTK_CAP_TX_SKEW_FIX; > > + if (of_property_read_bool(np, "mediatek,ufs-disable-mcq")) > + host->caps |= UFS_MTK_CAP_DISABLE_MCQ; > + > dev_info(hba->dev, "caps: 0x%x", host->caps); > } > > @@ -874,6 +877,9 @@ static void ufs_mtk_init_mcq_irq(struct ufs_hba > *hba) > host->mcq_nr_intr = UFSHCD_MAX_Q_NR; > pdev = container_of(hba->dev, struct platform_device, dev); > > + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) > + goto failed; > + > for (i = 0; i < host->mcq_nr_intr; i++) { > /* irq index 0 is legacy irq, sq/cq irq start from > index 1 */ > irq = platform_get_irq(pdev, i + 1); > @@ -1585,6 +1591,12 @@ static int ufs_mtk_clk_scale_notify(struct > ufs_hba *hba, bool scale_up, > > static int ufs_mtk_get_hba_mac(struct ufs_hba *hba) > { > + struct ufs_mtk_host *host = ufshcd_get_variant(hba); > + > + /* MCQ operation not permitted */ > + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) > + return -EPERM; > + > return MAX_SUPP_MAC; > } > > diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs- > mediatek.h > index 146c25080599..79c64de25254 100644 > --- a/drivers/ufs/host/ufs-mediatek.h > +++ b/drivers/ufs/host/ufs-mediatek.h > @@ -143,6 +143,7 @@ enum ufs_mtk_host_caps { > UFS_MTK_CAP_ALLOW_VCCQX_LPM = 1 << 5, > UFS_MTK_CAP_PMC_VIA_FASTAUTO = 1 << 6, > UFS_MTK_CAP_TX_SKEW_FIX = 1 << 7, > + UFS_MTK_CAP_DISABLE_MCQ = 1 << 8, > }; > > struct ufs_mtk_crypt_cfg { Acked-by: Chun-Hung Wu <Chun-Hung.Wu@mediatek.com>
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 0262e8994236..cdf29cfa490b 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -640,6 +640,9 @@ static void ufs_mtk_init_host_caps(struct ufs_hba *hba) if (of_property_read_bool(np, "mediatek,ufs-tx-skew-fix")) host->caps |= UFS_MTK_CAP_TX_SKEW_FIX; + if (of_property_read_bool(np, "mediatek,ufs-disable-mcq")) + host->caps |= UFS_MTK_CAP_DISABLE_MCQ; + dev_info(hba->dev, "caps: 0x%x", host->caps); } @@ -874,6 +877,9 @@ static void ufs_mtk_init_mcq_irq(struct ufs_hba *hba) host->mcq_nr_intr = UFSHCD_MAX_Q_NR; pdev = container_of(hba->dev, struct platform_device, dev); + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) + goto failed; + for (i = 0; i < host->mcq_nr_intr; i++) { /* irq index 0 is legacy irq, sq/cq irq start from index 1 */ irq = platform_get_irq(pdev, i + 1); @@ -1585,6 +1591,12 @@ static int ufs_mtk_clk_scale_notify(struct ufs_hba *hba, bool scale_up, static int ufs_mtk_get_hba_mac(struct ufs_hba *hba) { + struct ufs_mtk_host *host = ufshcd_get_variant(hba); + + /* MCQ operation not permitted */ + if (host->caps & UFS_MTK_CAP_DISABLE_MCQ) + return -EPERM; + return MAX_SUPP_MAC; } diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-mediatek.h index 146c25080599..79c64de25254 100644 --- a/drivers/ufs/host/ufs-mediatek.h +++ b/drivers/ufs/host/ufs-mediatek.h @@ -143,6 +143,7 @@ enum ufs_mtk_host_caps { UFS_MTK_CAP_ALLOW_VCCQX_LPM = 1 << 5, UFS_MTK_CAP_PMC_VIA_FASTAUTO = 1 << 6, UFS_MTK_CAP_TX_SKEW_FIX = 1 << 7, + UFS_MTK_CAP_DISABLE_MCQ = 1 << 8, }; struct ufs_mtk_crypt_cfg {