mirror of
https://github.com/armbian/build.git
synced 2025-08-11 05:36:57 +02:00
131 lines
4.8 KiB
Diff
131 lines
4.8 KiB
Diff
From 44db0a603f48f39f5bb38ffd1b173d7c7036357b Mon Sep 17 00:00:00 2001
|
|
From: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Date: Mon, 6 Dec 2021 04:25:36 +0000
|
|
Subject: [PATCH 33/90] FROMLIST(v4): phy: amlogic: phy-meson-gxl-usb2: fix
|
|
shared reset controller use
|
|
|
|
Use reset_control_rearm() call if an error occurs in case
|
|
phy_meson_gxl_usb2_init() fails after reset() has been called ; or in case
|
|
phy_meson_gxl_usb2_exit() is called i.e the resource is no longer used
|
|
and the reset line may be triggered again by other devices.
|
|
|
|
reset_control_rearm() keeps use of triggered_count sane in the reset
|
|
framework. Therefore, use of reset_control_reset() on shared reset line
|
|
should be balanced with reset_control_rearm().
|
|
|
|
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Reported-by: Jerome Brunet <jbrunet@baylibre.com>
|
|
---
|
|
drivers/phy/amlogic/phy-meson-gxl-usb2.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
|
|
index 2b3c0d730f20..d2f56075dc57 100644
|
|
--- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c
|
|
+++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
|
|
@@ -125,6 +125,7 @@ static int phy_meson_gxl_usb2_exit(struct phy *phy)
|
|
struct phy_meson_gxl_usb2_priv *priv = phy_get_drvdata(phy);
|
|
|
|
clk_disable_unprepare(priv->clk);
|
|
+ reset_control_rearm(priv->reset);
|
|
|
|
return 0;
|
|
}
|
|
--
|
|
2.35.1
|
|
|
|
From 2639df70052725a687b1bd5c2db17af72a02cf12 Mon Sep 17 00:00:00 2001
|
|
From: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Date: Mon, 6 Dec 2021 04:26:22 +0000
|
|
Subject: [PATCH 34/90] FROMLIST(v4): phy: amlogic: meson8b-usb2: Use
|
|
dev_err_probe()
|
|
|
|
Use the existing dev_err_probe() helper instead of open-coding the same
|
|
operation.
|
|
|
|
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
|
---
|
|
drivers/phy/amlogic/phy-meson8b-usb2.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
index cf10bed40528..77e7e9b1428c 100644
|
|
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
@@ -265,8 +265,9 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev)
|
|
return PTR_ERR(priv->clk_usb);
|
|
|
|
priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
|
|
- if (PTR_ERR(priv->reset) == -EPROBE_DEFER)
|
|
- return PTR_ERR(priv->reset);
|
|
+ if (IS_ERR(priv->reset))
|
|
+ return dev_err_probe(&pdev->dev, PTR_ERR(priv->reset),
|
|
+ "Failed to get the reset line");
|
|
|
|
priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1);
|
|
if (priv->dr_mode == USB_DR_MODE_UNKNOWN) {
|
|
--
|
|
2.35.1
|
|
|
|
From eef11c571c63f09b64850e1c6994388822a869eb Mon Sep 17 00:00:00 2001
|
|
From: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Date: Mon, 6 Dec 2021 04:27:13 +0000
|
|
Subject: [PATCH 35/90] FROMLIST(v4): phy: amlogic: meson8b-usb2: fix shared
|
|
reset control use
|
|
|
|
Use reset_control_rearm() call if an error occurs in case
|
|
phy_meson8b_usb2_power_on() fails after reset() has been called, or in
|
|
case phy_meson8b_usb2_power_off() is called i.e the resource is no longer
|
|
used and the reset line may be triggered again by other devices.
|
|
|
|
reset_control_rearm() keeps use of triggered_count sane in the reset
|
|
framework, use of reset_control_reset() on shared reset line should
|
|
be balanced with reset_control_rearm().
|
|
|
|
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
|
|
Reported-by: Jerome Brunet <jbrunet@baylibre.com>
|
|
---
|
|
drivers/phy/amlogic/phy-meson8b-usb2.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
index 77e7e9b1428c..dd96763911b8 100644
|
|
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
|
|
@@ -154,6 +154,7 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
|
|
ret = clk_prepare_enable(priv->clk_usb_general);
|
|
if (ret) {
|
|
dev_err(&phy->dev, "Failed to enable USB general clock\n");
|
|
+ reset_control_rearm(priv->reset);
|
|
return ret;
|
|
}
|
|
|
|
@@ -161,6 +162,7 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
|
|
if (ret) {
|
|
dev_err(&phy->dev, "Failed to enable USB DDR clock\n");
|
|
clk_disable_unprepare(priv->clk_usb_general);
|
|
+ reset_control_rearm(priv->reset);
|
|
return ret;
|
|
}
|
|
|
|
@@ -199,6 +201,7 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
|
|
dev_warn(&phy->dev, "USB ID detect failed!\n");
|
|
clk_disable_unprepare(priv->clk_usb);
|
|
clk_disable_unprepare(priv->clk_usb_general);
|
|
+ reset_control_rearm(priv->reset);
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
@@ -218,6 +221,7 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
|
|
|
|
clk_disable_unprepare(priv->clk_usb);
|
|
clk_disable_unprepare(priv->clk_usb_general);
|
|
+ reset_control_rearm(priv->reset);
|
|
|
|
/* power off the PHY by putting it into reset mode */
|
|
regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET,
|
|
--
|
|
2.35.1
|
|
|