All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield
@ 2022-09-23 16:30 Andy Shevchenko
  2022-09-23 16:30 ` [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"" Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-09-23 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Andy Shevchenko, Andrey Smirnov, linux-usb,
	linux-kernel
  Cc: Felipe Balbi

It's late in the cycle, that's why I send these reverts, so we will have a
full new cycle for testing a better solution if any.

So this is just a proactive move if we have no solution in the nearest days.

Andy Shevchenko (2):
  Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG
    -> peripheral if extcon is present""
  Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is
    present"

 drivers/usb/dwc3/core.c | 50 +----------------------------------------
 drivers/usb/dwc3/drd.c  | 50 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 49 deletions(-)

-- 
2.35.1


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

* [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present""
  2022-09-23 16:30 [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Andy Shevchenko
@ 2022-09-23 16:30 ` Andy Shevchenko
  2022-09-24 10:39   ` Greg Kroah-Hartman
  2022-09-23 16:30 ` [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-09-23 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Andy Shevchenko, Andrey Smirnov, linux-usb,
	linux-kernel
  Cc: Felipe Balbi

This reverts commit 8bd6b8c4b1009d7d2662138d6bdc6fe58a9274c5.

Prerequisite revert for the reverting the original patch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/dwc3/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 8c8e32651473..b3ae53be2112 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1684,8 +1684,13 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 	 * This device property is for kernel internal use only and
 	 * is expected to be set by the glue code.
 	 */
-	if (device_property_read_string(dev, "linux,extcon-name", &name) == 0)
-		return extcon_get_extcon_dev(name);
+	if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
+		edev = extcon_get_extcon_dev(name);
+		if (!edev)
+			return ERR_PTR(-EPROBE_DEFER);
+
+		return edev;
+	}
 
 	/*
 	 * Try to get an extcon device from the USB PHY controller's "port"
-- 
2.35.1


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

* [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"
  2022-09-23 16:30 [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Andy Shevchenko
  2022-09-23 16:30 ` [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"" Andy Shevchenko
@ 2022-09-23 16:30 ` Andy Shevchenko
  2022-09-24 10:40   ` Greg Kroah-Hartman
  2022-09-23 20:34 ` [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Ferry Toth
  2022-09-24 10:39 ` Greg Kroah-Hartman
  3 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-09-23 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Andy Shevchenko, Andrey Smirnov, linux-usb,
	linux-kernel
  Cc: Felipe Balbi, Ferry Toth

This reverts commit 0f01017191384e3962fa31520a9fd9846c3d352f.

As pointed out by Ferry this breaks Dual Role support on
Intel Merrifield platforms.

Reported-by: Ferry Toth <fntoth@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/dwc3/core.c | 55 +----------------------------------------
 drivers/usb/dwc3/drd.c  | 50 +++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 54 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b3ae53be2112..695e92b8b925 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -23,7 +23,6 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/of.h>
-#include <linux/of_graph.h>
 #include <linux/acpi.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/reset.h>
@@ -86,7 +85,7 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
 		 * mode. If the controller supports DRD but the dr_mode is not
 		 * specified or set to OTG, then set the mode to peripheral.
 		 */
-		if (mode == USB_DR_MODE_OTG && !dwc->edev &&
+		if (mode == USB_DR_MODE_OTG &&
 		    (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
 		     !device_property_read_bool(dwc->dev, "usb-role-switch")) &&
 		    !DWC3_VER_IS_PRIOR(DWC3, 330A))
@@ -1668,51 +1667,6 @@ static void dwc3_check_params(struct dwc3 *dwc)
 	}
 }
 
