Skip to contentSkip to conversation

usb: dwc2: correctly handle binding for g-tx-fifo-size

PATCH Superseded Patrick Delaunay 2 participants 7 messages Jun 14, 2019 – Jun 18, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -4
index 5b19e44..994092a 100644
@@ -56,10 +56,6 @@
 	};
 };
 
-&usbotg_hs {
-	g-tx-fifo-size = <576>;
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +16 -1
index 494ab53..7e6b5fc 100644
@@ -1039,6 +1039,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];
+	int ret, i;
 
 	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) {
 		dev_dbg(dev, "Invalid mode\n");
@@ -1050,7 +1052,20 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
 	platdata->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0);
 	platdata->np_tx_fifo_sz = dev_read_u32_default(dev,
 						       "g-np-tx-fifo-size", 0);
-	platdata->tx_fifo_sz = dev_read_u32_default(dev, "g-tx-fifo-size", 0);
+
+	platdata->tx_fifo_sz_nb =
+		dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32);
+	if (platdata->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS)
+		platdata->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS;
+	if (platdata->tx_fifo_sz_nb) {
+		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
+					 tx_fifo_sz_array,
+					 platdata->tx_fifo_sz_nb);
+		if (ret)
+			return ret;
+		for (i = 0; i < platdata->tx_fifo_sz_nb; i++)
+			platdata->tx_fifo_sz_array[i] = tx_fifo_sz_array[i];
+	}
 
 	platdata->force_b_session_valid =
 		dev_read_bool(dev, "u-boot,force-b-session-valid");
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 usb: dwc2: allow peripheral mode for OTG configuration

Allow device mode in DWC2 driver when device tree select the dr_mode "peripheral" or "otg".

The device mode is not allowed when dr_mode = "host" in device tree.

---

 drivers/usb/gadget/dwc2_udc_otg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg.c +2 -1
index 7e6b5fc..895f8c9 100644
@@ -1042,7 +1042,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
 	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];
 	int ret, i;
 
-	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) {
+	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL &&
+	    usb_get_dr_mode(node) != USB_DR_MODE_OTG) {
 		dev_dbg(dev, "Invalid mode\n");
 		return -ENODEV;
 	}
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

In reply to Patrick Delaunay
Quoted 14 lines · Patrick Delaunay

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -0
index 5b19e44..994092a 100644

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 60

Quoted 5 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
@@ -56,10 +56,6 @@
 	};
 };
 
-&usbotg_hs {
-	g-tx-fifo-size = <576>;

Should this really be in this patch ?

Quoted 10 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 494ab53..7e6b5fc 100644

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1042

Quoted 4 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
@@ -1039,6 +1039,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];

Can't you just read directly into platdata->tx_fifo_sz_array[] below, and thus drop this temporary variable ?

btw is this fix for current release or next ?

Quoted 27 lines
drivers/usb/gadget/dwc2_udc_otg.c +15 -1
+	int ret, i;
 
 	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) {
 		dev_dbg(dev, "Invalid mode\n");
@@ -1050,7 +1052,20 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
 	platdata->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0);
 	platdata->np_tx_fifo_sz = dev_read_u32_default(dev,
 						       "g-np-tx-fifo-size", 0);
-	platdata->tx_fifo_sz = dev_read_u32_default(dev, "g-tx-fifo-size", 0);
+
+	platdata->tx_fifo_sz_nb =
+		dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32);
+	if (platdata->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS)
+		platdata->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS;
+	if (platdata->tx_fifo_sz_nb) {
+		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
+					 tx_fifo_sz_array,
+					 platdata->tx_fifo_sz_nb);
+		if (ret)
+			return ret;
+		for (i = 0; i < platdata->tx_fifo_sz_nb; i++)
+			platdata->tx_fifo_sz_array[i] = tx_fifo_sz_array[i];
+	}
 
 	platdata->force_b_session_valid =
 		dev_read_bool(dev, "u-boot,force-b-session-valid");
Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

Hi Marek,

Quoted 22 lines

From: Marek Vasut <[email protected]>
Sent: lundi 17 juin 2019 17:54

Quoted 18 lines · Patrick Delaunay

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -0
index 5b19e44..994092a 100644
@@ -56,10 +56,6 @@
 	};
 };
 
