All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass
@ 2019-11-12 10:01 Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 2/7] usb: gadget: dwc2: change trace level for phy errors managed by uclass Patrick Delaunay
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

Add an error trace for PHY errors directly in generic phy
functions provided by PHY uclass.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

This patch is requested by Marek Vasut to avoid code duplication
in usb host serie for dwc2:

See http://patchwork.ozlabs.org/patch/1176048/#2297595
[U-Boot,RESEND,1/5] usb: host: dwc2: add phy support


 drivers/phy/phy-uclass.c | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index e201a90c8c..363985b881 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -109,56 +109,86 @@ int generic_phy_get_by_name(struct udevice *dev, const char *phy_name,
 int generic_phy_init(struct phy *phy)
 {
 	struct phy_ops const *ops;
+	int ret;
 
 	if (!phy)
 		return 0;
 	ops = phy_dev_ops(phy->dev);
 
-	return ops->init ? ops->init(phy) : 0;
+	ret = ops->init ? ops->init(phy) : 0;
+	if (ret)
+		dev_err(phy->dev, "PHY: Failed to init %s: %d.\n",
+			phy->dev->name, ret);
+
+	return ret;
 }
 
 int generic_phy_reset(struct phy *phy)
 {
 	struct phy_ops const *ops;
+	int ret;
 
 	if (!phy)
 		return 0;
 	ops = phy_dev_ops(phy->dev);
 
-	return ops->reset ? ops->reset(phy) : 0;
+	ret = ops->reset ? ops->reset(phy) : 0;
+	if (ret)
+		dev_err(phy->dev, "PHY: Failed to reset %s: %d.\n",
+			phy->dev->name, ret);
+
+	return ret;
 }
 
 int generic_phy_exit(struct phy *phy)
 {
 	struct phy_ops const *ops;
+	int ret;
 
 	if (!phy)
 		return 0;
 	ops = phy_dev_ops(phy->dev);
 
-	return ops->exit ? ops->exit(phy) : 0;
+	ret = ops->exit ? ops->exit(phy) : 0;
+	if (ret)
+		dev_err(phy->dev, "PHY: Failed to exit %s: %d.\n",
+			phy->dev->name, ret);
+
+	return ret;
 }
 
 int generic_phy_power_on(struct phy *phy)
 {
 	struct phy_ops const *ops;
+	int ret;
 
 	if (!phy)
 		return 0;
 	ops = phy_dev_ops(phy->dev);
 
-	return ops->power_on ? ops->power_on(phy) : 0;
+	ret = ops->power_on ? ops->power_on(phy) : 0;
+	if (ret)
+		dev_err(phy->dev, "PHY: Failed to power on %s: %d.\n",
+			phy->dev->name, ret);
+
+	return ret;
 }
 
 int generic_phy_power_off(struct phy *phy)
 {
 	struct phy_ops const *ops;
+	int ret;
 
 	if (!phy)
 		return 0;
 	ops = phy_dev_ops(phy->dev);
 
-	return ops->power_off ? ops->power_off(phy) : 0;
+	ret = ops->power_off ? ops->power_off(phy) : 0;
+	if (ret)
+		dev_err(phy->dev, "PHY: Failed to power off %s: %d.\n",
+			phy->dev->name, ret);
+
+	return ret;
 }
 
 UCLASS_DRIVER(phy) = {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/7] usb: gadget: dwc2: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 3/7] board: sunxi: " Patrick Delaunay
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the dev_err can be change to dev_dbg.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/usb/gadget/dwc2_udc_otg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 35f4147840..35495e41fc 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -980,7 +980,7 @@ int dwc2_phy_setup(struct udevice *dev, struct phy **array, int *num_phys)
 	for (i = 0; i < count; i++) {
 		ret = generic_phy_init(&usb_phys[i]);
 		if (ret) {
-			dev_err(dev, "Can't init USB PHY%d for %s\n",
+			dev_dbg(dev, "Can't init USB PHY%d for %s\n",
 				i, dev->name);
 			goto phys_init_err;
 		}
@@ -989,7 +989,7 @@ int dwc2_phy_setup(struct udevice *dev, struct phy **array, int *num_phys)
 	for (i = 0; i < count; i++) {
 		ret = generic_phy_power_on(&usb_phys[i]);
 		if (ret) {
-			dev_err(dev, "Can't power USB PHY%d for %s\n",
+			dev_dbg(dev, "Can't power USB PHY%d for %s\n",
 				i, dev->name);
 			goto phys_poweron_err;
 		}
@@ -1027,7 +1027,7 @@ void dwc2_phy_shutdown(struct udevice *dev, struct phy *usb_phys, int num_phys)
 		ret = generic_phy_power_off(&usb_phys[i]);
 		ret |= generic_phy_exit(&usb_phys[i]);
 		if (ret) {
-			dev_err(dev, "Can't shutdown USB PHY%d for %s\n",
+			dev_dbg(dev, "Can't shutdown USB PHY%d for %s\n",
 				i, dev->name);
 		}
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 3/7] board: sunxi: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 2/7] usb: gadget: dwc2: change trace level for phy errors managed by uclass Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 4/7] usb: host: ohci: " Patrick Delaunay
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_idebug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 board/sunxi/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e3b2d13892..95697f4aae 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -705,7 +705,7 @@ int g_dnl_board_usb_cable_connected(void)
 
 	ret = generic_phy_init(&phy);
 	if (ret) {
-		pr_err("failed to init %s USB PHY\n", dev->name);
+		pr_debug("failed to init %s USB PHY\n", dev->name);
 		return ret;
 	}
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 4/7] usb: host: ohci: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 2/7] usb: gadget: dwc2: change trace level for phy errors managed by uclass Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 3/7] board: sunxi: " Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 5/7] usb: host: ehci-hcd: " Patrick Delaunay
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the dev_err can be change to dev_dbg.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/usb/host/ohci-generic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index 916ea0b955..e8cf26aa48 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -38,13 +38,13 @@ static int ohci_setup_phy(struct udevice *dev, int index)
 	} else {
 		ret = generic_phy_init(&priv->phy);
 		if (ret) {
-			dev_err(dev, "failed to init usb phy\n");
+			dev_dbg(dev, "failed to init usb phy\n");
 			return ret;
 		}
 
 		ret = generic_phy_power_on(&priv->phy);
 		if (ret) {
-			dev_err(dev, "failed to power on usb phy\n");
+			dev_dbg(dev, "failed to power on usb phy\n");
 			return generic_phy_exit(&priv->phy);
 		}
 	}
