2020-03-27 20:48:21

by Al Cooper

[permalink] [raw]
Subject: [PATCH v2 2/4] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's

Add support for Broadcom STB SoC's to the xhci platform driver

Signed-off-by: Al Cooper <[email protected]>
---
drivers/usb/host/xhci-brcm.c | 16 ++++++++++++++++
drivers/usb/host/xhci-brcm.h | 16 ++++++++++++++++
drivers/usb/host/xhci-plat.c | 11 +++++++++++
3 files changed, 43 insertions(+)
create mode 100644 drivers/usb/host/xhci-brcm.c
create mode 100644 drivers/usb/host/xhci-brcm.h

diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c
new file mode 100644
index 000000000000..bf8c0bfd1780
--- /dev/null
+++ b/drivers/usb/host/xhci-brcm.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Broadcom */
+
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>
+
+#include "xhci.h"
+
+int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
+{
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+ xhci->quirks |= XHCI_RESET_ON_RESUME;
+ return 0;
+}
+
diff --git a/drivers/usb/host/xhci-brcm.h b/drivers/usb/host/xhci-brcm.h
new file mode 100644
index 000000000000..e64800fae4d5
--- /dev/null
+++ b/drivers/usb/host/xhci-brcm.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018, Broadcom */
+
+#ifndef _XHCI_BRCM_H
+#define _XHCI_BRCM_H
+
+#if IS_ENABLED(CONFIG_USB_XHCI_BRCM)
+int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd);
+#else
+static inline int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
+{
+ return 0;
+}
+#endif
+#endif /* _XHCI_BRCM_H */
+
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 315b4552693c..3e90a1207803 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -22,6 +22,7 @@

#include "xhci.h"
#include "xhci-plat.h"
+#include "xhci-brcm.h"
#include "xhci-mvebu.h"
#include "xhci-rcar.h"

@@ -112,6 +113,10 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3)
};

