mbox series

[v4,00/10] Introduced new Cadence USBSSP DRD Driver.

Message ID 20201202132548.10736-1-pawell@cadence.com
Headers show
Series Introduced new Cadence USBSSP DRD Driver. | expand

Message

Pawel Laszczak Dec. 2, 2020, 1:25 p.m. UTC
This patch introduce new Cadence USBSS DRD driver to linux kernel.

The Cadence USBSS DRD Controller is a highly configurable IP Core which
can be instantiated as Dual-Role Device (DRD), Peripheral Only and
Host Only (XHCI)configurations.

The current driver has been validated with FPGA burned. We have support
for PCIe bus, which is used on FPGA prototyping.

The host side of USBSS-DRD controller is compliance with XHCI
specification, so it works with standard XHCI Linux driver.

The device side of USBSS DRD controller is compliant with XHCI.
The architecture for device side is almost the same as for host side,
and most of the XHCI specification can be used to understand how
this controller operates.

This controller and driver support Full Speed, Hight Speed, Supper Speed
and Supper Speed Plus USB protocol.

The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.
The last letter of this acronym means PLUS. The formal name of controller
is USBSSP but it's to generic so I've decided to use CDNSP.

The patch 1: adds support for DRD CDNSP.
The patch 2: separates common code that can be reusable by cdnsp driver.
The patch 3: moves reusable code to separate module.
The patch 4: changes prefixes in reusable code from cdns3 to common cdns.
The patch 5: adopts gadget_dev pointer in cdns structure to make possible 
             use it in both drivers.
The patches 6-8: add the main part of driver and has been intentionally
             split into 3 part. In my opinion such division should not
             affect understanding and reviewing the driver, and cause that
             main patch (7/8) is little smaller. Patch 6 introduces main
             header file for driver, 7 is the main part that implements all
             functionality of driver and 8 introduces tracepoints.
The patch 9: Adds cdns3 prefixes to files related with USBSS driver.
the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.

Changlog from v3:
- added 'T' to MAINTAINERS file for CDNSP entry
- updated common code with latest cdns3 fixes

Changlog from v2:
- removed not used pdev parameter from cdnsp_read/wite_64 functions
- fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)
- replaced some constant value with CDNSP_ENDPOINTS_NUM macro
- replaced 'true' with '1' in bits description in cdnsp-gadget.h file
- fixed some typos
- some other less important changes suggested by Peter Chen

Changlog from v1:
- updated common code to latest cdns3 driver
- moved cdnsp driver files to cdns3 as sugested by Peter Chan
- removed duplicate code from cdnsp_ep0_set_config function
- added cdns3 prefixes to file related with USBSS driver
- updated MAINTAINERS file
- fixed issue with U1
- fixed issue with L1
- some less improtant changes sugested by Chunfeng Yun
---

Pawel Laszczak (10):
  usb: cdns3: Add support for DRD CDNSP
  usb: cdns3: Split core.c into cdns3-plat and core.c file
  usb: cdns3: Moves reusable code to separate module
  usb: cdns3: Refactoring names in reusable code
  usb: cdns3: Changed type of gadget_dev in cdns structure
  usb: cdnsp: Device side header file for CDNSP driver
  usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver
  usb: cdnsp: Add tracepoints for CDNSP driver
  usb: cdns3: Change file names for cdns3 driver.
  MAINTAINERS: add Cadence USBSSP DRD IP driver entry

 MAINTAINERS                                   |    9 +
 drivers/usb/Makefile                          |    2 +
 drivers/usb/cdns3/Kconfig                     |   61 +-
 drivers/usb/cdns3/Makefile                    |   30 +-
 drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0
 drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-
 .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-
 .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0
 drivers/usb/cdns3/cdns3-imx.c                 |    2 +-
 drivers/usb/cdns3/cdns3-plat.c                |  315 +++
 drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-
 drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-
 drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++
 drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++
 drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++
 drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++
 drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++
 drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++
 drivers/usb/cdns3/cdnsp-ring.c                | 2439 +++++++++++++++++
 drivers/usb/cdns3/cdnsp-trace.c               |   12 +
 drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++
 drivers/usb/cdns3/core.c                      |  455 +--
 drivers/usb/cdns3/core.h                      |   54 +-
 drivers/usb/cdns3/drd.c                       |  222 +-
 drivers/usb/cdns3/drd.h                       |   94 +-
 drivers/usb/cdns3/gadget-export.h             |   22 +-
 drivers/usb/cdns3/host-export.h               |   13 +-
 drivers/usb/cdns3/host.c                      |   22 +-
 28 files changed, 10400 insertions(+), 507 deletions(-)
 rename drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)
 rename drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)
 rename drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)
 rename drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)
 create mode 100644 drivers/usb/cdns3/cdns3-plat.c
 rename drivers/usb/cdns3/{trace.c => cdns3-trace.c} (89%)
 rename drivers/usb/cdns3/{trace.h => cdns3-trace.h} (99%)
 create mode 100644 drivers/usb/cdns3/cdnsp-debug.h
 create mode 100644 drivers/usb/cdns3/cdnsp-ep0.c
 create mode 100644 drivers/usb/cdns3/cdnsp-gadget.c
 create mode 100644 drivers/usb/cdns3/cdnsp-gadget.h
 create mode 100644 drivers/usb/cdns3/cdnsp-mem.c
 create mode 100644 drivers/usb/cdns3/cdnsp-pci.c
 create mode 100644 drivers/usb/cdns3/cdnsp-ring.c
 create mode 100644 drivers/usb/cdns3/cdnsp-trace.c
 create mode 100644 drivers/usb/cdns3/cdnsp-trace.h

