usb: dwc2: correctly handle binding for g-tx-fifo-size
Subsystems (3)
PATCH v2 1/3 usb: dwc2: correctly handle binding for g-tx-fifo-size
Manage g-tx-fifo-size as a array as specify in the binding.
---
Changes in v2:
- move dt update in a separate patch
- remove unecessary temporary variable
drivers/usb/gadget/dwc2_udc_otg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg.c +13 -1
@@ -1039,6 +1039,7 @@ 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); +int ret;if (usb_get_dr_mode (node) !=USB_DR_MODE_PERIPHERAL ) {dev_dbg (dev,"Invalid mode\n" );
@@ -1050,7 +1051,18 @@ 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" , + platdata->tx_fifo_sz_array, + platdata->tx_fifo_sz_nb); +if (ret) +return ret; + } platdata->force_b_session_valid =dev_read_bool (dev,"u-boot,force-b-session-valid" );
Signature · 1 line
2.7.4
PATCH v2 2/3 ARM: dts: stm32mp1: remove override for g-tx-fifo-size
Remove the override for usbotg_hs on g-tx-fifo-size as the correct binding, used in the kernel device tree, is now supported in dwc2 device driver.
---
Changes in v2:
- move dt update in a separate patch
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0 -4
@@ -56,10 +56,6 @@ }; }; -&usbotg_hs { - g-tx-fifo-size = <576>; -}; - &v3v3 { regulator-always-on; };
Signature · 1 line
2.7.4
PATCH v2 2/3 ARM: dts: stm32mp1: remove override for g-tx-fifo-size
Hi Patrick
Quoted 18 lines · Patrick Delaunay
Remove the override for
usbotg_hson g-tx-fifo-size as the correct binding, used in the kernel device tree, is now supported in dwc2 device driver.Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- move dt update in a separate patcharch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 4 ---- 1 file changed, 4 deletions(-)arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0
-0
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi line 61
Quoted 10 lines
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +0
-4@@ -56,10 +56,6 @@ }; }; -&usbotg_hs { - g-tx-fifo-size = <576>; -}; - &v3v3 { regulator-always-on; };
Applied to uboot-stm
Thanks
PATCH v2 3/3 usb: dwc2: allow peripheral mode for OTG configuration
In reply to Patrick DelaunayAllow 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.
---
Changes in v2: None
drivers/usb/gadget/dwc2_udc_otg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg.c +2 -1
@@ -1041,7 +1041,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)void (*set_params)(struct dwc2_plat_otg_data *data);int ret; -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
PATCH v2 3/3 usb: dwc2: allow peripheral mode for OTG configuration
Quoted 6 lines · Patrick Delaunay
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.Signed-off-by Patrick Delaunay <[email protected]>
Quoted 22 lines
---
Changes in v2: None
drivers/usb/gadget/dwc2_udc_otg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/gadget/dwc2_udc_otg.c +2
-1@@ -1041,7 +1041,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)void (*set_params)(struct dwc2_plat_otg_data *data);int ret; -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 · 2 lines
Best regards, Marek Vasut
PATCH v2 3/3 usb: dwc2: allow peripheral mode for OTG configuration
Hi Patrick
Quoted 24 lines · Marek Vasut
Quoted 6 lines · Patrick Delaunay
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.Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Marek Vasut <[email protected]>Quoted 15 lines
---
Changes in v2: None
drivers/usb/gadget/dwc2_udc_otg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/gadget/dwc2_udc_otg.c +0
-0@@ -1041,7 +1041,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)void (*set_params)(struct dwc2_plat_otg_data *data);int ret;
Quoted 8 lines
drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1048
Quoted 7 lines
drivers/usb/gadget/dwc2_udc_otg.c +2
-1-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 ; }
Applied to uboot-stm
Thanks
PATCH v2 1/3 usb: dwc2: correctly handle binding for g-tx-fifo-size
In reply to Patrick DelaunayQuoted 3 lines · Patrick Delaunay
Manage g-tx-fifo-size as a array as specify in the binding.
Signed-off-by Patrick Delaunay <[email protected]>
I'm missing 2/3 , although I think it might be better if you take this whole series through u-boot-stm .
Quoted 42 lines
---
Changes in v2:
- move dt update in a separate patch
- remove unecessary temporary variabledrivers/usb/gadget/dwc2_udc_otg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/dwc2_udc_otg.c +13
-1@@ -1039,6 +1039,7 @@ 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); +int ret;if (usb_get_dr_mode (node) !=USB_DR_MODE_PERIPHERAL ) {dev_dbg (dev,"Invalid mode\n" );@@ -1050,7 +1051,18 @@ 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" , + platdata->tx_fifo_sz_array, + platdata->tx_fifo_sz_nb); +if (ret) +return ret; + } platdata->force_b_session_valid =dev_read_bool (dev,"u-boot,force-b-session-valid" );
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 1/3 usb: dwc2: correctly handle binding for g-tx-fifo-size
Hi Marek,
Quoted 4 lines
From: Marek Vasut <[email protected]>
Sent: mardi 18 juin 2019 18:46On 6/18/19 4:57 PM, Patrick Delaunay wrote:
Quoted 8 lines
Quoted 3 lines
Manage g-tx-fifo-size as a array as specify in the binding.
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Marek Vasut <[email protected]>I'm missing 2/3 , although I think it might be better if you take this whole series through u-boot-stm .
Ok thanks,
We (Patrice or me) we will take the serie on u-boot-stm.
Quoted 50 lines
drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct
Quoted 15 lines
---
Changes in v2:
- move dt update in a separate patch
- remove unecessary temporary variabledrivers/usb/gadget/dwc2_udc_otg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/dwc2_udc_otg.c +0
-0@@ -1039,6 +1039,7 @@ static int dwc2_udc_otg_ofdata_to_platdata(structudevice *dev)
drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct
Quoted 8 lines
drivers/usb/gadget/dwc2_udc_otg.c +1
-0int node =dev_of_offset (dev);ulong drvdata;void (*set_params)(struct dwc2_plat_otg_data *data); +int ret;if (usb_get_dr_mode (node) !=USB_DR_MODE_PERIPHERAL ) {dev_dbg (dev,"Invalid mode\n" );@@ -1050,7 +1051,18 @@ static int dwc2_udc_otg_ofdata_to_platdata(structudevice *dev)
Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +5
-1platdata->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 ;drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) · line 1068
Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +7
-0+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; + } platdata->force_b_session_valid =dev_read_bool (dev,"u-boot,force-b-session-valid" );--
Best regards,
Marek Vasut
PATCH v2 1/3 usb: dwc2: correctly handle binding for g-tx-fifo-size
In reply to Marek VasutHi Patrick
Quoted 8 lines · Marek Vasut
Quoted 3 lines · Patrick Delaunay
Manage g-tx-fifo-size as a array as specify in the binding.
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Marek Vasut <[email protected]>I'm missing 2/3 , although I think it might be better if you take this whole series through u-boot-stm .
Applied to uboot-stm
Thanks
Quoted 43 lines
Quoted 42 lines
---
Changes in v2:
- move dt update in a separate patch
- remove unecessary temporary variabledrivers/usb/gadget/dwc2_udc_otg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/dwc2_udc_otg.c +13
-1@@ -1039,6 +1039,7 @@ 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); +int ret;if (usb_get_dr_mode (node) !=USB_DR_MODE_PERIPHERAL ) {dev_dbg (dev,"Invalid mode\n" );@@ -1050,7 +1051,18 @@ 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" , + platdata->tx_fifo_sz_array, + platdata->tx_fifo_sz_nb); +if (ret) +return ret; + } platdata->force_b_session_valid =dev_read_bool (dev,"u-boot,force-b-session-valid" );