+static const struct xhci_plat_priv xhci_plat_brcm = {
+ .init_quirk = xhci_plat_brcm_init_quirk,
+};
+
static const struct of_device_id usb_xhci_of_match[] = {
{
.compatible = "generic-xhci",
@@ -147,6 +152,12 @@ static const struct of_device_id usb_xhci_of_match[] = {
}, {
.compatible = "renesas,rcar-gen3-xhci",
.data = &xhci_plat_renesas_rcar_gen3,
+ }, {
+ .compatible = "brcm,xhci-brcm-v2",
+ .data = &xhci_plat_brcm,
+ }, {
+ .compatible = "brcm,bcm7445-xhci",
+ .data = &xhci_plat_brcm,
},
{},
};
--
2.17.1


2020-03-30 02:35:54

by Chunfeng Yun

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's

Hi,
On Fri, 2020-03-27 at 16:47 -0400, Al Cooper wrote:
> Add support for Broadcom STB SoC's to the xhci platform driver
>
> Signed-off-by: Al Cooper <[email protected]>
> ---
> drivers/usb/host/xhci-brcm.c | 16 ++++++++++++++++
> drivers/usb/host/xhci-brcm.h | 16 ++++++++++++++++
> drivers/usb/host/xhci-plat.c | 11 +++++++++++
> 3 files changed, 43 insertions(+)
> create mode 100644 drivers/usb/host/xhci-brcm.c
> create mode 100644 drivers/usb/host/xhci-brcm.h
>
> diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c
> new file mode 100644
> index 000000000000..bf8c0bfd1780
> --- /dev/null
> +++ b/drivers/usb/host/xhci-brcm.c
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2018, Broadcom */
> +
> +#include <linux/usb.h>
> +#include <linux/usb/hcd.h>
> +
> +#include "xhci.h"
> +
> +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> +{
> + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> +
> + xhci->quirks |= XHCI_RESET_ON_RESUME;
> + return 0;
> +}
> +
> diff --git a/drivers/usb/host/xhci-brcm.h b/drivers/usb/host/xhci-brcm.h
> new file mode 100644
> index 000000000000..e64800fae4d5
> --- /dev/null
> +++ b/drivers/usb/host/xhci-brcm.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (c) 2018, Broadcom */
> +
> +#ifndef _XHCI_BRCM_H
> +#define _XHCI_BRCM_H
> +
> +#if IS_ENABLED(CONFIG_USB_XHCI_BRCM)
> +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd);
> +#else
> +static inline int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> +{
> + return 0;
> +}
> +#endif
> +#endif /* _XHCI_BRCM_H */
> +
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 315b4552693c..3e90a1207803 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -22,6 +22,7 @@
>
> #include "xhci.h"
> #include "xhci-plat.h"
> +#include "xhci-brcm.h"
> #include "xhci-mvebu.h"
> #include "xhci-rcar.h"
>
> @@ -112,6 +113,10 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
> SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3)
> };
>
> +static const struct xhci_plat_priv xhci_plat_brcm = {
> + .init_quirk = xhci_plat_brcm_init_quirk,
> +};
> +
> static const struct of_device_id usb_xhci_of_match[] = {
> {
> .compatible = "generic-xhci",
> @@ -147,6 +152,12 @@ static const struct of_device_id usb_xhci_of_match[] = {
> }, {
> .compatible = "renesas,rcar-gen3-xhci",
> .data = &xhci_plat_renesas_rcar_gen3,
> + }, {
> + .compatible = "brcm,xhci-brcm-v2",
> + .data = &xhci_plat_brcm,
This one is not described in dt-binding.
> + }, {
> + .compatible = "brcm,bcm7445-xhci",
> + .data = &xhci_plat_brcm,
bcm7445 is a SoC name ?
the quirk only happens on this one? or on all SoCs with Broadcom xHIC
IP?

> },
> {},
> };

2020-03-31 09:35:47

by Mathias Nyman

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's

On 27.3.2020 22.47, Al Cooper wrote:
> Add support for Broadcom STB SoC's to the xhci platform driver
>
> Signed-off-by: Al Cooper <[email protected]>
> ---
> drivers/usb/host/xhci-brcm.c | 16 ++++++++++++++++
> drivers/usb/host/xhci-brcm.h | 16 ++++++++++++++++
> drivers/usb/host/xhci-plat.c | 11 +++++++++++
> 3 files changed, 43 insertions(+)
> create mode 100644 drivers/usb/host/xhci-brcm.c
> create mode 100644 drivers/usb/host/xhci-brcm.h
>
> diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c
> new file mode 100644
> index 000000000000..bf8c0bfd1780
> --- /dev/null
> +++ b/drivers/usb/host/xhci-brcm.c
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2018, Broadcom */
> +
> +#include <linux/usb.h>
> +#include <linux/usb/hcd.h>
> +
> +#include "xhci.h"
> +
> +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> +{
> + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> +
> + xhci->quirks |= XHCI_RESET_ON_RESUME;
> + return 0;
> +}
> +

If there's nothing else than one quirk flag needed for Broadcom STB Soc
it would be simpler to add it directly to the xhci_plat_brcm structure.

No need to add xhci-brcm.c or xhci-brcm.h files, or any xhci Makfile or Kconfig
changes


> diff --git a/drivers/usb/host/xhci-brcm.h b/drivers/usb/host/xhci-brcm.h
> new file mode 100644
> index 000000000000..e64800fae4d5
> --- /dev/null
> +++ b/drivers/usb/host/xhci-brcm.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (c) 2018, Broadcom */
> +
> +#ifndef _XHCI_BRCM_H
> +#define _XHCI_BRCM_H
> +
> +#if IS_ENABLED(CONFIG_USB_XHCI_BRCM)
> +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd);
> +#else
> +static inline int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> +{
> + return 0;
> +}
> +#endif
> +#endif /* _XHCI_BRCM_H */
> +
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 315b4552693c..3e90a1207803 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -22,6 +22,7 @@
>
> #include "xhci.h"
> #include "xhci-plat.h"
> +#include "xhci-brcm.h"
> #include "xhci-mvebu.h"
> #include "xhci-rcar.h"
>
> @@ -112,6 +113,10 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
> SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3)
> };
>
> +static const struct xhci_plat_priv xhci_plat_brcm = {
> + .init_quirk = xhci_plat_brcm_init_quirk,
> +};
> +

So something like this instead:

static const struct xhci_plat_priv xhci_plat_brcm = {
.quirks = XHCI_RESET_ON_RESUME,
};

-Mathias

2020-04-06 15:30:10

by Al Cooper

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's

