Skip to content

Commit e68c2a8

Browse files
khayash1kishon
authored andcommitted
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>
1 parent 9376fa6 commit e68c2a8

1 file changed

Lines changed: 53 additions & 15 deletions

File tree

‎drivers/phy/socionext/phy-uniphier-usb3hs.c‎

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ struct uniphier_u3hsphy_trim_param {
6666
struct uniphier_u3hsphy_priv {
6767
struct device *dev;
6868
void __iomem *base;
69-
struct clk *clk, *clk_parent, *clk_ext;
70-
struct reset_control *rst, *rst_parent;
69+
struct clk *clk, *clk_parent, *clk_ext, *clk_parent_gio;
70+
struct reset_control *rst, *rst_parent, *rst_parent_gio;
7171
struct regulator *vbus;
7272
const struct uniphier_u3hsphy_soc_data *data;
7373
};
7474

7575
struct uniphier_u3hsphy_soc_data {
76+
bool is_legacy;
7677
int nparams;
7778
const struct uniphier_u3hsphy_param param[MAX_PHY_PARAMS];
7879
u32 config0;
@@ -256,11 +257,20 @@ static int uniphier_u3hsphy_init(struct phy *phy)
256257
if (ret)
257258
return ret;
258259

259-
ret = reset_control_deassert(priv->rst_parent);
260+
ret = clk_prepare_enable(priv->clk_parent_gio);
260261
if (ret)
261262
goto out_clk_disable;
262263

263-
if (!priv->data->config0 && !priv->data->config1)
264+
ret = reset_control_deassert(priv->rst_parent);
265+
if (ret)
266+
goto out_clk_gio_disable;
267+
268+
ret = reset_control_deassert(priv->rst_parent_gio);
269+
if (ret)
270+
goto out_rst_assert;
271+
272+
if ((priv->data->is_legacy)
273+
|| (!priv->data->config0 && !priv->data->config1))
264274
return 0;
265275

266276
config0 = priv->data->config0;
@@ -280,6 +290,8 @@ static int uniphier_u3hsphy_init(struct phy *phy)
280290

281291
out_rst_assert:
282292
reset_control_assert(priv->rst_parent);
293+
out_clk_gio_disable:
294+
clk_disable_unprepare(priv->clk_parent_gio);
283295
out_clk_disable:
284296
clk_disable_unprepare(priv->clk_parent);
285297

@@ -290,7 +302,9 @@ static int uniphier_u3hsphy_exit(struct phy *phy)
290302
{
291303
struct uniphier_u3hsphy_priv *priv = phy_get_drvdata(phy);
292304

305+
reset_control_assert(priv->rst_parent_gio);
293306
reset_control_assert(priv->rst_parent);
307+
clk_disable_unprepare(priv->clk_parent_gio);
294308
clk_disable_unprepare(priv->clk_parent);
295309

296310
return 0;
@@ -325,22 +339,34 @@ static int uniphier_u3hsphy_probe(struct platform_device *pdev)
325339
if (IS_ERR(priv->base))
326340
return PTR_ERR(priv->base);
327341

328-
priv->clk = devm_clk_get(dev, "phy");
329-
if (IS_ERR(priv->clk))
330-
return PTR_ERR(priv->clk);
342+
if (!priv->data->is_legacy) {
343+
priv->clk = devm_clk_get(dev, "phy");
344+
if (IS_ERR(priv->clk))
345+
return PTR_ERR(priv->clk);
346+
347+
priv->clk_ext = devm_clk_get_optional(dev, "phy-ext");
348+
if (IS_ERR(priv->clk_ext))
349+
return PTR_ERR(priv->clk_ext);
350+
351+
priv->rst = devm_reset_control_get_shared(dev, "phy");
352+
if (IS_ERR(priv->rst))
353+
return PTR_ERR(priv->rst);
354+
355+
} else {
356+
priv->clk_parent_gio = devm_clk_get(dev, "gio");
357+
if (IS_ERR(priv->clk_parent_gio))
358+
return PTR_ERR(priv->clk_parent_gio);
359+
360+
priv->rst_parent_gio =
361+
devm_reset_control_get_shared(dev, "gio");
362+
if (IS_ERR(priv->rst_parent_gio))
363+
return PTR_ERR(priv->rst_parent_gio);
364+
}
331365

332366
priv->clk_parent = devm_clk_get(dev, "link");
333367
if (IS_ERR(priv->clk_parent))
334368
return PTR_ERR(priv->clk_parent);
335369

336-
priv->clk_ext = devm_clk_get_optional(dev, "phy-ext");
337-
if (IS_ERR(priv->clk_ext))
338-
return PTR_ERR(priv->clk_ext);
339-
340-
priv->rst = devm_reset_control_get_shared(dev, "phy");
341-
if (IS_ERR(priv->rst))
342-
return PTR_ERR(priv->rst);
343-
344370
priv->rst_parent = devm_reset_control_get_shared(dev, "link");
345371
if (IS_ERR(priv->rst_parent))
346372
return PTR_ERR(priv->rst_parent);
@@ -362,11 +388,18 @@ static int uniphier_u3hsphy_probe(struct platform_device *pdev)
362388
return PTR_ERR_OR_ZERO(phy_provider);
363389
}
364390

391+
static const struct uniphier_u3hsphy_soc_data uniphier_pro5_data = {
392+
.is_legacy = true,
393+
.nparams = 0,
394+
};
395+
365396
static const struct uniphier_u3hsphy_soc_data uniphier_pxs2_data = {
397+
.is_legacy = false,
366398
.nparams = 0,
367399
};
368400

369401
static const struct uniphier_u3hsphy_soc_data uniphier_ld20_data = {
402+
.is_legacy = false,
370403
.nparams = 2,
371404
.param = {
372405
{ LS_SLEW, 1 },
@@ -378,13 +411,18 @@ static const struct uniphier_u3hsphy_soc_data uniphier_ld20_data = {
378411
};
379412

380413
static const struct uniphier_u3hsphy_soc_data uniphier_pxs3_data = {
414+
.is_legacy = false,
381415
.nparams = 0,
382416
.trim_func = uniphier_u3hsphy_trim_ld20,
383417
.config0 = 0x92316680,
384418
.config1 = 0x00000106,
385419
};
386420

387421
static const struct of_device_id uniphier_u3hsphy_match[] = {
422+
{
423+
.compatible = "socionext,uniphier-pro5-usb3-hsphy",
424+
.data = &uniphier_pro5_data,
425+
},
388426
{
389427
.compatible = "socionext,uniphier-pxs2-usb3-hsphy",
390428
.data = &uniphier_pxs2_data,

0 commit comments

Comments
 (0)