Comments

Peter Chen Dec. 4, 2020, 1:19 a.m. UTC | #1
> This patch introduce new Cadence USBSS DRD driver to linux kernel.

> 

> The Cadence USBSS DRD Controller is a highly configurable IP Core which can

> be instantiated as Dual-Role Device (DRD), Peripheral Only and Host Only

> (XHCI)configurations.

> 

> The current driver has been validated with FPGA burned. We have support for

> PCIe bus, which is used on FPGA prototyping.

> 

> The host side of USBSS-DRD controller is compliance with XHCI specification, so

> it works with standard XHCI Linux driver.

> 

> The device side of USBSS DRD controller is compliant with XHCI.

> The architecture for device side is almost the same as for host side, and most

> of the XHCI specification can be used to understand how this controller

> operates.

> 

> This controller and driver support Full Speed, Hight Speed, Supper Speed and

> Supper Speed Plus USB protocol.

> 

> The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.

> The last letter of this acronym means PLUS. The formal name of controller is

> USBSSP but it's to generic so I've decided to use CDNSP.

> 

> The patch 1: adds support for DRD CDNSP.

> The patch 2: separates common code that can be reusable by cdnsp driver.

> The patch 3: moves reusable code to separate module.

> The patch 4: changes prefixes in reusable code from cdns3 to common cdns.

> The patch 5: adopts gadget_dev pointer in cdns structure to make possible

>              use it in both drivers.

> The patches 6-8: add the main part of driver and has been intentionally

>              split into 3 part. In my opinion such division should not

>              affect understanding and reviewing the driver, and cause that

>              main patch (7/8) is little smaller. Patch 6 introduces main

>              header file for driver, 7 is the main part that implements all

>              functionality of driver and 8 introduces tracepoints.

> The patch 9: Adds cdns3 prefixes to files related with USBSS driver.

> the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.

> 


Hi Roger & Sekhar,

Would you please test this patch set and see if it works well at TI platforms?

Peter

> Changlog from v3:

> - added 'T' to MAINTAINERS file for CDNSP entry

> - updated common code with latest cdns3 fixes

> 

> Changlog from v2:

> - removed not used pdev parameter from cdnsp_read/wite_64 functions

> - fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)

> - replaced some constant value with CDNSP_ENDPOINTS_NUM macro

> - replaced 'true' with '1' in bits description in cdnsp-gadget.h file

> - fixed some typos

> - some other less important changes suggested by Peter Chen

> 

> Changlog from v1:

> - updated common code to latest cdns3 driver

> - moved cdnsp driver files to cdns3 as sugested by Peter Chan

> - removed duplicate code from cdnsp_ep0_set_config function

> - added cdns3 prefixes to file related with USBSS driver

> - updated MAINTAINERS file

> - fixed issue with U1

> - fixed issue with L1

> - some less improtant changes sugested by Chunfeng Yun

> ---

> 

> Pawel Laszczak (10):

>   usb: cdns3: Add support for DRD CDNSP

>   usb: cdns3: Split core.c into cdns3-plat and core.c file

>   usb: cdns3: Moves reusable code to separate module

>   usb: cdns3: Refactoring names in reusable code

>   usb: cdns3: Changed type of gadget_dev in cdns structure

>   usb: cdnsp: Device side header file for CDNSP driver

>   usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver

>   usb: cdnsp: Add tracepoints for CDNSP driver

>   usb: cdns3: Change file names for cdns3 driver.

>   MAINTAINERS: add Cadence USBSSP DRD IP driver entry

> 

>  MAINTAINERS                                   |    9 +

>  drivers/usb/Makefile                          |    2 +

>  drivers/usb/cdns3/Kconfig                     |   61 +-

>  drivers/usb/cdns3/Makefile                    |   30 +-

>  drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0

>  drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-

>  .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-

>  .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0

>  drivers/usb/cdns3/cdns3-imx.c                 |    2 +-

>  drivers/usb/cdns3/cdns3-plat.c                |  315 +++

>  drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-

>  drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-

>  drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++

>  drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++

>  drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++

>  drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++

>  drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++

>  drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++

>  drivers/usb/cdns3/cdnsp-ring.c                | 2439

> +++++++++++++++++

>  drivers/usb/cdns3/cdnsp-trace.c               |   12 +

>  drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++

>  drivers/usb/cdns3/core.c                      |  455 +--

>  drivers/usb/cdns3/core.h                      |   54 +-

>  drivers/usb/cdns3/drd.c                       |  222 +-

