[PATCH 07/13] usb: cdns3-ti: signal reset-on-resume to xHCI for J7= platform

From: =3D?UTF-8?q?Th=3DC3=3DA9o=3D20Lebrun?=3D
Date: Mon Nov 20 2023 - 11:02:44 EST


Pass CDNS3_RESET_ON_RESUME as platform data to cdns3 host role. It will
in turn pass it down to xHCI platform data as XHCI_RESET_ON_RESUME.

Avoid this warning on resume:

[ 16.017462] xhci-hcd xhci-hcd.1.auto: xHC error in resume, USBSTS 0x40=
1, Reinit

When used, remote wakeup is not expected to work.

Only focus J7200 as other SoC are untested.

Signed-off-by: Th=C3=A9o Lebrun <theo.lebrun@xxxxxxxxxxx>
---
drivers/usb/cdns3/cdns3-ti.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 7530b6b5159d..da2648ebc179 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -16,6 +16,7 @@
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
+#include "core.h"

/* USB Wrapper register offsets */
#define USBSS_PID 0x0
@@ -62,7 +63,8 @@ struct cdns_ti {
};

struct cdns_ti_match_data {
- bool reset_on_resume;
+ bool reset_on_resume;
+ const struct of_dev_auxdata *auxdata;
};

static const int cdns_ti_rate_table[] =3D { /* in KHZ */
@@ -132,6 +134,7 @@ static int cdns_ti_probe(struct platform_device *pdev)
{
struct device *dev =3D &pdev->dev;
struct device_node *node =3D pdev->dev.of_node;
+ const struct of_dev_auxdata *auxdata =3D NULL;
struct cdns_ti *data;
unsigned long rate;
int error, i;
@@ -181,7 +184,9 @@ static int cdns_ti_probe(struct platform_device *pdev)

cdns_ti_init_hw(data);

- error =3D of_platform_populate(node, NULL, NULL, dev);
+ if (data->match_data)
+ auxdata =3D data->match_data->auxdata;
+ error =3D of_platform_populate(node, NULL, auxdata, dev);
if (error) {
dev_err(dev, "failed to create children: %d\n", error);
return error;
@@ -226,8 +231,21 @@ static const struct dev_pm_ops cdns_ti_pm_ops =3D {

#endif /* CONFIG_PM */

+static struct cdns3_platform_data cdns_ti_j7200_pdata =3D {
+ .quirks =3D CDNS3_RESET_ON_RESUME,
+};
+
+static const struct of_dev_auxdata cdns_ti_j7200_auxdata[] =3D {
+ {
+ .compatible =3D "cdns,usb3",
+ .platform_data =3D &cdns_ti_j7200_pdata,
+ },
+ {},
+};
+
static const struct cdns_ti_match_data cdns_ti_j7200_match_data =3D {
.reset_on_resume =3D true,
+ .auxdata =3D cdns_ti_j7200_auxdata,
};

static const struct of_device_id cdns_ti_of_match[] =3D {
--
2.42.0