Lines Matching refs:imx8_phy

77 	struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy);  in imx8_pcie_phy_power_on()  local
79 pad_mode = imx8_phy->refclk_pad_mode; in imx8_pcie_phy_power_on()
80 switch (imx8_phy->drvdata->variant) { in imx8_pcie_phy_power_on()
82 reset_control_assert(imx8_phy->reset); in imx8_pcie_phy_power_on()
85 if (imx8_phy->tx_deemph_gen1) in imx8_pcie_phy_power_on()
86 writel(imx8_phy->tx_deemph_gen1, in imx8_pcie_phy_power_on()
87 imx8_phy->base + PCIE_PHY_TRSV_REG5); in imx8_pcie_phy_power_on()
88 if (imx8_phy->tx_deemph_gen2) in imx8_pcie_phy_power_on()
89 writel(imx8_phy->tx_deemph_gen2, in imx8_pcie_phy_power_on()
90 imx8_phy->base + PCIE_PHY_TRSV_REG6); in imx8_pcie_phy_power_on()
99 val = readl(imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061); in imx8_pcie_phy_power_on()
101 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061); in imx8_pcie_phy_power_on()
105 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG061); in imx8_pcie_phy_power_on()
112 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG062); in imx8_pcie_phy_power_on()
113 if (imx8_phy->drvdata->variant != IMX8MM) { in imx8_pcie_phy_power_on()
115 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG063); in imx8_pcie_phy_power_on()
119 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG064); in imx8_pcie_phy_power_on()
121 imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG065); in imx8_pcie_phy_power_on()
125 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
127 imx8_phy->clkreq_unused ? in imx8_pcie_phy_power_on()
129 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
132 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
134 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
137 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
145 regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, in imx8_pcie_phy_power_on()
149 switch (imx8_phy->drvdata->variant) { in imx8_pcie_phy_power_on()
151 reset_control_deassert(imx8_phy->perst); in imx8_pcie_phy_power_on()
154 reset_control_deassert(imx8_phy->reset); in imx8_pcie_phy_power_on()
160 ret = readl_poll_timeout(imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG075, in imx8_pcie_phy_power_on()
167 struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); in imx8_pcie_phy_init() local
169 return clk_prepare_enable(imx8_phy->clk); in imx8_pcie_phy_init()
174 struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); in imx8_pcie_phy_exit() local
176 clk_disable_unprepare(imx8_phy->clk); in imx8_pcie_phy_exit()
210 struct imx8_pcie_phy *imx8_phy; in imx8_pcie_phy_probe() local
212 imx8_phy = devm_kzalloc(dev, sizeof(*imx8_phy), GFP_KERNEL); in imx8_pcie_phy_probe()
213 if (!imx8_phy) in imx8_pcie_phy_probe()
216 imx8_phy->drvdata = of_device_get_match_data(dev); in imx8_pcie_phy_probe()
220 &imx8_phy->refclk_pad_mode); in imx8_pcie_phy_probe()
223 &imx8_phy->tx_deemph_gen1)) in imx8_pcie_phy_probe()
224 imx8_phy->tx_deemph_gen1 = 0; in imx8_pcie_phy_probe()
227 &imx8_phy->tx_deemph_gen2)) in imx8_pcie_phy_probe()
228 imx8_phy->tx_deemph_gen2 = 0; in imx8_pcie_phy_probe()
231 imx8_phy->clkreq_unused = true; in imx8_pcie_phy_probe()
233 imx8_phy->clkreq_unused = false; in imx8_pcie_phy_probe()
235 imx8_phy->clk = devm_clk_get(dev, "ref"); in imx8_pcie_phy_probe()
236 if (IS_ERR(imx8_phy->clk)) { in imx8_pcie_phy_probe()
238 return PTR_ERR(imx8_phy->clk); in imx8_pcie_phy_probe()
242 imx8_phy->iomuxc_gpr = in imx8_pcie_phy_probe()
243 syscon_regmap_lookup_by_compatible(imx8_phy->drvdata->gpr); in imx8_pcie_phy_probe()
244 if (IS_ERR(imx8_phy->iomuxc_gpr)) { in imx8_pcie_phy_probe()
246 return PTR_ERR(imx8_phy->iomuxc_gpr); in imx8_pcie_phy_probe()
249 imx8_phy->reset = devm_reset_control_get_exclusive(dev, "pciephy"); in imx8_pcie_phy_probe()
250 if (IS_ERR(imx8_phy->reset)) { in imx8_pcie_phy_probe()
252 return PTR_ERR(imx8_phy->reset); in imx8_pcie_phy_probe()
255 if (imx8_phy->drvdata->variant == IMX8MP) { in imx8_pcie_phy_probe()
256 imx8_phy->perst = in imx8_pcie_phy_probe()
258 if (IS_ERR(imx8_phy->perst)) in imx8_pcie_phy_probe()
259 return dev_err_probe(dev, PTR_ERR(imx8_phy->perst), in imx8_pcie_phy_probe()
263 imx8_phy->base = devm_platform_ioremap_resource(pdev, 0); in imx8_pcie_phy_probe()
264 if (IS_ERR(imx8_phy->base)) in imx8_pcie_phy_probe()
265 return PTR_ERR(imx8_phy->base); in imx8_pcie_phy_probe()
267 imx8_phy->phy = devm_phy_create(dev, NULL, &imx8_pcie_phy_ops); in imx8_pcie_phy_probe()
268 if (IS_ERR(imx8_phy->phy)) in imx8_pcie_phy_probe()
269 return PTR_ERR(imx8_phy->phy); in imx8_pcie_phy_probe()
271 phy_set_drvdata(imx8_phy->phy, imx8_phy); in imx8_pcie_phy_probe()