Skip to content

Commit

Permalink
usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver
Browse files Browse the repository at this point in the history
This patch introduces the main part of Cadence USBSSP DRD driver
to Linux kernel.
To reduce the patch size a little bit, the header file gadget.h was
intentionally added as separate patch.

The Cadence USBSSP 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 platform. We have
support for PCIe bus, which is used on FPGA prototyping.

The host 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.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
  • Loading branch information
pawellcdns authored and Peter Chen committed Dec 29, 2020
1 parent e93e58d commit 3d82904
Show file tree
Hide file tree
Showing 15 changed files with 6,641 additions and 29 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ obj-$(CONFIG_USB_DWC3) += dwc3/
obj-$(CONFIG_USB_DWC2) += dwc2/
obj-$(CONFIG_USB_ISP1760) += isp1760/

obj-$(CONFIG_USB_CDNS_SUPPORT) += cdns3/
obj-$(CONFIG_USB_CDNS3) += cdns3/
obj-$(CONFIG_USB_CDNSP_PCI) += cdns3/

obj-$(CONFIG_USB_MON) += mon/
obj-$(CONFIG_USB_MTU3) += mtu3/
Expand Down
64 changes: 56 additions & 8 deletions drivers/usb/cdns3/Kconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
config CDNS_USB_COMMON
tristate
config USB_CDNS_SUPPORT
tristate "Cadence USB Support"
depends on USB_SUPPORT && (USB || USB_GADGET) && HAS_DMA
select USB_XHCI_PLATFORM if USB_XHCI_HCD
select USB_ROLE_SWITCH
help
Say Y here if your system has a Cadence USBSS or USBSSP
dual-role controller.
It supports: dual-role switch, Host-only, and Peripheral-only.

config CDNS_USB_HOST
config USB_CDNS_HOST
bool

if USB_CDNS_SUPPORT

config USB_CDNS3
tristate "Cadence USB3 Dual-Role Controller"
depends on USB_SUPPORT && (USB || USB_GADGET) && HAS_DMA
select USB_XHCI_PLATFORM if USB_XHCI_HCD
select USB_ROLE_SWITCH
select CDNS_USB_COMMON
depends on USB_CDNS_SUPPORT
help
Say Y here if your system has a Cadence USB3 dual-role controller.
It supports: dual-role switch, Host-only, and Peripheral-only.

If you choose to build this driver is a dynamically linked
as module, the module will be called cdns3.ko.
endif

if USB_CDNS3

Expand All @@ -32,7 +39,7 @@ config USB_CDNS3_GADGET
config USB_CDNS3_HOST
bool "Cadence USB3 host controller"
depends on USB=y || USB=USB_CDNS3
select CDNS_USB_HOST
select USB_CDNS_HOST
help
Say Y here to enable host controller functionality of the
Cadence driver.
Expand Down Expand Up @@ -72,3 +79,44 @@ config USB_CDNS3_IMX
For example, imx8qm and imx8qxp.

endif

if USB_CDNS_SUPPORT

config USB_CDNSP_PCI
tristate "Cadence CDNSP Dual-Role Controller"
depends on USB_CDNS_SUPPORT && USB_PCI && ACPI
help
Say Y here if your system has a Cadence CDNSP dual-role controller.
It supports: dual-role switch Host-only, and Peripheral-only.

If you choose to build this driver is a dynamically linked
module, the module will be called cdnsp.ko.
endif

if USB_CDNSP_PCI

config USB_CDNSP_GADGET
bool "Cadence CDNSP device controller"
depends on USB_GADGET=y || USB_GADGET=USB_CDNSP_PCI
help
Say Y here to enable device controller functionality of the
Cadence CDNSP-DEV driver.

Cadence CDNSP Device Controller in device mode is
very similar to XHCI controller. Therefore some algorithms
used has been taken from host driver.
This controller supports FF, HS, SS and SSP mode.
It doesn't support LS.

config USB_CDNSP_HOST
bool "Cadence CDNSP host controller"
depends on USB=y || USB=USB_CDNSP_PCI
select USB_CDNS_HOST
help
Say Y here to enable host controller functionality of the
Cadence driver.

Host controller is compliant with XHCI so it uses
standard XHCI driver.

endif
27 changes: 16 additions & 11 deletions drivers/usb/cdns3/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# SPDX-License-Identifier: GPL-2.0
# define_trace.h needs to know how to find our header
CFLAGS_trace.o := -I$(src)
CFLAGS_trace.o := -I$(src)

cdns-usb-common-y := core.o drd.o
cdns3-y := cdns3-plat.o
cdns-usb-common-y := core.o drd.o
cdns3-y := cdns3-plat.o

obj-$(CONFIG_USB_CDNS3) += cdns3.o
obj-$(CONFIG_CDNS_USB_COMMON) += cdns-usb-common.o
obj-$(CONFIG_USB_CDNS3) += cdns3.o
obj-$(CONFIG_USB_CDNS_SUPPORT) += cdns-usb-common.o

cdns-usb-common-$(CONFIG_CDNS_USB_HOST) += host.o
cdns3-$(CONFIG_USB_CDNS3_GADGET) += gadget.o ep0.o
cdns-usb-common-$(CONFIG_USB_CDNS_HOST) += host.o
cdns3-$(CONFIG_USB_CDNS3_GADGET) += gadget.o ep0.o

ifneq ($(CONFIG_USB_CDNS3_GADGET),)
cdns3-$(CONFIG_TRACING) += trace.o
cdns3-$(CONFIG_TRACING) += trace.o
endif

obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci-wrap.o
obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o
obj-$(CONFIG_USB_CDNS3_IMX) += cdns3-imx.o
obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci-wrap.o
obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o
obj-$(CONFIG_USB_CDNS3_IMX) += cdns3-imx.o

cdnsp-udc-pci-y := cdnsp-pci.o
obj-$(CONFIG_USB_CDNSP_PCI) += cdnsp-udc-pci.o
cdnsp-udc-pci-$(CONFIG_USB_CDNSP_GADGET) += cdnsp-ring.o cdnsp-gadget.o \
cdnsp-mem.o cdnsp-ep0.o
Loading

0 comments on commit 3d82904

Please sign in to comment.