diff mbox series

[v1,6/8] usb: dwc3: add rk3568 dwc3 support

Message ID 20220225145432.422130-7-pgwipeout@gmail.com (mailing list archive)
State New, archived
Headers show
Series enable usb support on rk356x | expand

Commit Message

Peter Geis Feb. 25, 2022, 2:54 p.m. UTC
The rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3
controller.
Add support for it to the dwc3-of-simple driver.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Riesch Feb. 25, 2022, 5:08 p.m. UTC | #1
Hi Peter,

On 2/25/22 15:54, Peter Geis wrote:
> The rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3
> controller.
> Add support for it to the dwc3-of-simple driver.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  drivers/usb/dwc3/dwc3-of-simple.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
> index 9dc6295df6b1..1d52a261af55 100644
> --- a/drivers/usb/dwc3/dwc3-of-simple.c
> +++ b/drivers/usb/dwc3/dwc3-of-simple.c
> @@ -49,7 +49,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
>  	 * Some controllers need to toggle the usb3-otg reset before trying to
>  	 * initialize the PHY, otherwise the PHY times out.
>  	 */
> -	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
> +	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3") |
> +	    of_device_is_compatible(np, "rockchip,rk3568-dwc3"))
>  		simple->need_reset = true;

Maybe read this value out the match data...

>  	simple->resets = of_reset_control_array_get(np, false, true,
> @@ -176,6 +177,7 @@ static const struct of_device_id of_dwc3_simple_match[] = {
>  	{ .compatible = "hisilicon,hi3670-dwc3" },
>  	{ .compatible = "intel,keembay-dwc3" },
>  	{ .compatible = "rockchip,rk3399-dwc3" },
> +	{ .compatible = "rockchip,rk3568-dwc3" },

... so all future variants that are compatible to the rk3399 can share it?

Best regards,
Michael

>  	{ .compatible = "sprd,sc9860-dwc3" },
>  	{ /* Sentinel */ }
>  };
Peter Geis Feb. 25, 2022, 5:55 p.m. UTC | #2
On Fri, Feb 25, 2022 at 12:08 PM Michael Riesch
<michael.riesch@wolfvision.net> wrote:
>
> Hi Peter,
>
> On 2/25/22 15:54, Peter Geis wrote:
> > The rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3
> > controller.
> > Add support for it to the dwc3-of-simple driver.
> >
> > Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> > ---
> >  drivers/usb/dwc3/dwc3-of-simple.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
> > index 9dc6295df6b1..1d52a261af55 100644
> > --- a/drivers/usb/dwc3/dwc3-of-simple.c
> > +++ b/drivers/usb/dwc3/dwc3-of-simple.c
> > @@ -49,7 +49,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
> >        * Some controllers need to toggle the usb3-otg reset before trying to
> >        * initialize the PHY, otherwise the PHY times out.
> >        */
> > -     if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
> > +     if (of_device_is_compatible(np, "rockchip,rk3399-dwc3") |
> > +         of_device_is_compatible(np, "rockchip,rk3568-dwc3"))
> >               simple->need_reset = true;
>
> Maybe read this value out the match data...

This is a good idea, thanks!

>
> >       simple->resets = of_reset_control_array_get(np, false, true,
> > @@ -176,6 +177,7 @@ static const struct of_device_id of_dwc3_simple_match[] = {
> >       { .compatible = "hisilicon,hi3670-dwc3" },
> >       { .compatible = "intel,keembay-dwc3" },
> >       { .compatible = "rockchip,rk3399-dwc3" },
> > +     { .compatible = "rockchip,rk3568-dwc3" },
>
> ... so all future variants that are compatible to the rk3399 can share it?
>
> Best regards,
> Michael
>
> >       { .compatible = "sprd,sc9860-dwc3" },
> >       { /* Sentinel */ }
> >  };
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index 9dc6295df6b1..1d52a261af55 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -49,7 +49,8 @@  static int dwc3_of_simple_probe(struct platform_device *pdev)
 	 * Some controllers need to toggle the usb3-otg reset before trying to
 	 * initialize the PHY, otherwise the PHY times out.
 	 */
-	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
+	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3") |
+	    of_device_is_compatible(np, "rockchip,rk3568-dwc3"))
 		simple->need_reset = true;
 
 	simple->resets = of_reset_control_array_get(np, false, true,
@@ -176,6 +177,7 @@  static const struct of_device_id of_dwc3_simple_match[] = {
 	{ .compatible = "hisilicon,hi3670-dwc3" },
 	{ .compatible = "intel,keembay-dwc3" },
 	{ .compatible = "rockchip,rk3399-dwc3" },
+	{ .compatible = "rockchip,rk3568-dwc3" },
 	{ .compatible = "sprd,sc9860-dwc3" },
 	{ /* Sentinel */ }
 };