Lines Matching +full:2 +full:x32 +full:- +full:bit

1 // SPDX-License-Identifier: GPL-2.0+
10 #include <linux/clk-provider.h>
44 #define REG21_SEL_TX_CK_INV BIT(7)
66 #define REG33_MODE_SET_DONE BIT(7)
67 #define REG33_FIX_DA BIT(1)
70 #define REG34_PHY_READY BIT(7)
71 #define REG34_PLL_LOCK BIT(6)
72 #define REG34_PHY_CLK_READY BIT(5)
233 .pll_div_regs = { 0x4e, 0x32, 0xa7, 0x10, 0x80, 0x40 },
242 .pll_div_regs = { 0x52, 0x32, 0x82, 0x01, 0x88, 0x47 },
251 .pll_div_regs = { 0x55, 0x32, 0x8c, 0x05, 0x90, 0x4b },
254 .pll_div_regs = { 0x57, 0x32, 0x98, 0x07, 0x90, 0x49 },
257 .pll_div_regs = { 0x58, 0x32, 0x84, 0x03, 0x82, 0x41 },
260 .pll_div_regs = { 0x5a, 0x32, 0x89, 0x88, 0x80, 0x40 },
266 .pll_div_regs = { 0x5a, 0x32, 0xfd, 0x0c, 0x80, 0x40 },
382 { PHY_REG_22, 0x30 }, { PHY_REG_23, 0x32 },
420 switch (cfg->pixclk) { in fsl_samsung_hdmi_phy_configure_pixclk()
445 phy->regs + PHY_REG_21); in fsl_samsung_hdmi_phy_configure_pixclk()
452 u32 pclk = cfg->pixclk; in fsl_samsung_hdmi_phy_configure_pll_lock_det()
457 switch (cfg->pixclk) { in fsl_samsung_hdmi_phy_configure_pll_lock_det()
462 div = 2; in fsl_samsung_hdmi_phy_configure_pll_lock_det()
472 writeb(FIELD_PREP(REG12_CK_DIV_MASK, ilog2(div)), phy->regs + PHY_REG_12); in fsl_samsung_hdmi_phy_configure_pll_lock_det()
479 * 2nd) Increase resolution to avoid rounding issues in fsl_samsung_hdmi_phy_configure_pll_lock_det()
492 phy->regs + PHY_REG_13); in fsl_samsung_hdmi_phy_configure_pll_lock_det()
493 writeb(FIELD_PREP(REG14_TOL_MASK, 2) | in fsl_samsung_hdmi_phy_configure_pll_lock_det()
494 FIELD_PREP(REG14_RP_CODE_MASK, 2) | in fsl_samsung_hdmi_phy_configure_pll_lock_det()
496 phy->regs + PHY_REG_14); in fsl_samsung_hdmi_phy_configure_pll_lock_det()
506 writeb(REG33_FIX_DA, phy->regs + PHY_REG_33); in fsl_samsung_hdmi_phy_configure()
510 writeb(common_phy_cfg[i].val, phy->regs + common_phy_cfg[i].reg); in fsl_samsung_hdmi_phy_configure()
514 writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG_02 + i * 4); in fsl_samsung_hdmi_phy_configure()
519 writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG_33); in fsl_samsung_hdmi_phy_configure()
521 ret = readb_poll_timeout(phy->regs + PHY_REG_34, val, in fsl_samsung_hdmi_phy_configure()
524 dev_err(phy->dev, "PLL failed to lock\n"); in fsl_samsung_hdmi_phy_configure()
534 if (!phy->cur_cfg) in phy_clk_recalc_rate()
537 return phy->cur_cfg->pixclk; in phy_clk_recalc_rate()
545 for (i = ARRAY_SIZE(phy_pll_cfg) - 1; i >= 0; i--) in phy_clk_round_rate()
549 return -EINVAL; in phy_clk_round_rate()
558 for (i = ARRAY_SIZE(phy_pll_cfg) - 1; i >= 0; i--) in phy_clk_set_rate()
563 return -EINVAL; in phy_clk_set_rate()
565 phy->cur_cfg = &phy_pll_cfg[i]; in phy_clk_set_rate()
567 return fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); in phy_clk_set_rate()
578 struct device *dev = phy->dev; in phy_clk_register()
579 struct device_node *np = dev->of_node; in phy_clk_register()
585 parent_name = __clk_get_name(phy->refclk); in phy_clk_register()
593 phy->hw.init = &init; in phy_clk_register()
595 phyclk = devm_clk_register(dev, &phy->hw); in phy_clk_register()
613 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); in fsl_samsung_hdmi_phy_probe()
615 return -ENOMEM; in fsl_samsung_hdmi_phy_probe()
618 phy->dev = &pdev->dev; in fsl_samsung_hdmi_phy_probe()
620 phy->regs = devm_platform_ioremap_resource(pdev, 0); in fsl_samsung_hdmi_phy_probe()
621 if (IS_ERR(phy->regs)) in fsl_samsung_hdmi_phy_probe()
622 return PTR_ERR(phy->regs); in fsl_samsung_hdmi_phy_probe()
624 phy->apbclk = devm_clk_get(phy->dev, "apb"); in fsl_samsung_hdmi_phy_probe()
625 if (IS_ERR(phy->apbclk)) in fsl_samsung_hdmi_phy_probe()
626 return dev_err_probe(phy->dev, PTR_ERR(phy->apbclk), in fsl_samsung_hdmi_phy_probe()
629 phy->refclk = devm_clk_get(phy->dev, "ref"); in fsl_samsung_hdmi_phy_probe()
630 if (IS_ERR(phy->refclk)) in fsl_samsung_hdmi_phy_probe()
631 return dev_err_probe(phy->dev, PTR_ERR(phy->refclk), in fsl_samsung_hdmi_phy_probe()
634 ret = clk_prepare_enable(phy->apbclk); in fsl_samsung_hdmi_phy_probe()
636 dev_err(phy->dev, "failed to enable apbclk\n"); in fsl_samsung_hdmi_phy_probe()
640 pm_runtime_get_noresume(phy->dev); in fsl_samsung_hdmi_phy_probe()
641 pm_runtime_set_active(phy->dev); in fsl_samsung_hdmi_phy_probe()
642 pm_runtime_enable(phy->dev); in fsl_samsung_hdmi_phy_probe()
646 dev_err(&pdev->dev, "register clk failed\n"); in fsl_samsung_hdmi_phy_probe()
650 pm_runtime_put(phy->dev); in fsl_samsung_hdmi_phy_probe()
655 clk_disable_unprepare(phy->apbclk); in fsl_samsung_hdmi_phy_probe()
662 of_clk_del_provider(pdev->dev.of_node); in fsl_samsung_hdmi_phy_remove()
669 clk_disable_unprepare(phy->apbclk); in fsl_samsung_hdmi_phy_suspend()
679 ret = clk_prepare_enable(phy->apbclk); in fsl_samsung_hdmi_phy_resume()
681 dev_err(phy->dev, "failed to enable apbclk\n"); in fsl_samsung_hdmi_phy_resume()
685 if (phy->cur_cfg) in fsl_samsung_hdmi_phy_resume()
686 ret = fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); in fsl_samsung_hdmi_phy_resume()
698 .compatible = "fsl,imx8mp-hdmi-phy",
709 .name = "fsl-samsung-hdmi-phy",