Lines Matching +full:ufshcd +full:- +full:pltfrm
1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <linux/arm-smccc.h>
17 #include <ufs/ufshcd.h>
18 #include "ufshcd-pltfrm.h"
19 #include "ufs-sprd.h"
27 WARN_ON(!host->priv); in ufs_sprd_get_priv_data()
28 return host->priv; in ufs_sprd_get_priv_data()
34 regmap_update_bits(priv->sysci[index].regmap, reg, bits, val); in ufs_sprd_regmap_update()
40 regmap_read(priv->sysci[index].regmap, reg, val); in ufs_sprd_regmap_read()
47 if (ufshcd_dme_get(hba, UIC_ARG_MIB(PA_LOCALVERINFO), &host->unipro_ver)) in ufs_sprd_get_unipro_ver()
48 host->unipro_ver = 0; in ufs_sprd_get_unipro_ver()
64 rci->rc = devm_reset_control_get(dev, rci->name); in ufs_sprd_get_reset_ctrl()
65 if (IS_ERR(rci->rc)) { in ufs_sprd_get_reset_ctrl()
66 dev_err(dev, "failed to get reset ctrl:%s\n", rci->name); in ufs_sprd_get_reset_ctrl()
67 return PTR_ERR(rci->rc); in ufs_sprd_get_reset_ctrl()
75 sysci->regmap = syscon_regmap_lookup_by_phandle(dev->of_node, sysci->name); in ufs_sprd_get_syscon_reg()
76 if (IS_ERR(sysci->regmap)) { in ufs_sprd_get_syscon_reg()
77 dev_err(dev, "failed to get ufs syscon:%s\n", sysci->name); in ufs_sprd_get_syscon_reg()
78 return PTR_ERR(sysci->regmap); in ufs_sprd_get_syscon_reg()
86 vregi->vreg = devm_regulator_get(dev, vregi->name); in ufs_sprd_get_vreg()
87 if (IS_ERR(vregi->vreg)) { in ufs_sprd_get_vreg()
88 dev_err(dev, "failed to get vreg:%s\n", vregi->name); in ufs_sprd_get_vreg()
89 return PTR_ERR(vregi->vreg); in ufs_sprd_get_vreg()
98 struct ufs_sprd_priv *priv = host->priv; in ufs_sprd_parse_dt()
103 if (!priv->rci[i].name) in ufs_sprd_parse_dt()
105 ret = ufs_sprd_get_reset_ctrl(dev, &priv->rci[i]); in ufs_sprd_parse_dt()
112 if (!priv->sysci[i].name) in ufs_sprd_parse_dt()
114 ret = ufs_sprd_get_syscon_reg(dev, &priv->sysci[i]); in ufs_sprd_parse_dt()
121 if (!priv->vregi[i].name) in ufs_sprd_parse_dt()
123 ret = ufs_sprd_get_vreg(dev, &priv->vregi[i]); in ufs_sprd_parse_dt()
134 struct device *dev = hba->dev; in ufs_sprd_common_init()
142 return -ENOMEM; in ufs_sprd_common_init()
144 of_id = of_match_node(ufs_sprd_of_match, pdev->dev.of_node); in ufs_sprd_common_init()
145 if (of_id->data != NULL) in ufs_sprd_common_init()
146 host->priv = container_of(of_id->data, struct ufs_sprd_priv, in ufs_sprd_common_init()
149 host->hba = hba; in ufs_sprd_common_init()
152 hba->caps |= UFSHCD_CAP_CLK_GATING | in ufs_sprd_common_init()
155 hba->quirks |= UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS; in ufs_sprd_common_init()
172 if (host->unipro_ver >= UFS_UNIPRO_VER_1_8) in sprd_ufs_pwr_change_notify()
173 ufshcd_dme_configure_adapt(hba, dev_req_params->gear_tx, in sprd_ufs_pwr_change_notify()
187 spin_lock_irqsave(hba->host->host_lock, flags); in ufs_sprd_suspend()
189 spin_unlock_irqrestore(hba->host->host_lock, flags); in ufs_sprd_suspend()
200 dev_info(hba->dev, "ufs host reset!\n"); in ufs_sprd_n6_host_reset()
202 reset_control_assert(priv->rci[SPRD_UFSHCI_SOFT_RST].rc); in ufs_sprd_n6_host_reset()
204 reset_control_deassert(priv->rci[SPRD_UFSHCI_SOFT_RST].rc); in ufs_sprd_n6_host_reset()
211 dev_info(hba->dev, "ufs device reset!\n"); in ufs_sprd_n6_device_reset()
213 reset_control_assert(priv->rci[SPRD_UFS_DEV_RST].rc); in ufs_sprd_n6_device_reset()
215 reset_control_deassert(priv->rci[SPRD_UFS_DEV_RST].rc); in ufs_sprd_n6_device_reset()
235 retry--; in ufs_sprd_n6_key_acc_enable()
247 dev_err(hba->dev, "key reg access enable fail, disable crypto\n"); in ufs_sprd_n6_key_acc_enable()
248 hba->caps &= ~UFSHCD_CAP_CRYPTO; in ufs_sprd_n6_key_acc_enable()
262 ret = regulator_enable(priv->vregi[SPRD_UFS_VDD_MPHY].vreg); in ufs_sprd_n6_init()
264 return -ENODEV; in ufs_sprd_n6_init()
266 if (hba->caps & UFSHCD_CAP_CRYPTO) in ufs_sprd_n6_init()
306 retry--; in ufs_sprd_n6_phy_init()
309 ret = -ETIMEDOUT; in ufs_sprd_n6_phy_init()
336 if (hba->caps & UFSHCD_CAP_CRYPTO) in sprd_ufs_n6_hce_enable_notify()
343 dev_err(hba->dev, "Phy setup failed (%d)\n", err); in sprd_ufs_n6_hce_enable_notify()
392 .sysci[SPRD_UFS_ANLG] = { .name = "sprd,ufs-anlg-syscon", },
393 .sysci[SPRD_UFS_AON_APB] = { .name = "sprd,aon-apb-syscon", },
395 .vregi[SPRD_UFS_VDD_MPHY] = { .name = "vdd-mphy", },
398 .name = "sprd,ums9620-ufs",
409 { .compatible = "sprd,ums9620-ufs", .data = &n6_ufs.ufs_hba_sprd_vops},
417 struct device *dev = &pdev->dev; in ufs_sprd_probe()
420 of_id = of_match_node(ufs_sprd_of_match, dev->of_node); in ufs_sprd_probe()
421 err = ufshcd_pltfrm_init(pdev, of_id->data); in ufs_sprd_probe()
432 pm_runtime_get_sync(&(pdev)->dev); in ufs_sprd_remove()
447 .name = "ufshcd-sprd",