phy: uniphier-usb3hs: Add legacy SoC support for Pro5
Add legacy SoC support that needs to manage gio clock and reset. This supports Pro5. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:
parent
9376fa634a
commit
e68c2a8a2f
|
@ -66,13 +66,14 @@ struct uniphier_u3hsphy_trim_param {
|
||||||
struct uniphier_u3hsphy_priv {
|
struct uniphier_u3hsphy_priv {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct clk *clk, *clk_parent, *clk_ext;
|
struct clk *clk, *clk_parent, *clk_ext, *clk_parent_gio;
|
||||||
struct reset_control *rst, *rst_parent;
|
struct reset_control *rst, *rst_parent, *rst_parent_gio;
|
||||||
struct regulator *vbus;
|
struct regulator *vbus;
|
||||||
const struct uniphier_u3hsphy_soc_data *data;
|
const struct uniphier_u3hsphy_soc_data *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uniphier_u3hsphy_soc_data {
|
struct uniphier_u3hsphy_soc_data {
|
||||||
|
bool is_legacy;
|
||||||
int nparams;
|
int nparams;
|
||||||
const struct uniphier_u3hsphy_param param[MAX_PHY_PARAMS];
|
const struct uniphier_u3hsphy_param param[MAX_PHY_PARAMS];
|
||||||
u32 config0;
|
u32 config0;
|
||||||
|
@ -256,11 +257,20 @@ static int uniphier_u3hsphy_init(struct phy *phy)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = reset_control_deassert(priv->rst_parent);
|
ret = clk_prepare_enable(priv->clk_parent_gio);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_clk_disable;
|
goto out_clk_disable;
|
||||||
|
|
||||||
if (!priv->data->config0 && !priv->data->config1)
|
ret = reset_control_deassert(priv->rst_parent);
|
||||||
|
if (ret)
|
||||||
|
goto out_clk_gio_disable;
|
||||||
|
|
||||||
|
ret = reset_control_deassert(priv->rst_parent_gio);
|
||||||
|
if (ret)
|
||||||
|
goto out_rst_assert;
|
||||||
|
|
||||||
|
if ((priv->data->is_legacy)
|
||||||
|
|| (!priv->data->config0 && !priv->data->config1))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
config0 = priv->data->config0;
|
config0 = priv->data->config0;
|
||||||
|
@ -280,6 +290,8 @@ static int uniphier_u3hsphy_init(struct phy *phy)
|
||||||
|
|
||||||
out_rst_assert:
|
out_rst_assert:
|
||||||
reset_control_assert(priv->rst_parent);
|
reset_control_assert(priv->rst_parent);
|
||||||
|
out_clk_gio_disable:
|
||||||
|
clk_disable_unprepare(priv->clk_parent_gio);
|
||||||
out_clk_disable:
|
out_clk_disable:
|
||||||
clk_disable_unprepare(priv->clk_parent);
|
clk_disable_unprepare(priv->clk_parent);
|
||||||
|
|
||||||
|
@ -290,7 +302,9 @@ static int uniphier_u3hsphy_exit(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct uniphier_u3hsphy_priv *priv = phy_get_drvdata(phy);
|
struct uniphier_u3hsphy_priv *priv = phy_get_drvdata(phy);
|
||||||
|
|
||||||
|
reset_control_assert(priv->rst_parent_gio);
|
||||||
reset_control_assert(priv->rst_parent);
|
reset_control_assert(priv->rst_parent);
|
||||||
|
clk_disable_unprepare(priv->clk_parent_gio);
|
||||||
clk_disable_unprepare(priv->clk_parent);
|
clk_disable_unprepare(priv->clk_parent);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -325,22 +339,34 @@ static int uniphier_u3hsphy_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(priv->base))
|
if (IS_ERR(priv->base))
|
||||||
return PTR_ERR(priv->base);
|
return PTR_ERR(priv->base);
|
||||||
|
|
||||||
priv->clk = devm_clk_get(dev, "phy");
|
if (!priv->data->is_legacy) {
|
||||||
if (IS_ERR(priv->clk))
|
priv->clk = devm_clk_get(dev, "phy");
|
||||||
return PTR_ERR(priv->clk);
|
if (IS_ERR(priv->clk))
|
||||||
|
return PTR_ERR(priv->clk);
|
||||||
|
|
||||||
|
priv->clk_ext = devm_clk_get_optional(dev, "phy-ext");
|
||||||
|
if (IS_ERR(priv->clk_ext))
|
||||||
|
return PTR_ERR(priv->clk_ext);
|
||||||
|
|
||||||
|
priv->rst = devm_reset_control_get_shared(dev, "phy");
|
||||||
|
if (IS_ERR(priv->rst))
|
||||||
|
return PTR_ERR(priv->rst);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
priv->clk_parent_gio = devm_clk_get(dev, "gio");
|
||||||
|
if (IS_ERR(priv->clk_parent_gio))
|
||||||
|
return PTR_ERR(priv->clk_parent_gio);
|
||||||
|
|
||||||
|
priv->rst_parent_gio =
|
||||||
|
devm_reset_control_get_shared(dev, "gio");
|
||||||
|
if (IS_ERR(priv->rst_parent_gio))
|
||||||
|
return PTR_ERR(priv->rst_parent_gio);
|
||||||
|
}
|
||||||
|
|
||||||
priv->clk_parent = devm_clk_get(dev, "link");
|
priv->clk_parent = devm_clk_get(dev, "link");
|
||||||
if (IS_ERR(priv->clk_parent))
|
if (IS_ERR(priv->clk_parent))
|
||||||
return PTR_ERR(priv->clk_parent);
|
return PTR_ERR(priv->clk_parent);
|
||||||
|
|
||||||
priv->clk_ext = devm_clk_get_optional(dev, "phy-ext");
|
|
||||||
if (IS_ERR(priv->clk_ext))
|
|
||||||
return PTR_ERR(priv->clk_ext);
|
|
||||||
|
|
||||||
priv->rst = devm_reset_control_get_shared(dev, "phy");
|
|
||||||
if (IS_ERR(priv->rst))
|
|
||||||
return PTR_ERR(priv->rst);
|
|
||||||
|
|
||||||
priv->rst_parent = devm_reset_control_get_shared(dev, "link");
|
priv->rst_parent = devm_reset_control_get_shared(dev, "link");
|
||||||
if (IS_ERR(priv->rst_parent))
|
if (IS_ERR(priv->rst_parent))
|
||||||
return PTR_ERR(priv->rst_parent);
|
return PTR_ERR(priv->rst_parent);
|
||||||
|
@ -362,11 +388,18 @@ static int uniphier_u3hsphy_probe(struct platform_device *pdev)
|
||||||
return PTR_ERR_OR_ZERO(phy_provider);
|
return PTR_ERR_OR_ZERO(phy_provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct uniphier_u3hsphy_soc_data uniphier_pro5_data = {
|
||||||
|
.is_legacy = true,
|
||||||
|
.nparams = 0,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct uniphier_u3hsphy_soc_data uniphier_pxs2_data = {
|
static const struct uniphier_u3hsphy_soc_data uniphier_pxs2_data = {
|
||||||
|
.is_legacy = false,
|
||||||
.nparams = 0,
|
.nparams = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct uniphier_u3hsphy_soc_data uniphier_ld20_data = {
|
static const struct uniphier_u3hsphy_soc_data uniphier_ld20_data = {
|
||||||
|
.is_legacy = false,
|
||||||
.nparams = 2,
|
.nparams = 2,
|
||||||
.param = {
|
.param = {
|
||||||
{ LS_SLEW, 1 },
|
{ LS_SLEW, 1 },
|
||||||
|
@ -378,6 +411,7 @@ static const struct uniphier_u3hsphy_soc_data uniphier_ld20_data = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct uniphier_u3hsphy_soc_data uniphier_pxs3_data = {
|
static const struct uniphier_u3hsphy_soc_data uniphier_pxs3_data = {
|
||||||
|
.is_legacy = false,
|
||||||
.nparams = 0,
|
.nparams = 0,
|
||||||
.trim_func = uniphier_u3hsphy_trim_ld20,
|
.trim_func = uniphier_u3hsphy_trim_ld20,
|
||||||
.config0 = 0x92316680,
|
.config0 = 0x92316680,
|
||||||
|
@ -385,6 +419,10 @@ static const struct uniphier_u3hsphy_soc_data uniphier_pxs3_data = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id uniphier_u3hsphy_match[] = {
|
static const struct of_device_id uniphier_u3hsphy_match[] = {
|
||||||
|
{
|
||||||
|
.compatible = "socionext,uniphier-pro5-usb3-hsphy",
|
||||||
|
.data = &uniphier_pro5_data,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.compatible = "socionext,uniphier-pxs2-usb3-hsphy",
|
.compatible = "socionext,uniphier-pxs2-usb3-hsphy",
|
||||||
.data = &uniphier_pxs2_data,
|
.data = &uniphier_pxs2_data,
|
||||||
|
|
Loading…
Reference in New Issue