>  drivers/usb/cdns3/drd.h                       |   94 +-

>  drivers/usb/cdns3/gadget-export.h             |   22 +-

>  drivers/usb/cdns3/host-export.h               |   13 +-

>  drivers/usb/cdns3/host.c                      |   22 +-

>  28 files changed, 10400 insertions(+), 507 deletions(-)  rename

> drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)  rename

> drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)  rename

> drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)  rename

> drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)  create mode 100644

> drivers/usb/cdns3/cdns3-plat.c  rename drivers/usb/cdns3/{trace.c =>

> cdns3-trace.c} (89%)  rename drivers/usb/cdns3/{trace.h => cdns3-trace.h}

> (99%)  create mode 100644 drivers/usb/cdns3/cdnsp-debug.h  create mode

> 100644 drivers/usb/cdns3/cdnsp-ep0.c  create mode 100644

> drivers/usb/cdns3/cdnsp-gadget.c  create mode 100644

> drivers/usb/cdns3/cdnsp-gadget.h  create mode 100644

> drivers/usb/cdns3/cdnsp-mem.c  create mode 100644

> drivers/usb/cdns3/cdnsp-pci.c  create mode 100644

> drivers/usb/cdns3/cdnsp-ring.c  create mode 100644

> drivers/usb/cdns3/cdnsp-trace.c  create mode 100644

> drivers/usb/cdns3/cdnsp-trace.h

> 

> --

> 2.17.1
Peter Chen Dec. 4, 2020, 3:10 a.m. UTC | #2
On 20-12-02 14:25:38, Pawel Laszczak wrote:
> This patch introduce new Cadence USBSS DRD driver to linux kernel.

> 

> The Cadence USBSS DRD Controller is a highly configurable IP Core which

> can be instantiated as Dual-Role Device (DRD), Peripheral Only and

> Host Only (XHCI)configurations.

> 

> The current driver has been validated with FPGA burned. We have support

> for PCIe bus, which is used on FPGA prototyping.

> 

> The host side of USBSS-DRD controller is compliance with XHCI

> specification, so it works with standard XHCI Linux driver.

> 

> The device side of USBSS DRD controller is compliant with XHCI.

> The architecture for device side is almost the same as for host side,

> and most of the XHCI specification can be used to understand how

> this controller operates.

> 

> This controller and driver support Full Speed, Hight Speed, Supper Speed

> and Supper Speed Plus USB protocol.

> 

> The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.

> The last letter of this acronym means PLUS. The formal name of controller

> is USBSSP but it's to generic so I've decided to use CDNSP.

> 

> The patch 1: adds support for DRD CDNSP.

> The patch 2: separates common code that can be reusable by cdnsp driver.

> The patch 3: moves reusable code to separate module.

> The patch 4: changes prefixes in reusable code from cdns3 to common cdns.

> The patch 5: adopts gadget_dev pointer in cdns structure to make possible 

>              use it in both drivers.

> The patches 6-8: add the main part of driver and has been intentionally

>              split into 3 part. In my opinion such division should not

>              affect understanding and reviewing the driver, and cause that

>              main patch (7/8) is little smaller. Patch 6 introduces main

>              header file for driver, 7 is the main part that implements all

>              functionality of driver and 8 introduces tracepoints.

> The patch 9: Adds cdns3 prefixes to files related with USBSS driver.

> the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.


Hi Pawel,

You may need to fix below:


diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index 04bccf6daaba..30d69b639492 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2018-2020 Cadence.
  * Copyright (C) 2017-2018 NXP
- * Copyright (C) 2019 Texas Instrumentsq
+ * Copyright (C) 2019 Texas Instruments
  *
  *
  * Author: Peter Chen <peter.chen@nxp.com>

 static int cdns3_plat_runtime_resume(struct device *dev)
 {
-	return cdns3_controller_resume(dev, PMSG_SUSPEND);
+	return cdns3_controller_resume(dev, PMSG_AUTO_RESUME);
 }
@@ -273,7 +273,14 @@ static int cdns3_plat_suspend(struct device *dev)
 
 	cdns_suspend(cdns);
 
-	return cdns3_controller_suspend(dev, PMSG_AUTO_SUSPEND);
+	return cdns3_controller_suspend(dev, PMSG_SUSPEND);

I am porting and testing your patches at NXP platforms.

Peter

> 

> Changlog from v3:

> - added 'T' to MAINTAINERS file for CDNSP entry

> - updated common code with latest cdns3 fixes

> 

> Changlog from v2:

> - removed not used pdev parameter from cdnsp_read/wite_64 functions

> - fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)

> - replaced some constant value with CDNSP_ENDPOINTS_NUM macro

> - replaced 'true' with '1' in bits description in cdnsp-gadget.h file

> - fixed some typos

> - some other less important changes suggested by Peter Chen

> 

> Changlog from v1:

> - updated common code to latest cdns3 driver

> - moved cdnsp driver files to cdns3 as sugested by Peter Chan

> - removed duplicate code from cdnsp_ep0_set_config function

> - added cdns3 prefixes to file related with USBSS driver

