scsi: ufs-mediatek: Create reset control device_link
Mediatek UFS reset function relies on Reset Control provided by reset-ti-syscon. To make Mediatek Reset Control work properly, select reset-ti-syscon to ensure it is being built. In addition, establish device_link to wait until reset-ti-syscon initialization is complete during UFS probing. Link: https://lore.kernel.org/r/1622601720-22466-1-git-send-email-peter.wang@mediatek.com Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
9dda74f343
commit
de48898d0c
@ -115,6 +115,7 @@ config SCSI_UFS_MEDIATEK
|
|||||||
tristate "Mediatek specific hooks to UFS controller platform driver"
|
tristate "Mediatek specific hooks to UFS controller platform driver"
|
||||||
depends on SCSI_UFSHCD_PLATFORM && ARCH_MEDIATEK
|
depends on SCSI_UFSHCD_PLATFORM && ARCH_MEDIATEK
|
||||||
select PHY_MTK_UFS
|
select PHY_MTK_UFS
|
||||||
|
select RESET_TI_SYSCON
|
||||||
help
|
help
|
||||||
This selects the Mediatek specific additions to UFSHCD platform driver.
|
This selects the Mediatek specific additions to UFSHCD platform driver.
|
||||||
UFS host on Mediatek needs some vendor specific configuration before
|
UFS host on Mediatek needs some vendor specific configuration before
|
||||||
|
@ -1068,9 +1068,38 @@ static int ufs_mtk_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
struct device_node *reset_node;
|
||||||
|
struct platform_device *reset_pdev;
|
||||||
|
struct device_link *link;
|
||||||
|
|
||||||
|
reset_node = of_find_compatible_node(NULL, NULL,
|
||||||
|
"ti,syscon-reset");
|
||||||
|
if (!reset_node) {
|
||||||
|
dev_notice(dev, "find ti,syscon-reset fail\n");
|
||||||
|
goto skip_reset;
|
||||||
|
}
|
||||||
|
reset_pdev = of_find_device_by_node(reset_node);
|
||||||
|
if (!reset_pdev) {
|
||||||
|
dev_notice(dev, "find reset_pdev fail\n");
|
||||||
|
goto skip_reset;
|
||||||
|
}
|
||||||
|
link = device_link_add(dev, &reset_pdev->dev,
|
||||||
|
DL_FLAG_AUTOPROBE_CONSUMER);
|
||||||
|
if (!link) {
|
||||||
|
dev_notice(dev, "add reset device_link fail\n");
|
||||||
|
goto skip_reset;
|
||||||
|
}
|
||||||
|
/* supplier is not probed */
|
||||||
|
if (link->status == DL_STATE_DORMANT) {
|
||||||
|
err = -EPROBE_DEFER;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
skip_reset:
|
||||||
/* perform generic probe */
|
/* perform generic probe */
|
||||||
err = ufshcd_pltfrm_init(pdev, &ufs_hba_mtk_vops);
|
err = ufshcd_pltfrm_init(pdev, &ufs_hba_mtk_vops);
|
||||||
|
|
||||||
|
out:
|
||||||
if (err)
|
if (err)
|
||||||
dev_info(dev, "probe failed %d\n", err);
|
dev_info(dev, "probe failed %d\n", err);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user