@@ -60,13 +60,13 @@ static int ohci_shutdown_phy(struct udevice *dev)
 	if (generic_phy_valid(&priv->phy)) {
 		ret = generic_phy_power_off(&priv->phy);
 		if (ret) {
-			dev_err(dev, "failed to power off usb phy\n");
+			dev_dbg(dev, "failed to power off usb phy\n");
 			return ret;
 		}
 
 		ret = generic_phy_exit(&priv->phy);
 		if (ret) {
-			dev_err(dev, "failed to power off usb phy\n");
+			dev_dbg(dev, "failed to power off usb phy\n");
 			return ret;
 		}
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 5/7] usb: host: ehci-hcd: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
                   ` (2 preceding siblings ...)
  2019-11-12 10:01 ` [U-Boot] [PATCH 4/7] usb: host: ohci: " Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 6/7] usb: dwc3: " Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 7/7] ata: dwc-ahci: " Patrick Delaunay
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/usb/host/ehci-hcd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 85918e85be..0f5a8ada31 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1697,13 +1697,13 @@ int ehci_setup_phy(struct udevice *dev, struct phy *phy, int index)
 	} else {
 		ret = generic_phy_init(phy);
 		if (ret) {
-			dev_err(dev, "failed to init usb phy\n");
+			dev_dbg(dev, "failed to init usb phy\n");
 			return ret;
 		}
 
 		ret = generic_phy_power_on(phy);
 		if (ret) {
-			dev_err(dev, "failed to power on usb phy\n");
+			dev_dbg(dev, "failed to power on usb phy\n");
 			return generic_phy_exit(phy);
 		}
 	}