> - updated MAINTAINERS file

> - fixed issue with U1

> - fixed issue with L1

> - some less improtant changes sugested by Chunfeng Yun

> ---

> 

> Pawel Laszczak (10):

>   usb: cdns3: Add support for DRD CDNSP

>   usb: cdns3: Split core.c into cdns3-plat and core.c file

>   usb: cdns3: Moves reusable code to separate module

>   usb: cdns3: Refactoring names in reusable code

>   usb: cdns3: Changed type of gadget_dev in cdns structure

>   usb: cdnsp: Device side header file for CDNSP driver

>   usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver

>   usb: cdnsp: Add tracepoints for CDNSP driver

>   usb: cdns3: Change file names for cdns3 driver.

>   MAINTAINERS: add Cadence USBSSP DRD IP driver entry

> 

>  MAINTAINERS                                   |    9 +

>  drivers/usb/Makefile                          |    2 +

>  drivers/usb/cdns3/Kconfig                     |   61 +-

>  drivers/usb/cdns3/Makefile                    |   30 +-

>  drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0

>  drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-

>  .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-

>  .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0

>  drivers/usb/cdns3/cdns3-imx.c                 |    2 +-

>  drivers/usb/cdns3/cdns3-plat.c                |  315 +++

>  drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-

>  drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-

>  drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++

>  drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++

>  drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++

>  drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++

>  drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++

>  drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++

>  drivers/usb/cdns3/cdnsp-ring.c                | 2439 +++++++++++++++++

>  drivers/usb/cdns3/cdnsp-trace.c               |   12 +

>  drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++

>  drivers/usb/cdns3/core.c                      |  455 +--

>  drivers/usb/cdns3/core.h                      |   54 +-

>  drivers/usb/cdns3/drd.c                       |  222 +-

>  drivers/usb/cdns3/drd.h                       |   94 +-

>  drivers/usb/cdns3/gadget-export.h             |   22 +-

>  drivers/usb/cdns3/host-export.h               |   13 +-

>  drivers/usb/cdns3/host.c                      |   22 +-

>  28 files changed, 10400 insertions(+), 507 deletions(-)

>  rename drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)

>  rename drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)

>  rename drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)

>  rename drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)

>  create mode 100644 drivers/usb/cdns3/cdns3-plat.c

>  rename drivers/usb/cdns3/{trace.c => cdns3-trace.c} (89%)

>  rename drivers/usb/cdns3/{trace.h => cdns3-trace.h} (99%)

>  create mode 100644 drivers/usb/cdns3/cdnsp-debug.h

>  create mode 100644 drivers/usb/cdns3/cdnsp-ep0.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-gadget.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-gadget.h

>  create mode 100644 drivers/usb/cdns3/cdnsp-mem.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-pci.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-ring.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-trace.c

>  create mode 100644 drivers/usb/cdns3/cdnsp-trace.h

> 

> -- 

> 2.17.1

> 


-- 

Thanks,
Peter Chen
Pawel Laszczak Dec. 4, 2020, 5:05 a.m. UTC | #3
>

>On 20-12-02 14:25:38, Pawel Laszczak wrote:

>> This patch introduce new Cadence USBSS DRD driver to linux kernel.

>>

>> The Cadence USBSS DRD Controller is a highly configurable IP Core which

>> can be instantiated as Dual-Role Device (DRD), Peripheral Only and

>> Host Only (XHCI)configurations.

>>

>> The current driver has been validated with FPGA burned. We have support

>> for PCIe bus, which is used on FPGA prototyping.

>>

>> The host side of USBSS-DRD controller is compliance with XHCI

>> specification, so it works with standard XHCI Linux driver.

>>

>> The device side of USBSS DRD controller is compliant with XHCI.

>> The architecture for device side is almost the same as for host side,

>> and most of the XHCI specification can be used to understand how

>> this controller operates.

>>

>> This controller and driver support Full Speed, Hight Speed, Supper Speed

>> and Supper Speed Plus USB protocol.

>>

>> The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.

>> The last letter of this acronym means PLUS. The formal name of controller

>> is USBSSP but it's to generic so I've decided to use CDNSP.

>>

>> The patch 1: adds support for DRD CDNSP.

>> The patch 2: separates common code that can be reusable by cdnsp driver.

>> The patch 3: moves reusable code to separate module.

>> The patch 4: changes prefixes in reusable code from cdns3 to common cdns.

>> The patch 5: adopts gadget_dev pointer in cdns structure to make possible

>>              use it in both drivers.

>> The patches 6-8: add the main part of driver and has been intentionally

>>              split into 3 part. In my opinion such division should not

>>              affect understanding and reviewing the driver, and cause that

>>              main patch (7/8) is little smaller. Patch 6 introduces main

>>              header file for driver, 7 is the main part that implements all

>>              functionality of driver and 8 introduces tracepoints.

>> The patch 9: Adds cdns3 prefixes to files related with USBSS driver.

>> the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.

>

>Hi Pawel,

>

>You may need to fix below:

>

>

>diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c

>index 04bccf6daaba..30d69b639492 100644