Quoted 4 lines

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 60

Quoted 2 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-&usbotg_hs {
-	g-tx-fifo-size = <576>;

Should this really be in this patch ?

As I change the binding parsing, the stm32mp1 will don't work without this patch. I make a commun patch only to allow bisec, but I can split the serie with 2 patches.

Quoted 13 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct

Quoted 12 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 494ab53..7e6b5fc 100644
@@ -1039,6 +1039,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct

udevice *dev)

Quoted 7 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1042

Quoted 4 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];

Can't you just read directly into platdata->tx_fifo_sz_array[] below, and thus drop this temporary variable ?

It was the case in in my first internal version.

if (platdata->tx_fifo_sz_nb) {
		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
					 &platdata->tx_fifo_sz_array,
					 platdata->tx_fifo_sz_nb);
		if (ret)
			return ret;
	}

And I add it to avoid the warning / potential issue:

/local/home/frq07632/views/u-boot/u-boot/drivers/usb/gadget/dwc2_udc_otg.c:1062:7:

	warning: passing argument 3 of ‘dev_read_u32_array’ from incompatible pointer type [-Wincompatible-pointer-types]
       &platdata->tx_fifo_sz_array,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /local/home/frq07632/views/u-boot/u-boot/include/dm.h:12,
             from /local/home/frq07632/views/u-boot/u-boot/drivers/usb/gadget/dwc2_udc_otg.c:22:
	/local/home/frq07632/views/u-boot/u-boot/include/dm/read.h:710:15: note: expected ‘u32 *’ {aka ‘unsigned int *’} but argument is of type ‘unsigned int (*)[16]’
          u32 *out_values, size_t sz)
          ~~~~~^~~~~~~~~~
Quoted 1 line

btw is this fix for current release or next ?

I hope it for the v2019.07 (as it is only impact the stm32mp1 arch/board). But it is not blocking.

Quoted 26 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct

Quoted 6 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
+	int ret, i;
 
 	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) {
 		dev_dbg(dev, "Invalid mode\n");
@@ -1050,7 +1052,20 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct

udevice *dev)

Quoted 19 lines
drivers/usb/gadget/dwc2_udc_otg.c +14 -1
 	platdata->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0);
 	platdata->np_tx_fifo_sz = dev_read_u32_default(dev,
 						       "g-np-tx-fifo-size", 0);
-	platdata->tx_fifo_sz = dev_read_u32_default(dev, "g-tx-fifo-size", 0);
+
+	platdata->tx_fifo_sz_nb =
+		dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32);
+	if (platdata->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS)
+		platdata->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS;
+	if (platdata->tx_fifo_sz_nb) {
+		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
+					 tx_fifo_sz_array,
+					 platdata->tx_fifo_sz_nb);
+		if (ret)
+			return ret;
+		for (i = 0; i < platdata->tx_fifo_sz_nb; i++)
+			platdata->tx_fifo_sz_array[i] = tx_fifo_sz_array[i];
+	}
 
Quoted 8 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1071

Quoted 3 lines
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
 	platdata->force_b_session_valid =
 		dev_read_bool(dev, "u-boot,force-b-session-valid");

--
Best regards,
Marek Vasut

Regards

Patrick

#4 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

Quoted 66 lines · Patrick DELAUNAY

Hi Marek,

Quoted 22 lines

From: Marek Vasut <[email protected]>
Sent: lundi 17 juin 2019 17:54

Quoted 18 lines · Patrick Delaunay

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -0
index 5b19e44..994092a 100644
@@ -56,10 +56,6 @@
 	};
 };
 
Quoted 4 lines

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 60

Quoted 2 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-&usbotg_hs {
-	g-tx-fifo-size = <576>;

Should this really be in this patch ?

As I change the binding parsing, the stm32mp1 will don't work without this patch. I make a commun patch only to allow bisec, but I can split the serie with 2 patches.

Quoted 13 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct

Quoted 12 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 494ab53..7e6b5fc 100644
@@ -1039,6 +1039,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct

udevice *dev)

Quoted 7 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1042

Quoted 4 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];

Can't you just read directly into platdata->tx_fifo_sz_array[] below, and thus drop this temporary variable ?

