mbox series

[0/4] Introduced new Cadence USBHS Driver

Message ID 20230216105411.364157-1-pawell@cadence.com
Headers show
Series Introduced new Cadence USBHS Driver | expand

Message

Pawel Laszczak Feb. 16, 2023, 10:54 a.m. UTC
This series introduce new Cadence USBHS peripheral driver to linux kernel.

The Cadence USBHS Controller is a highly configurable IP Core which
can be instantiated as Peripheral which supports both full and high speed
data transfer.

The current driver has been validated with PCI based on FPGA platform.

To simplyfiy reviewing the driver has been splited into 3 part:
The patch 1: contains main header file.
The patch 2: main part that implements whole driver functionality.
The patch 3: adds to driver tracepoints.
The patch 4: Adds USBSSP DRD IP driver entry to MAINTAINERS file.
---

Pawel Laszczak (4):
  usb: cdns2: Device side header file for CDNS2 driver
  usb: cdns2: Add main part of Cadence USBHS driver
  usb: cdns2: Add tracepoints for CDNS2 driver
  MAINTAINERS: add Cadence USBHS driver entry

 MAINTAINERS                                 |    6 +
 drivers/usb/gadget/udc/Kconfig              |    2 +
 drivers/usb/gadget/udc/Makefile             |    1 +
 drivers/usb/gadget/udc/cdns2/Kconfig        |   11 +
 drivers/usb/gadget/udc/cdns2/Makefile       |    7 +
 drivers/usb/gadget/udc/cdns2/cdns2-debug.h  |  200 ++
 drivers/usb/gadget/udc/cdns2/cdns2-ep0.c    |  662 ++++++
 drivers/usb/gadget/udc/cdns2/cdns2-gadget.c | 2362 +++++++++++++++++++
 drivers/usb/gadget/udc/cdns2/cdns2-gadget.h |  670 ++++++
 drivers/usb/gadget/udc/cdns2/cdns2-pci.c    |  151 ++
 drivers/usb/gadget/udc/cdns2/cdns2-trace.c  |   11 +
 drivers/usb/gadget/udc/cdns2/cdns2-trace.h  |  609 +++++
 12 files changed, 4692 insertions(+)
 create mode 100644 drivers/usb/gadget/udc/cdns2/Kconfig
 create mode 100644 drivers/usb/gadget/udc/cdns2/Makefile
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-debug.h
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-ep0.c
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-gadget.h
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-pci.c
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-trace.c
 create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-trace.h

Comments

Greg Kroah-Hartman Feb. 16, 2023, 11:24 a.m. UTC | #1
On Thu, Feb 16, 2023 at 05:54:08AM -0500, Pawel Laszczak wrote:
> Patch defines macros, registers and structures used by
> Device side driver.
> 
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
>  drivers/usb/gadget/udc/cdns2/cdns2-gadget.h | 670 ++++++++++++++++++++
>  1 file changed, 670 insertions(+)
>  create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-gadget.h
> 
> diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.h b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.h
> new file mode 100644
> index 000000000000..66cdb902163c
> --- /dev/null
> +++ b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.h
> @@ -0,0 +1,670 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * USBHS-DEV device controller driver header file
> + *
> + * Copyright (C) 2023 Cadence.
> + *
> + * Author: Pawel Laszczak <pawell@cadence.com>
> + */
> +
> +#ifndef __LINUX_CDNS2_GADGET
> +#define __LINUX_CDNS2_GADGET
> +
> +#include <linux/usb/gadget.h>
> +#include <linux/dma-direction.h>
> +
> +/*
> + * USBHS register interface.
> + * This corresponds to the USBHS Device Controller Interface.
> + */
> +
> +/**
> + * struct cdns2_ep0_regs - endpoint 0 related registers.
> + * @rxbc: receive (OUT) 0 endpoint byte count register.
> + * @txbc: transmit (IN) 0 endpoint byte count register.
> + * @cs: 0 endpoint control and status register.
> + * @fifo: 0 endpoint fifo register.
> + * @setupdat: SETUP data register.
> + * @maxpack: 0 endpoint max packet size.

You didn't describe the "reserved" fields in here, so you will get a
kerneldoc warning :(

> + */
> +struct cdns2_ep0_regs {
> +	__u8 rxbc;
> +	__u8 txbc;
> +	__u8 cs;
> +	__u8 reserved1[4];
> +	__u8 fifo;
> +	__le32 reserved2[94];
> +	__u8 setupdat[8];
> +	__u8 reserved4[88];

Why are these all reserved?  Should they be set to 0?  Something else?

Same with the other reserved fields in this file, you need to fix up the
kerneldoc for them too.

thanks,

greg k-h
Greg Kroah-Hartman Feb. 16, 2023, 11:26 a.m. UTC | #2
On Thu, Feb 16, 2023 at 05:54:09AM -0500, Pawel Laszczak wrote:
> +static void cdns2_pci_remove(struct pci_dev *pdev)
> +{
> +	struct cdns2_device *priv_dev;
> +
> +	priv_dev = (struct cdns2_device *)pci_get_drvdata(pdev);

Nit, no need to cast for this.

thanks,

greg k-h