ethernet: stmmac: dwmac-rk: Add csu clock support
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com> Change-Id: I2498d053faf8c51f7c39ffd22e5f2bf6871d6a47
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/soc/rockchip/rk_vendor_storage.h>
|
||||
#include <soc/rockchip/rockchip_csu.h>
|
||||
#include "stmmac_platform.h"
|
||||
#include "dwmac-rk-tool.h"
|
||||
|
||||
@@ -80,6 +81,9 @@ struct rk_priv_data {
|
||||
|
||||
unsigned char otp_data;
|
||||
unsigned int bgs_increment;
|
||||
|
||||
struct csu_clk *csu_aclk;
|
||||
struct csu_clk *csu_pclk;
|
||||
};
|
||||
|
||||
/* XPCS */
|
||||
@@ -2322,6 +2326,21 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk_gmac_csu_init(struct plat_stmmacenet_data *plat)
|
||||
{
|
||||
struct rk_priv_data *bsp_priv = plat->bsp_priv;
|
||||
struct device *dev = &bsp_priv->pdev->dev;
|
||||
|
||||
bsp_priv->csu_aclk = rockchip_csu_get(dev, "aclk");
|
||||
if (IS_ERR(bsp_priv->csu_aclk))
|
||||
bsp_priv->csu_aclk = NULL;
|
||||
bsp_priv->csu_pclk = rockchip_csu_get(dev, "pclk");
|
||||
if (IS_ERR(bsp_priv->csu_pclk))
|
||||
bsp_priv->csu_pclk = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
|
||||
{
|
||||
int phy_iface = bsp_priv->phy_iface;
|
||||
@@ -2367,6 +2386,9 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
|
||||
bsp_priv->ops->set_clock_selection(bsp_priv,
|
||||
bsp_priv->clock_input, true);
|
||||
|
||||
rockchip_csu_disable(bsp_priv->csu_aclk);
|
||||
rockchip_csu_disable(bsp_priv->csu_pclk);
|
||||
|
||||
/**
|
||||
* if (!IS_ERR(bsp_priv->clk_mac))
|
||||
* clk_prepare_enable(bsp_priv->clk_mac);
|
||||
@@ -2402,6 +2424,9 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
|
||||
|
||||
clk_disable_unprepare(bsp_priv->clk_xpcs_eee);
|
||||
|
||||
rockchip_csu_enable(bsp_priv->csu_aclk);
|
||||
rockchip_csu_enable(bsp_priv->csu_pclk);
|
||||
|
||||
/**
|
||||
* if (!IS_ERR(bsp_priv->clk_mac))
|
||||
* clk_disable_unprepare(bsp_priv->clk_mac);
|
||||
@@ -2781,6 +2806,8 @@ static int rk_gmac_probe(struct platform_device *pdev)
|
||||
goto err_remove_config_dt;
|
||||
}
|
||||
|
||||
rk_gmac_csu_init(plat_dat);
|
||||
|
||||
ret = rk_gmac_clk_init(plat_dat);
|
||||
if (ret)
|
||||
goto err_remove_config_dt;
|
||||
|
||||
Reference in New Issue
Block a user