linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuse
@ 2021-08-11 15:52 Geert Uytterhoeven
  2021-08-11 18:44 ` Niklas Söderlund
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2021-08-11 15:52 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Fabrizio Castro, Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb, linux-renesas-soc, Geert Uytterhoeven

soc_device_match() is intended as a last resort, to handle e.g. quirks
that cannot be handled by matching based on a compatible value.

As the device nodes for the Renesas USB 3.0 Peripheral Controller on
R-Car E3 and RZ/G2E do have SoC-specific compatible values, the latter
can and should be used to match against these devices.

This also fixes support for the USB 3.0 Peripheral Controller on the
R-Car E3e (R8A779M6) SoC, which is a different grading of the R-Car E3
(R8A77990) SoC, using the same SoC-specific compatible value.

Fixes: 30025efa8b5e75f5 ("usb: gadget: udc: renesas_usb3: add support for r8a77990")
Fixes: 546970fdab1da5fe ("usb: gadget: udc: renesas_usb3: add support for r8a774c0")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index f1b35a39d1ba8712..57d417a7c3e0a687 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2707,10 +2707,15 @@ static const struct renesas_usb3_priv renesas_usb3_priv_r8a77990 = {
 
 static const struct of_device_id usb3_of_match[] = {
 	{
+		.compatible = "renesas,r8a774c0-usb3-peri",
+		.data = &renesas_usb3_priv_r8a77990,
+	}, {
 		.compatible = "renesas,r8a7795-usb3-peri",
 		.data = &renesas_usb3_priv_gen3,
-	},
-	{
+	}, {
+		.compatible = "renesas,r8a77990-usb3-peri",
+		.data = &renesas_usb3_priv_r8a77990,
+	}, {
 		.compatible = "renesas,rcar-gen3-usb3-peri",
 		.data = &renesas_usb3_priv_gen3,
 	},
@@ -2719,18 +2724,10 @@ static const struct of_device_id usb3_of_match[] = {
 MODULE_DEVICE_TABLE(of, usb3_of_match);
 
 static const struct soc_device_attribute renesas_usb3_quirks_match[] = {
-	{
-		.soc_id = "r8a774c0",
-		.data = &renesas_usb3_priv_r8a77990,
-	},
 	{
 		.soc_id = "r8a7795", .revision = "ES1.*",
 		.data = &renesas_usb3_priv_r8a7795_es1,
 	},
-	{
-		.soc_id = "r8a77990",
-		.data = &renesas_usb3_priv_r8a77990,
-	},
 	{ /* sentinel */ },
 };
 
-- 
2.25.1


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

* Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuse
  2021-08-11 15:52 [PATCH] usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuse Geert Uytterhoeven
@ 2021-08-11 18:44 ` Niklas Söderlund
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Söderlund @ 2021-08-11 18:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshihiro Shimoda, Fabrizio Castro, Felipe Balbi,
	Greg Kroah-Hartman, linux-usb, linux-renesas-soc

Hello Geert,

Thanks for your work.

On 2021-08-11 17:52:54 +0200, Geert Uytterhoeven wrote:
> soc_device_match() is intended as a last resort, to handle e.g. quirks
> that cannot be handled by matching based on a compatible value.
> 
> As the device nodes for the Renesas USB 3.0 Peripheral Controller on
> R-Car E3 and RZ/G2E do have SoC-specific compatible values, the latter
> can and should be used to match against these devices.
> 
> This also fixes support for the USB 3.0 Peripheral Controller on the
> R-Car E3e (R8A779M6) SoC, which is a different grading of the R-Car E3
> (R8A77990) SoC, using the same SoC-specific compatible value.
> 
> Fixes: 30025efa8b5e75f5 ("usb: gadget: udc: renesas_usb3: add support for r8a77990")
> Fixes: 546970fdab1da5fe ("usb: gadget: udc: renesas_usb3: add support for r8a774c0")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/usb/gadget/udc/renesas_usb3.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index f1b35a39d1ba8712..57d417a7c3e0a687 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -2707,10 +2707,15 @@ static const struct renesas_usb3_priv renesas_usb3_priv_r8a77990 = {
>  
>  static const struct of_device_id usb3_of_match[] = {
>  	{
> +		.compatible = "renesas,r8a774c0-usb3-peri",
> +		.data = &renesas_usb3_priv_r8a77990,
> +	}, {
>  		.compatible = "renesas,r8a7795-usb3-peri",
>  		.data = &renesas_usb3_priv_gen3,
> -	},
> -	{
> +	}, {
> +		.compatible = "renesas,r8a77990-usb3-peri",
> +		.data = &renesas_usb3_priv_r8a77990,
> +	}, {
>  		.compatible = "renesas,rcar-gen3-usb3-peri",
>  		.data = &renesas_usb3_priv_gen3,
>  	},
> @@ -2719,18 +2724,10 @@ static const struct of_device_id usb3_of_match[] = {
>  MODULE_DEVICE_TABLE(of, usb3_of_match);
>  
>  static const struct soc_device_attribute renesas_usb3_quirks_match[] = {
> -	{
> -		.soc_id = "r8a774c0",
> -		.data = &renesas_usb3_priv_r8a77990,
> -	},
>  	{
>  		.soc_id = "r8a7795", .revision = "ES1.*",
>  		.data = &renesas_usb3_priv_r8a7795_es1,
>  	},
> -	{
> -		.soc_id = "r8a77990",
> -		.data = &renesas_usb3_priv_r8a77990,
> -	},
>  	{ /* sentinel */ },
>  };
>  
> -- 
> 2.25.1
> 

-- 
Regards,
Niklas Söderlund

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

end of thread, other threads:[~2021-08-11 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 15:52 [PATCH] usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuse Geert Uytterhoeven
2021-08-11 18:44 ` Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).