>--- a/drivers/usb/cdns3/cdns3-plat.c

>+++ b/drivers/usb/cdns3/cdns3-plat.c

>@@ -4,7 +4,7 @@

>  *

>  * Copyright (C) 2018-2020 Cadence.

>  * Copyright (C) 2017-2018 NXP

>- * Copyright (C) 2019 Texas Instrumentsq

>+ * Copyright (C) 2019 Texas Instruments

>  *

>  *

>  * Author: Peter Chen <peter.chen@nxp.com>

>

> static int cdns3_plat_runtime_resume(struct device *dev)

> {

>-	return cdns3_controller_resume(dev, PMSG_SUSPEND);

>+	return cdns3_controller_resume(dev, PMSG_AUTO_RESUME);

> }

>@@ -273,7 +273,14 @@ static int cdns3_plat_suspend(struct device *dev)

>

> 	cdns_suspend(cdns);

>

>-	return cdns3_controller_suspend(dev, PMSG_AUTO_SUSPEND);

>+	return cdns3_controller_suspend(dev, PMSG_SUSPEND);

>

>I am porting and testing your patches at NXP platforms.

>


Thanks for that,
I tried to compare the original code with this one very carefully but
I omit this. Also during testing no problem arose.

I will wait some day and on Tuesday or on Wednesday I will post
v5 with your fix. 

>

>>

>> Changlog from v3:

>> - added 'T' to MAINTAINERS file for CDNSP entry

>> - updated common code with latest cdns3 fixes

>>

>> Changlog from v2:

>> - removed not used pdev parameter from cdnsp_read/wite_64 functions

>> - fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)

>> - replaced some constant value with CDNSP_ENDPOINTS_NUM macro

>> - replaced 'true' with '1' in bits description in cdnsp-gadget.h file

>> - fixed some typos

>> - some other less important changes suggested by Peter Chen

>>

>> Changlog from v1:

>> - updated common code to latest cdns3 driver

>> - moved cdnsp driver files to cdns3 as sugested by Peter Chan

>> - removed duplicate code from cdnsp_ep0_set_config function

>> - added cdns3 prefixes to file related with USBSS driver

>> - updated MAINTAINERS file

>> - fixed issue with U1

>> - fixed issue with L1

>> - some less improtant changes sugested by Chunfeng Yun

>> ---

>>

>> Pawel Laszczak (10):

>>   usb: cdns3: Add support for DRD CDNSP

>>   usb: cdns3: Split core.c into cdns3-plat and core.c file

>>   usb: cdns3: Moves reusable code to separate module

>>   usb: cdns3: Refactoring names in reusable code

>>   usb: cdns3: Changed type of gadget_dev in cdns structure

>>   usb: cdnsp: Device side header file for CDNSP driver

>>   usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver

>>   usb: cdnsp: Add tracepoints for CDNSP driver

>>   usb: cdns3: Change file names for cdns3 driver.

>>   MAINTAINERS: add Cadence USBSSP DRD IP driver entry

>>

>>  MAINTAINERS                                   |    9 +

>>  drivers/usb/Makefile                          |    2 +

>>  drivers/usb/cdns3/Kconfig                     |   61 +-

>>  drivers/usb/cdns3/Makefile                    |   30 +-

>>  drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0

>>  drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-

>>  .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-

>>  .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0

>>  drivers/usb/cdns3/cdns3-imx.c                 |    2 +-

>>  drivers/usb/cdns3/cdns3-plat.c                |  315 +++

>>  drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-

>>  drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-

>>  drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++

>>  drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++

>>  drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++

>>  drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++

>>  drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++

>>  drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++

>>  drivers/usb/cdns3/cdnsp-ring.c                | 2439 +++++++++++++++++

>>  drivers/usb/cdns3/cdnsp-trace.c               |   12 +

>>  drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++

>>  drivers/usb/cdns3/core.c                      |  455 +--

>>  drivers/usb/cdns3/core.h                      |   54 +-

>>  drivers/usb/cdns3/drd.c                       |  222 +-

>>  drivers/usb/cdns3/drd.h                       |   94 +-

>>  drivers/usb/cdns3/gadget-export.h             |   22 +-

>>  drivers/usb/cdns3/host-export.h               |   13 +-

>>  drivers/usb/cdns3/host.c                      |   22 +-

>>  28 files changed, 10400 insertions(+), 507 deletions(-)

>>  rename drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)

>>  rename drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)

>>  rename drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)

>>  rename drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)

>>  create mode 100644 drivers/usb/cdns3/cdns3-plat.c

>>  rename drivers/usb/cdns3/{trace.c => cdns3-trace.c} (89%)

>>  rename drivers/usb/cdns3/{trace.h => cdns3-trace.h} (99%)

>>  create mode 100644 drivers/usb/cdns3/cdnsp-debug.h

>>  create mode 100644 drivers/usb/cdns3/cdnsp-ep0.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-gadget.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-gadget.h

>>  create mode 100644 drivers/usb/cdns3/cdnsp-mem.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-pci.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-ring.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-trace.c

