diff mbox series

[v4,3/3] usb: dwc3: Pass quirk as platform data

Message ID b3dbe5d9de39fb5105b8474e9c560917a78e2c63.1602592488.git.joglekar@synopsys.com
State Superseded
Headers show
Series Add logic to consolidate TRBs for Synopsys xHC | expand

Commit Message

Tejas Joglekar Oct. 13, 2020, 12:44 p.m. UTC
This commit adds the platform device data to setup
the XHCI_SG_TRB_CACHE_SIZE_QUIRK quirk. DWC3 hosts
which are PCI devices does not use OF to create platform device
but create xhci-plat platform device runtime. So
this patch allow parent device to supply the quirk
through platform data.

Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
---
 drivers/usb/dwc3/host.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Sergei Shtylyov Oct. 14, 2020, 8:37 a.m. UTC | #1
Hello!

On 13.10.2020 15:44, Tejas Joglekar wrote:

> This commit adds the platform device data to setup
> the XHCI_SG_TRB_CACHE_SIZE_QUIRK quirk. DWC3 hosts
> which are PCI devices does not use OF to create platform device
> but create xhci-plat platform device runtime. So
                                       ^ at

> this patch allow parent device to supply the quirk

    Allows.

> through platform data.
> 
> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
> ---
>   drivers/usb/dwc3/host.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index e195176580de..dd7c742333f7 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -11,6 +11,15 @@
>   #include <linux/platform_device.h>
>   
>   #include "core.h"
> +#include "../host/xhci-plat.h"
> +
> +static const struct xhci_plat_priv dwc3_pdata = {
> +	.plat_start = NULL,
> +	.init_quirk = NULL,
> +	.suspend_quirk = NULL,
> +	.resume_quirk = NULL,

    Why not rely on the compiler to fill these with zeros?

> +	.quirks = XHCI_SG_TRB_CACHE_SIZE_QUIRK,
> +};
>   
>   static int dwc3_host_get_irq(struct dwc3 *dwc)
>   {
[...]

MBR, Sergei
Tejas Joglekar Oct. 14, 2020, 2:28 p.m. UTC | #2
Hi,
On 10/14/2020 2:07 PM, Sergei Shtylyov wrote:
> Hello!

> 

> On 13.10.2020 15:44, Tejas Joglekar wrote:

> 

>> This commit adds the platform device data to setup

>> the XHCI_SG_TRB_CACHE_SIZE_QUIRK quirk. DWC3 hosts

>> which are PCI devices does not use OF to create platform device

>> but create xhci-plat platform device runtime. So

>                                       ^ at

> 

>> this patch allow parent device to supply the quirk

> 

>    Allows.

> 

Noted.
>> through platform data.

>>

>> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>

>> ---

>>   drivers/usb/dwc3/host.c | 14 ++++++++++++++

>>   1 file changed, 14 insertions(+)

>>

>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c

>> index e195176580de..dd7c742333f7 100644

>> --- a/drivers/usb/dwc3/host.c

>> +++ b/drivers/usb/dwc3/host.c

>> @@ -11,6 +11,15 @@

>>   #include <linux/platform_device.h>

>>     #include "core.h"

>> +#include "../host/xhci-plat.h"

>> +

>> +static const struct xhci_plat_priv dwc3_pdata = {

>> +    .plat_start = NULL,

>> +    .init_quirk = NULL,

>> +    .suspend_quirk = NULL,

>> +    .resume_quirk = NULL,

> 

>    Why not rely on the compiler to fill these with zeros?

> 

Sure I will update
>> +    .quirks = XHCI_SG_TRB_CACHE_SIZE_QUIRK,

>> +};

>>     static int dwc3_host_get_irq(struct dwc3 *dwc)

>>   {

> [...]

> 

> MBR, Sergei


Thanks & Regards,
 Tejas Joglekar
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index e195176580de..dd7c742333f7 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -11,6 +11,15 @@ 
 #include <linux/platform_device.h>
 
 #include "core.h"
+#include "../host/xhci-plat.h"
+
+static const struct xhci_plat_priv dwc3_pdata = {
+	.plat_start = NULL,
+	.init_quirk = NULL,
+	.suspend_quirk = NULL,
+	.resume_quirk = NULL,
+	.quirks = XHCI_SG_TRB_CACHE_SIZE_QUIRK,
+};
 
 static int dwc3_host_get_irq(struct dwc3 *dwc)
 {
@@ -87,6 +96,11 @@  int dwc3_host_init(struct dwc3 *dwc)
 		goto err;
 	}
 
+	ret = platform_device_add_data(xhci, &dwc3_pdata, sizeof(dwc3_pdata));
+	if (ret) {
+		dev_err(dwc->dev, "couldn't add platform data to xHCI device\n");
+		goto err;
+	}
 	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
 
 	if (dwc->usb3_lpm_capable)