-static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
-{
-	struct device *dev = dwc->dev;
-	struct device_node *np_phy;
-	struct extcon_dev *edev = NULL;
-	const char *name;
-
-	if (device_property_read_bool(dev, "extcon"))
-		return extcon_get_edev_by_phandle(dev, 0);
-
-	/*
-	 * Device tree platforms should get extcon via phandle.
-	 * On ACPI platforms, we get the name from a device property.
-	 * This device property is for kernel internal use only and
-	 * is expected to be set by the glue code.
-	 */
-	if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
-		edev = extcon_get_extcon_dev(name);
-		if (!edev)
-			return ERR_PTR(-EPROBE_DEFER);
-
-		return edev;
-	}
-
-	/*
-	 * Try to get an extcon device from the USB PHY controller's "port"
-	 * node. Check if it has the "port" node first, to avoid printing the
-	 * error message from underlying code, as it's a valid case: extcon
-	 * device (and "port" node) may be missing in case of "usb-role-switch"
-	 * or OTG mode.
-	 */
-	np_phy = of_parse_phandle(dev->of_node, "phys", 0);
-	if (of_graph_is_present(np_phy)) {
-		struct device_node *np_conn;
-
-		np_conn = of_graph_get_remote_node(np_phy, -1, -1);
-		if (np_conn)
-			edev = extcon_find_edev_by_node(np_conn);
-		of_node_put(np_conn);
-	}
-	of_node_put(np_phy);
-
-	return edev;
-}
-
 static int dwc3_probe(struct platform_device *pdev)
 {
 	struct device		*dev = &pdev->dev;
@@ -1848,13 +1802,6 @@ static int dwc3_probe(struct platform_device *pdev)
 		goto err2;
 	}
 
-	dwc->edev = dwc3_get_extcon(dwc);
-	if (IS_ERR(dwc->edev)) {
-		ret = PTR_ERR(dwc->edev);
-		dev_err_probe(dwc->dev, ret, "failed to get extcon\n");
-		goto err3;
-	}
-
 	ret = dwc3_get_dr_mode(dwc);
 	if (ret)
 		goto err3;
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index 039bf241769a..04a569a3cbab 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -8,6 +8,7 @@
  */
 
 #include <linux/extcon.h>
+#include <linux/of_graph.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
@@ -438,6 +439,51 @@ static int dwc3_drd_notifier(struct notifier_block *nb,
 	return NOTIFY_DONE;
 }
 
+static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
+{
+	struct device *dev = dwc->dev;
+	struct device_node *np_phy;
+	struct extcon_dev *edev = NULL;
+	const char *name;
+
+	if (device_property_read_bool(dev, "extcon"))
+		return extcon_get_edev_by_phandle(dev, 0);
+
+	/*
+	 * Device tree platforms should get extcon via phandle.
+	 * On ACPI platforms, we get the name from a device property.
+	 * This device property is for kernel internal use only and
+	 * is expected to be set by the glue code.
+	 */
+	if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
+		edev = extcon_get_extcon_dev(name);
+		if (!edev)
+			return ERR_PTR(-EPROBE_DEFER);
+
+		return edev;
+	}
+
+	/*
+	 * Try to get an extcon device from the USB PHY controller's "port"
+	 * node. Check if it has the "port" node first, to avoid printing the
+	 * error message from underlying code, as it's a valid case: extcon
+	 * device (and "port" node) may be missing in case of "usb-role-switch"
+	 * or OTG mode.
+	 */
+	np_phy = of_parse_phandle(dev->of_node, "phys", 0);
+	if (of_graph_is_present(np_phy)) {
+		struct device_node *np_conn;
+
+		np_conn = of_graph_get_remote_node(np_phy, -1, -1);
+		if (np_conn)
+			edev = extcon_find_edev_by_node(np_conn);
+		of_node_put(np_conn);
+	}
+	of_node_put(np_phy);
+
+	return edev;
+}
+
 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 #define ROLE_SWITCH 1
 static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