>>  create mode 100644 drivers/usb/cdns3/cdnsp-trace.h

>>

>> --

>> 2.17.1

>>

>

--

Thanks,
Pawel
Aswath Govindraju Dec. 5, 2020, 5:42 a.m. UTC | #4
Hi,
On 04/12/20 6:49 am, Peter Chen wrote:
>  

>> This patch introduce new Cadence USBSS DRD driver to linux kernel.

>>

>> The Cadence USBSS DRD Controller is a highly configurable IP Core which can

>> be instantiated as Dual-Role Device (DRD), Peripheral Only and Host Only

>> (XHCI)configurations.

>>

>> The current driver has been validated with FPGA burned. We have support for

>> PCIe bus, which is used on FPGA prototyping.

>>

>> The host side of USBSS-DRD controller is compliance with XHCI specification, so

>> it works with standard XHCI Linux driver.

>>

>> The device side of USBSS DRD controller is compliant with XHCI.

>> The architecture for device side is almost the same as for host side, and most

>> of the XHCI specification can be used to understand how this controller

>> operates.

>>

>> This controller and driver support Full Speed, Hight Speed, Supper Speed and

>> Supper Speed Plus USB protocol.

>>

>> The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.

>> The last letter of this acronym means PLUS. The formal name of controller is

>> USBSSP but it's to generic so I've decided to use CDNSP.

>>

>> The patch 1: adds support for DRD CDNSP.

>> The patch 2: separates common code that can be reusable by cdnsp driver.

>> The patch 3: moves reusable code to separate module.

>> The patch 4: changes prefixes in reusable code from cdns3 to common cdns.

>> The patch 5: adopts gadget_dev pointer in cdns structure to make possible

>>              use it in both drivers.

>> The patches 6-8: add the main part of driver and has been intentionally

>>              split into 3 part. In my opinion such division should not

>>              affect understanding and reviewing the driver, and cause that

>>              main patch (7/8) is little smaller. Patch 6 introduces main

>>              header file for driver, 7 is the main part that implements all

>>              functionality of driver and 8 introduces tracepoints.

>> The patch 9: Adds cdns3 prefixes to files related with USBSS driver.

>> the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.

>>

> 

> Hi Roger & Sekhar,

> 

> Would you please test this patch set and see if it works well at TI platforms?

> 


Tested this patch series on TI SOC J7200. All given below tests were
performed and they passed,

Host mode:
 - Connected a mass storage device (USB flash stick) and performed read
       and write tests
 - Connected mouse and keyboard to check enumeration

Device mode:
 - Tested g_mass_storage module by performing read and write
 - Tested g_ether module by the pinging host and device from either sides

OTG:
 - Switching between host and device mode based on the device connected.


Tested-by: Aswath Govindraju <a-govindraju@ti.com>


Thanks,
Aswath

> Peter

> 

>> Changlog from v3:

>> - added 'T' to MAINTAINERS file for CDNSP entry

>> - updated common code with latest cdns3 fixes

>>

>> Changlog from v2:

>> - removed not used pdev parameter from cdnsp_read/wite_64 functions

>> - fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)

>> - replaced some constant value with CDNSP_ENDPOINTS_NUM macro

>> - replaced 'true' with '1' in bits description in cdnsp-gadget.h file

>> - fixed some typos

>> - some other less important changes suggested by Peter Chen

>>

>> Changlog from v1:

>> - updated common code to latest cdns3 driver

>> - moved cdnsp driver files to cdns3 as sugested by Peter Chan

>> - removed duplicate code from cdnsp_ep0_set_config function

>> - added cdns3 prefixes to file related with USBSS driver

>> - updated MAINTAINERS file

>> - fixed issue with U1

>> - fixed issue with L1

>> - some less improtant changes sugested by Chunfeng Yun

>> ---

>>

>> Pawel Laszczak (10):

>>   usb: cdns3: Add support for DRD CDNSP

>>   usb: cdns3: Split core.c into cdns3-plat and core.c file

>>   usb: cdns3: Moves reusable code to separate module

>>   usb: cdns3: Refactoring names in reusable code

>>   usb: cdns3: Changed type of gadget_dev in cdns structure

>>   usb: cdnsp: Device side header file for CDNSP driver

>>   usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver

>>   usb: cdnsp: Add tracepoints for CDNSP driver

>>   usb: cdns3: Change file names for cdns3 driver.

>>   MAINTAINERS: add Cadence USBSSP DRD IP driver entry

>>

>>  MAINTAINERS                                   |    9 +

>>  drivers/usb/Makefile                          |    2 +

>>  drivers/usb/cdns3/Kconfig                     |   61 +-

>>  drivers/usb/cdns3/Makefile                    |   30 +-

>>  drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0

>>  drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-

>>  .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-

>>  .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0

>>  drivers/usb/cdns3/cdns3-imx.c                 |    2 +-

>>  drivers/usb/cdns3/cdns3-plat.c                |  315 +++

>>  drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-

>>  drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-

>>  drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++

>>  drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++

>>  drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++

>>  drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++

>>  drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++

>>  drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++