@@ -1721,13 +1721,13 @@ int ehci_shutdown_phy(struct udevice *dev, struct phy *phy)
 	if (generic_phy_valid(phy)) {
 		ret = generic_phy_power_off(phy);
 		if (ret) {
-			dev_err(dev, "failed to power off usb phy\n");
+			dev_dbg(dev, "failed to power off usb phy\n");
 			return ret;
 		}
 
 		ret = generic_phy_exit(phy);
 		if (ret) {
-			dev_err(dev, "failed to power off usb phy\n");
+			dev_dbg(dev, "failed to power off usb phy\n");
 			return ret;
 		}
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 6/7] usb: dwc3: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
                   ` (3 preceding siblings ...)
  2019-11-12 10:01 ` [U-Boot] [PATCH 5/7] usb: host: ehci-hcd: " Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  2019-11-12 10:01 ` [U-Boot] [PATCH 7/7] ata: dwc-ahci: " Patrick Delaunay
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/usb/dwc3/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 23af60c98d..9342321320 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -832,8 +832,8 @@ int dwc3_setup_phy(struct udevice *dev, struct phy **array, int *num_phys)
 	for (i = 0; i < count; i++) {
 		ret = generic_phy_init(&usb_phys[i]);
 		if (ret) {
-			pr_err("Can't init USB PHY%d for %s\n",
-			       i, dev->name);
+			pr_debug("Can't init USB PHY%d for %s\n",
+				 i, dev->name);
 			goto phys_init_err;
 		}
 	}
@@ -841,8 +841,8 @@ int dwc3_setup_phy(struct udevice *dev, struct phy **array, int *num_phys)
 	for (i = 0; i < count; i++) {
 		ret = generic_phy_power_on(&usb_phys[i]);
 		if (ret) {
-			pr_err("Can't power USB PHY%d for %s\n",
-			       i, dev->name);
+			pr_debug("Can't power USB PHY%d for %s\n",
+				 i, dev->name);
 			goto phys_poweron_err;
 		}
 	}
@@ -878,8 +878,8 @@ int dwc3_shutdown_phy(struct udevice *dev, struct phy *usb_phys, int num_phys)
 		ret = generic_phy_power_off(&usb_phys[i]);
 		ret |= generic_phy_exit(&usb_phys[i]);
 		if (ret) {
-			pr_err("Can't shutdown USB PHY%d for %s\n",
-			       i, dev->name);
+			pr_debug("Can't shutdown USB PHY%d for %s\n",
+				 i, dev->name);
 		}
 	}
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 7/7] ata: dwc-ahci: change trace level for phy errors managed by uclass
  2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
                   ` (4 preceding siblings ...)
  2019-11-12 10:01 ` [U-Boot] [PATCH 6/7] usb: dwc3: " Patrick Delaunay
@ 2019-11-12 10:01 ` Patrick Delaunay
  5 siblings, 0 replies; 7+ messages in thread
From: Patrick Delaunay @ 2019-11-12 10:01 UTC (permalink / raw)
  To: u-boot

As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/ata/dwc_ahci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/dwc_ahci.c b/drivers/ata/dwc_ahci.c
index 017650ae46..3c2a3ac201 100644
--- a/drivers/ata/dwc_ahci.c
+++ b/drivers/ata/dwc_ahci.c
@@ -62,13 +62,13 @@ static int dwc_ahci_probe(struct udevice *dev)
 
 	ret = generic_phy_init(&phy);
 	if (ret) {
-		pr_err("unable to initialize the sata phy\n");
+		pr_debug("unable to initialize the sata phy\n");
 		return ret;
 	}
 
 	ret = generic_phy_power_on(&phy);
 	if (ret) {
-		pr_err("unable to power on the sata phy\n");
+		pr_debug("unable to power on the sata phy\n");
 		return ret;
 	}
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-12 10:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 10:01 [U-Boot] [PATCH 1/7] phy: generic: add error trace to detect PHY issue in uclass Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 2/7] usb: gadget: dwc2: change trace level for phy errors managed by uclass Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 3/7] board: sunxi: " Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 4/7] usb: host: ohci: " Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 5/7] usb: host: ehci-hcd: " Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 6/7] usb: dwc3: " Patrick Delaunay
2019-11-12 10:01 ` [U-Boot] [PATCH 7/7] ata: dwc-ahci: " Patrick Delaunay

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.