phy: rockchip-samsung-hdptx-hdmi: register clk in child device

In uboot, a device can't be used as both phy device and clock
device. So It better to register a child device as clock device.

Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: I6d06f3c3b0f0b48741a5c53f51df1766b2cb0740
This commit is contained in:
Zhang Yubing
2022-05-26 15:32:17 +08:00
committed by Tao Huang
parent 9afbb1484f
commit 9be2da2d2f

View File

@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/reset.h>
#include <linux/mfd/syscon.h>
#include <linux/phy/phy.h>
@@ -2143,11 +2144,21 @@ static int rockchip_hdptx_phy_clk_register(struct rockchip_hdptx_phy *hdptx)
{
struct device *dev = hdptx->dev;
struct device_node *np = dev->of_node;
struct device_node *clk_np;
struct platform_device *pdev;
struct clk_init_data init = {};
struct clk *refclk;
const char *parent_name;
int ret;
clk_np = of_get_child_by_name(np, "clk-port");
if (!clk_np)
return 0;
pdev = of_platform_device_create(clk_np, NULL, dev);
if (!pdev)
return 0;
refclk = devm_clk_get(dev, "ref");
if (IS_ERR(refclk)) {
dev_err(dev, "failed to get ref clock\n");
@@ -2170,14 +2181,14 @@ static int rockchip_hdptx_phy_clk_register(struct rockchip_hdptx_phy *hdptx)
hdptx->hw.init = &init;
hdptx->dclk = devm_clk_register(dev, &hdptx->hw);
hdptx->dclk = devm_clk_register(&pdev->dev, &hdptx->hw);
if (IS_ERR(hdptx->dclk)) {
ret = PTR_ERR(hdptx->dclk);
dev_err(dev, "failed to register clock: %d\n", ret);
return ret;
}
ret = of_clk_add_provider(np, of_clk_src_simple_get, hdptx->dclk);
ret = of_clk_add_provider(clk_np, of_clk_src_simple_get, hdptx->dclk);
if (ret) {
dev_err(dev, "failed to register OF clock provider: %d\n", ret);
return ret;