>>  drivers/usb/cdns3/cdnsp-ring.c                | 2439

>> +++++++++++++++++

>>  drivers/usb/cdns3/cdnsp-trace.c               |   12 +

>>  drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++

>>  drivers/usb/cdns3/core.c                      |  455 +--

>>  drivers/usb/cdns3/core.h                      |   54 +-

>>  drivers/usb/cdns3/drd.c                       |  222 +-

>>  drivers/usb/cdns3/drd.h                       |   94 +-

>>  drivers/usb/cdns3/gadget-export.h             |   22 +-

>>  drivers/usb/cdns3/host-export.h               |   13 +-

>>  drivers/usb/cdns3/host.c                      |   22 +-

>>  28 files changed, 10400 insertions(+), 507 deletions(-)  rename

>> drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)  rename

>> drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)  rename

>> drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)  rename

>> drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)  create mode 100644

>> drivers/usb/cdns3/cdns3-plat.c  rename drivers/usb/cdns3/{trace.c =>

>> cdns3-trace.c} (89%)  rename drivers/usb/cdns3/{trace.h => cdns3-trace.h}

>> (99%)  create mode 100644 drivers/usb/cdns3/cdnsp-debug.h  create mode

>> 100644 drivers/usb/cdns3/cdnsp-ep0.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-gadget.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-gadget.h  create mode 100644

>> drivers/usb/cdns3/cdnsp-mem.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-pci.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-ring.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-trace.c  create mode 100644

>> drivers/usb/cdns3/cdnsp-trace.h

>>

>> --

>> 2.17.1

>
Peter Chen Dec. 5, 2020, 11:13 a.m. UTC | #5
On 20-12-05 11:12:44, Aswath Govindraju wrote:
> Hi,

> On 04/12/20 6:49 am, Peter Chen wrote:

> >  

> >> This patch introduce new Cadence USBSS DRD driver to linux kernel.

> >>

> >> The Cadence USBSS DRD Controller is a highly configurable IP Core which can

> >> be instantiated as Dual-Role Device (DRD), Peripheral Only and Host Only

> >> (XHCI)configurations.

> >>

> >> The current driver has been validated with FPGA burned. We have support for

> >> PCIe bus, which is used on FPGA prototyping.

> >>

> >> The host side of USBSS-DRD controller is compliance with XHCI specification, so

> >> it works with standard XHCI Linux driver.

> >>

> >> The device side of USBSS DRD controller is compliant with XHCI.

> >> The architecture for device side is almost the same as for host side, and most

> >> of the XHCI specification can be used to understand how this controller

> >> operates.

> >>

> >> This controller and driver support Full Speed, Hight Speed, Supper Speed and

> >> Supper Speed Plus USB protocol.

> >>

> >> The prefix cdnsp used in driver has chosen by analogy to cdn3 driver.

> >> The last letter of this acronym means PLUS. The formal name of controller is

> >> USBSSP but it's to generic so I've decided to use CDNSP.

> >>

> >> The patch 1: adds support for DRD CDNSP.

> >> The patch 2: separates common code that can be reusable by cdnsp driver.

> >> The patch 3: moves reusable code to separate module.

> >> The patch 4: changes prefixes in reusable code from cdns3 to common cdns.

> >> The patch 5: adopts gadget_dev pointer in cdns structure to make possible

> >>              use it in both drivers.

> >> The patches 6-8: add the main part of driver and has been intentionally

> >>              split into 3 part. In my opinion such division should not

> >>              affect understanding and reviewing the driver, and cause that

> >>              main patch (7/8) is little smaller. Patch 6 introduces main

> >>              header file for driver, 7 is the main part that implements all

> >>              functionality of driver and 8 introduces tracepoints.

> >> The patch 9: Adds cdns3 prefixes to files related with USBSS driver.

> >> the patch 10: Adds USBSSP DRD IP driver entry to MAINTAINERS file.

> >>

> > 

> > Hi Roger & Sekhar,

> > 

> > Would you please test this patch set and see if it works well at TI platforms?

> > 

> 

> Tested this patch series on TI SOC J7200. All given below tests were

> performed and they passed,

> 

> Host mode:

>  - Connected a mass storage device (USB flash stick) and performed read

>        and write tests

>  - Connected mouse and keyboard to check enumeration

> 

> Device mode:

>  - Tested g_mass_storage module by performing read and write

>  - Tested g_ether module by the pinging host and device from either sides

> 

> OTG:

>  - Switching between host and device mode based on the device connected.

> 

> 

> Tested-by: Aswath Govindraju <a-govindraju@ti.com>


Thanks Aswath.

Basic functions at NXP also work. Pawel, you could post your v5 with my last comments.

Peter
> 

> Thanks,

> Aswath

> 

> > Peter

> > 

> >> Changlog from v3:

> >> - added 'T' to MAINTAINERS file for CDNSP entry

> >> - updated common code with latest cdns3 fixes

> >>

> >> Changlog from v2:

> >> - removed not used pdev parameter from cdnsp_read/wite_64 functions

> >> - fixed incorrect value assigned to CDNSP_ENDPOINTS_NUM (32 -> 31)