It was the case in in my first internal version.

if (platdata->tx_fifo_sz_nb) {
		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
					 &platdata->tx_fifo_sz_array,
					 platdata->tx_fifo_sz_nb);
		if (ret)
			return ret;
	}

And I add it to avoid the warning / potential issue:

/local/home/frq07632/views/u-boot/u-boot/drivers/usb/gadget/dwc2_udc_otg.c:1062:7:

Quoted 8 lines
	warning: passing argument 3 of ‘dev_read_u32_array’ from incompatible pointer type [-Wincompatible-pointer-types]
       &platdata->tx_fifo_sz_array,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /local/home/frq07632/views/u-boot/u-boot/include/dm.h:12,
             from /local/home/frq07632/views/u-boot/u-boot/drivers/usb/gadget/dwc2_udc_otg.c:22:
	/local/home/frq07632/views/u-boot/u-boot/include/dm/read.h:710:15: note: expected ‘u32 *’ {aka ‘unsigned int *’} but argument is of type ‘unsigned int (*)[16]’
          u32 *out_values, size_t sz)
          ~~~~~^~~~~~~~~~

Looks like GCC is complaining because you're passing an array of pointers to dev_read_u32_array() , instead of plain pointer .

Try

ret = dev_read_u32_array(dev, "g-tx-fifo-size",
- &platdata->tx_fifo_sz_array,
+ platdata->tx_fifo_sz_array,
platdata->tx_fifo_sz_nb);

Quoted 4 lines
Quoted 1 line

btw is this fix for current release or next ?

I hope it for the v2019.07 (as it is only impact the stm32mp1 arch/board). But it is not blocking.

OK

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

Hi Marek

Quoted 91 lines

From: Marek Vasut <[email protected]>
Sent: mardi 18 juin 2019 12:49

Quoted 24 lines · Patrick DELAUNAY

Hi Marek,

Quoted 22 lines

From: Marek Vasut <[email protected]>
Sent: lundi 17 juin 2019 17:54

Quoted 18 lines · Patrick Delaunay

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -0
index 5b19e44..994092a 100644
@@ -56,10 +56,6 @@
 	};
 };
 
Quoted 6 lines
Quoted 4 lines

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 60

Quoted 2 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-&usbotg_hs {
-	g-tx-fifo-size = <576>;

Should this really be in this patch ?

As I change the binding parsing, the stm32mp1 will don't work without this

patch.

Quoted 1 line

I make a commun patch only to allow bisec, but I can split the serie with 2

patches.

Quoted 33 lines
Quoted 15 lines
Quoted 13 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 494ab53..7e6b5fc 100644
@@ -1039,6 +1039,8 @@ static int
Quoted 1 line

dwc2_udc_otg_ofdata_to_platdata(struct

udevice *dev)

Quoted 7 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1042

Quoted 4 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];

Can't you just read directly into platdata->tx_fifo_sz_array[] below, and thus drop this temporary variable ?

It was the case in in my first internal version.

if (platdata->tx_fifo_sz_nb) {
		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
					 &platdata->tx_fifo_sz_array,
					 platdata->tx_fifo_sz_nb);
		if (ret)
			return ret;
	}
Quoted 3 lines

And I add it to avoid the warning / potential issue:

/local/home/frq07632/views/u-boot/u-

boot/drivers/usb/gadget/dwc2_udc_otg.c:1062:7:

Quoted 1 line

warning: passing argument 3 of ‘dev_read_u32_array’ from incompatible

pointer type [-Wincompatible-pointer-types]

Quoted 4 lines
       &platdata->tx_fifo_sz_array,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /local/home/frq07632/views/u-boot/u-boot/include/dm.h:12,
             from /local/home/frq07632/views/u-boot/u-

boot/drivers/usb/gadget/dwc2_udc_otg.c:22:

Quoted 1 line
	/local/home/frq07632/views/u-boot/u-boot/include/dm/read.h:710:15: note:

expected ‘u32 *’ {aka ‘unsigned int *’} but argument is of type ‘unsigned int (*)[16]’

Quoted 2 lines
          u32 *out_values, size_t sz)
          ~~~~~^~~~~~~~~~

Looks like GCC is complaining because you're passing an array of pointers to dev_read_u32_array() , instead of plain pointer .