@@ -538,6 +584,10 @@ int dwc3_drd_init(struct dwc3 *dwc)
 {
 	int ret, irq;
 
+	dwc->edev = dwc3_get_extcon(dwc);
+	if (IS_ERR(dwc->edev))
+		return PTR_ERR(dwc->edev);
+
 	if (ROLE_SWITCH &&
 	    device_property_read_bool(dwc->dev, "usb-role-switch"))
 		return dwc3_setup_role_switch(dwc);
-- 
2.35.1


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

* Re: [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield
  2022-09-23 16:30 [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Andy Shevchenko
  2022-09-23 16:30 ` [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"" Andy Shevchenko
  2022-09-23 16:30 ` [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" Andy Shevchenko
@ 2022-09-23 20:34 ` Ferry Toth
  2022-09-24 10:39 ` Greg Kroah-Hartman
  3 siblings, 0 replies; 7+ messages in thread
From: Ferry Toth @ 2022-09-23 20:34 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, Andrey Smirnov, linux-usb,
	linux-kernel
  Cc: Felipe Balbi

Hi

Op 23-09-2022 om 18:30 schreef Andy Shevchenko:
> It's late in the cycle, that's why I send these reverts, so we will have a
> full new cycle for testing a better solution if any.
>
> So this is just a proactive move if we have no solution in the nearest days.
>
> Andy Shevchenko (2):
>    Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG
>      -> peripheral if extcon is present""
>    Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is
>      present"
>
>   drivers/usb/dwc3/core.c | 50 +----------------------------------------
>   drivers/usb/dwc3/drd.c  | 50 +++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 51 insertions(+), 49 deletions(-)
>
For the series:

Tested-by: Ferry Toth <fntoth@gmail.com> # for Merrifield


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

* Re: [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield
  2022-09-23 16:30 [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Andy Shevchenko
                   ` (2 preceding siblings ...)
  2022-09-23 20:34 ` [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Ferry Toth
@ 2022-09-24 10:39 ` Greg Kroah-Hartman
  3 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-24 10:39 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Andrey Smirnov, linux-usb, linux-kernel, Felipe Balbi

On Fri, Sep 23, 2022 at 07:30:49PM +0300, Andy Shevchenko wrote:
> It's late in the cycle, that's why I send these reverts, so we will have a
> full new cycle for testing a better solution if any.

Wait, you need these into what release?  6.1-rc1?

The commits you are referencing are in 5.19, right?  Not 6.0-rc.

> So this is just a proactive move if we have no solution in the nearest days.

How will I know this?

confused,

greg k-h

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

* Re: [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present""
  2022-09-23 16:30 ` [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"" Andy Shevchenko
@ 2022-09-24 10:39   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-24 10:39 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Andrey Smirnov, linux-usb, linux-kernel, Felipe Balbi

On Fri, Sep 23, 2022 at 07:30:50PM +0300, Andy Shevchenko wrote:
> This reverts commit 8bd6b8c4b1009d7d2662138d6bdc6fe58a9274c5.
> 
> Prerequisite revert for the reverting the original patch.

What "original patch"?

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

What commit does this fix?  Stable trees?

you know better, I can't take this as-is...

thanks,

greg k-h

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

* Re: [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"
  2022-09-23 16:30 ` [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" Andy Shevchenko
@ 2022-09-24 10:40   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-24 10:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andrey Smirnov, linux-usb, linux-kernel, Felipe Balbi, Ferry Toth

On Fri, Sep 23, 2022 at 07:30:51PM +0300, Andy Shevchenko wrote:
> This reverts commit 0f01017191384e3962fa31520a9fd9846c3d352f.
> 
> As pointed out by Ferry this breaks Dual Role support on
> Intel Merrifield platforms.
> 
> Reported-by: Ferry Toth <fntoth@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Cc: stable?  Fixes?

{sigh}

greg k-h

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

end of thread, other threads:[~2022-09-24 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 16:30 [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Andy Shevchenko
2022-09-23 16:30 ` [PATCH v1 1/2] Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"" Andy Shevchenko
2022-09-24 10:39   ` Greg Kroah-Hartman
2022-09-23 16:30 ` [PATCH v1 2/2] Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" Andy Shevchenko
2022-09-24 10:40   ` Greg Kroah-Hartman
2022-09-23 20:34 ` [PATCH v1 0/2] usb: dwc3: revert OTG changes for Intel Merrifield Ferry Toth
2022-09-24 10:39 ` Greg Kroah-Hartman

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.