On Sun, Mar 29, 2020 at 10:35 PM Chunfeng Yun <[email protected]> wrote:
>
> Hi,
...
> > + }, {
> > + .compatible = "brcm,xhci-brcm-v2",
> > + .data = &xhci_plat_brcm,
> This one is not described in dt-binding.

This is an obsolete name, but was left in the driver for backward
compatibility with some older boards that still have this in their
device tree.

> > + }, {
> > + .compatible = "brcm,bcm7445-xhci",
> > + .data = &xhci_plat_brcm,
> bcm7445 is a SoC name ?
> the quirk only happens on this one? or on all SoCs with Broadcom xHIC
> IP?

bcm7445 is the first SoC with this style controller and all subsequent
SoCs contain this compatible entry and also have the quirk.

>
> > },
> > {},
> > };

Thanks
Al

On Sun, Mar 29, 2020 at 10:35 PM Chunfeng Yun <[email protected]> wrote:
>
> Hi,
> On Fri, 2020-03-27 at 16:47 -0400, Al Cooper wrote:
> > Add support for Broadcom STB SoC's to the xhci platform driver
> >
> > Signed-off-by: Al Cooper <[email protected]>
> > ---
> > drivers/usb/host/xhci-brcm.c | 16 ++++++++++++++++
> > drivers/usb/host/xhci-brcm.h | 16 ++++++++++++++++
> > drivers/usb/host/xhci-plat.c | 11 +++++++++++
> > 3 files changed, 43 insertions(+)
> > create mode 100644 drivers/usb/host/xhci-brcm.c
> > create mode 100644 drivers/usb/host/xhci-brcm.h
> >
> > diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c
> > new file mode 100644
> > index 000000000000..bf8c0bfd1780
> > --- /dev/null
> > +++ b/drivers/usb/host/xhci-brcm.c
> > @@ -0,0 +1,16 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Copyright (c) 2018, Broadcom */
> > +
> > +#include <linux/usb.h>
> > +#include <linux/usb/hcd.h>
> > +
> > +#include "xhci.h"
> > +
> > +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> > +{
> > + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> > +
> > + xhci->quirks |= XHCI_RESET_ON_RESUME;
> > + return 0;
> > +}
> > +
> > diff --git a/drivers/usb/host/xhci-brcm.h b/drivers/usb/host/xhci-brcm.h
> > new file mode 100644
> > index 000000000000..e64800fae4d5
> > --- /dev/null
> > +++ b/drivers/usb/host/xhci-brcm.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/* Copyright (c) 2018, Broadcom */
> > +
> > +#ifndef _XHCI_BRCM_H
> > +#define _XHCI_BRCM_H
> > +
> > +#if IS_ENABLED(CONFIG_USB_XHCI_BRCM)
> > +int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd);
> > +#else
> > +static inline int xhci_plat_brcm_init_quirk(struct usb_hcd *hcd)
> > +{
> > + return 0;
> > +}
> > +#endif
> > +#endif /* _XHCI_BRCM_H */
> > +
> > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > index 315b4552693c..3e90a1207803 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -22,6 +22,7 @@
> >
> > #include "xhci.h"
> > #include "xhci-plat.h"
> > +#include "xhci-brcm.h"
> > #include "xhci-mvebu.h"
> > #include "xhci-rcar.h"
> >
> > @@ -112,6 +113,10 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
> > SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3)
> > };
> >
> > +static const struct xhci_plat_priv xhci_plat_brcm = {
> > + .init_quirk = xhci_plat_brcm_init_quirk,
> > +};
> > +
> > static const struct of_device_id usb_xhci_of_match[] = {
> > {
> > .compatible = "generic-xhci",
> > @@ -147,6 +152,12 @@ static const struct of_device_id usb_xhci_of_match[] = {
> > }, {
> > .compatible = "renesas,rcar-gen3-xhci",
> > .data = &xhci_plat_renesas_rcar_gen3,
> > + }, {
> > + .compatible = "brcm,xhci-brcm-v2",
> > + .data = &xhci_plat_brcm,
> This one is not described in dt-binding.
> > + }, {
> > + .compatible = "brcm,bcm7445-xhci",
> > + .data = &xhci_plat_brcm,
> bcm7445 is a SoC name ?
> the quirk only happens on this one? or on all SoCs with Broadcom xHIC
> IP?
>
> > },
> > {},
> > };
>