Try

Review

Quoted 4 lines
(quoted diff) +1 -1
 		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
- 					 &platdata->tx_fifo_sz_array,
+ 					 platdata->tx_fifo_sz_array,
 					 platdata->tx_fifo_sz_nb);

You are right, it is working
I don't double check the type of the buffer :-<
=> I will push update in V2

Quoted 10 lines
Quoted 4 lines
Quoted 1 line

btw is this fix for current release or next ?

I hope it for the v2019.07 (as it is only impact the stm32mp1 arch/board). But it is not blocking.

OK

--
Best regards,
Marek Vasut

#6 lore raw

PATCH 1/2 usb: dwc2: correctly handle binding for g-tx-fifo-size

Quoted 93 lines · Patrick DELAUNAY

Hi Marek

Quoted 91 lines

From: Marek Vasut <[email protected]>
Sent: mardi 18 juin 2019 12:49

Quoted 24 lines · Patrick DELAUNAY

Hi Marek,

Quoted 22 lines

From: Marek Vasut <[email protected]>
Sent: lundi 17 juin 2019 17:54

Quoted 18 lines · Patrick Delaunay

Manage g-tx-fifo-size as a array as specify in the binding.

---

 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  4 ----
 drivers/usb/gadget/dwc2_udc_otg.c        | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -0
index 5b19e44..994092a 100644
@@ -56,10 +56,6 @@
 	};
 };
 
Quoted 6 lines
Quoted 4 lines

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 60

Quoted 2 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-&usbotg_hs {
-	g-tx-fifo-size = <576>;

Should this really be in this patch ?

As I change the binding parsing, the stm32mp1 will don't work without this

patch.

Quoted 1 line

I make a commun patch only to allow bisec, but I can split the serie with 2

patches.

Quoted 33 lines
Quoted 15 lines
Quoted 13 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -2
-};
-
 &v3v3 {
 	regulator-always-on;
 };
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 494ab53..7e6b5fc 100644
@@ -1039,6 +1039,8 @@ static int
Quoted 1 line

dwc2_udc_otg_ofdata_to_platdata(struct

udevice *dev)

Quoted 7 lines

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1042

Quoted 4 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
 	int node = dev_of_offset(dev);
 	ulong drvdata;
 	void (*set_params)(struct dwc2_plat_otg_data *data);
+	u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];

Can't you just read directly into platdata->tx_fifo_sz_array[] below, and thus drop this temporary variable ?

It was the case in in my first internal version.

if (platdata->tx_fifo_sz_nb) {
		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
					 &platdata->tx_fifo_sz_array,
					 platdata->tx_fifo_sz_nb);
		if (ret)
			return ret;
	}
Quoted 3 lines

And I add it to avoid the warning / potential issue:

/local/home/frq07632/views/u-boot/u-

boot/drivers/usb/gadget/dwc2_udc_otg.c:1062:7:

Quoted 1 line

warning: passing argument 3 of ‘dev_read_u32_array’ from incompatible

pointer type [-Wincompatible-pointer-types]

Quoted 4 lines
       &platdata->tx_fifo_sz_array,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /local/home/frq07632/views/u-boot/u-boot/include/dm.h:12,
             from /local/home/frq07632/views/u-boot/u-

boot/drivers/usb/gadget/dwc2_udc_otg.c:22:

Quoted 1 line
	/local/home/frq07632/views/u-boot/u-boot/include/dm/read.h:710:15: note:

expected ‘u32 *’ {aka ‘unsigned int *’} but argument is of type ‘unsigned int (*)[16]’

Quoted 2 lines
          u32 *out_values, size_t sz)
          ~~~~~^~~~~~~~~~

Looks like GCC is complaining because you're passing an array of pointers to dev_read_u32_array() , instead of plain pointer .

Try

Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
 		ret = dev_read_u32_array(dev, "g-tx-fifo-size",
- 					 &platdata->tx_fifo_sz_array,
+ 					 platdata->tx_fifo_sz_array,
 					 platdata->tx_fifo_sz_nb);

You are right, it is working
I don't double check the type of the buffer :-<
=> I will push update in V2

Thanks

Signature · 2 lines
Best regards,
Marek Vasut