> >> - replaced some constant value with CDNSP_ENDPOINTS_NUM macro

> >> - replaced 'true' with '1' in bits description in cdnsp-gadget.h file

> >> - fixed some typos

> >> - some other less important changes suggested by Peter Chen

> >>

> >> Changlog from v1:

> >> - updated common code to latest cdns3 driver

> >> - moved cdnsp driver files to cdns3 as sugested by Peter Chan

> >> - removed duplicate code from cdnsp_ep0_set_config function

> >> - added cdns3 prefixes to file related with USBSS driver

> >> - updated MAINTAINERS file

> >> - fixed issue with U1

> >> - fixed issue with L1

> >> - some less improtant changes sugested by Chunfeng Yun

> >> ---

> >>

> >> Pawel Laszczak (10):

> >>   usb: cdns3: Add support for DRD CDNSP

> >>   usb: cdns3: Split core.c into cdns3-plat and core.c file

> >>   usb: cdns3: Moves reusable code to separate module

> >>   usb: cdns3: Refactoring names in reusable code

> >>   usb: cdns3: Changed type of gadget_dev in cdns structure

> >>   usb: cdnsp: Device side header file for CDNSP driver

> >>   usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver

> >>   usb: cdnsp: Add tracepoints for CDNSP driver

> >>   usb: cdns3: Change file names for cdns3 driver.

> >>   MAINTAINERS: add Cadence USBSSP DRD IP driver entry

> >>

> >>  MAINTAINERS                                   |    9 +

> >>  drivers/usb/Makefile                          |    2 +

> >>  drivers/usb/cdns3/Kconfig                     |   61 +-

> >>  drivers/usb/cdns3/Makefile                    |   30 +-

> >>  drivers/usb/cdns3/{debug.h => cdns3-debug.h}  |    0

> >>  drivers/usb/cdns3/{ep0.c => cdns3-ep0.c}      |    4 +-

> >>  .../usb/cdns3/{gadget.c => cdns3-gadget.c}    |   28 +-

> >>  .../usb/cdns3/{gadget.h => cdns3-gadget.h}    |    0

> >>  drivers/usb/cdns3/cdns3-imx.c                 |    2 +-

> >>  drivers/usb/cdns3/cdns3-plat.c                |  315 +++

> >>  drivers/usb/cdns3/{trace.c => cdns3-trace.c}  |    2 +-

> >>  drivers/usb/cdns3/{trace.h => cdns3-trace.h}  |    6 +-

> >>  drivers/usb/cdns3/cdnsp-debug.h               |  583 ++++

> >>  drivers/usb/cdns3/cdnsp-ep0.c                 |  495 ++++

> >>  drivers/usb/cdns3/cdnsp-gadget.c              | 2017 ++++++++++++++

> >>  drivers/usb/cdns3/cdnsp-gadget.h              | 1600 +++++++++++

> >>  drivers/usb/cdns3/cdnsp-mem.c                 | 1325 +++++++++

> >>  drivers/usb/cdns3/cdnsp-pci.c                 |  255 ++

> >>  drivers/usb/cdns3/cdnsp-ring.c                | 2439

> >> +++++++++++++++++

> >>  drivers/usb/cdns3/cdnsp-trace.c               |   12 +

> >>  drivers/usb/cdns3/cdnsp-trace.h               |  840 ++++++

> >>  drivers/usb/cdns3/core.c                      |  455 +--

> >>  drivers/usb/cdns3/core.h                      |   54 +-

> >>  drivers/usb/cdns3/drd.c                       |  222 +-

> >>  drivers/usb/cdns3/drd.h                       |   94 +-

> >>  drivers/usb/cdns3/gadget-export.h             |   22 +-

> >>  drivers/usb/cdns3/host-export.h               |   13 +-

> >>  drivers/usb/cdns3/host.c                      |   22 +-

> >>  28 files changed, 10400 insertions(+), 507 deletions(-)  rename

> >> drivers/usb/cdns3/{debug.h => cdns3-debug.h} (100%)  rename

> >> drivers/usb/cdns3/{ep0.c => cdns3-ep0.c} (99%)  rename

> >> drivers/usb/cdns3/{gadget.c => cdns3-gadget.c} (99%)  rename

> >> drivers/usb/cdns3/{gadget.h => cdns3-gadget.h} (100%)  create mode 100644

> >> drivers/usb/cdns3/cdns3-plat.c  rename drivers/usb/cdns3/{trace.c =>

> >> cdns3-trace.c} (89%)  rename drivers/usb/cdns3/{trace.h => cdns3-trace.h}

> >> (99%)  create mode 100644 drivers/usb/cdns3/cdnsp-debug.h  create mode

> >> 100644 drivers/usb/cdns3/cdnsp-ep0.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-gadget.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-gadget.h  create mode 100644

> >> drivers/usb/cdns3/cdnsp-mem.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-pci.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-ring.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-trace.c  create mode 100644

> >> drivers/usb/cdns3/cdnsp-trace.h

> >>

> >> --

> >> 2.17.1

> > 

> 


-- 

Thanks,
Peter Chen