History log of /linux-master/drivers/usb/cdns3/drd.c
Revision Date Author Comments
# 654298ae 20-Feb-2024 Colin Ian King <colin.i.king@gmail.com>

usb: cdns3: Fix spelling mistake "supporte" -> "supported"

There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20240220080617.2674613-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 47625b01 15-Feb-2024 Pawel Laszczak <pawell@cadence.com>

usb: cdnsp: fixed issue with incorrect detecting CDNSP family controllers

Cadence have several controllers from 0x000403xx family but current
driver suuport detecting only one with DID equal 0x0004034E.
It causes that if someone uses different CDNSP controller then driver
will use incorrect version and register space.
Patch fix this issue.

cc: stable@vger.kernel.org
Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20240215121609.259772-1-pawell@cadence.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 26910f97 21-Jul-2023 Minda Chen <minda.chen@starfivetech.com>

usb: cdns3: Add PHY mode switch to usb2 PHY

cdns3 just set PHY mode switch for USB3.0 PHY.
If USB 2.0 PHY contains PHY mode switch setting,
USB 2.0 PHY mode function can't be called.
So add PHY mode switch function for USB 2.0 PHY.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230721095923.20445-1-minda.chen@starfivetech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 79aa3e19 11-Jan-2022 Pawel Laszczak <pawell@cadence.com>

usb: cdnsp: Fix segmentation fault in cdns_lost_power function

CDNSP driver read not initialized cdns->otg_v0_regs
which lead to segmentation fault. Patch fixes this issue.

Fixes: 2cf2581cd229 ("usb: cdns3: add power lost support for system resume")
cc: <stable@vger.kernel.org>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20220111090737.10345-1-pawell@gli-login.cadence.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2cf2581c 18-Feb-2021 Frank Li <frank.li@nxp.com>

usb: cdns3: add power lost support for system resume

If the controller lost its power during the system suspend, we need
to do all initialiation operations.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>


# 6500f30b 15-Dec-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Adds missing __iomem markers

Patch adds missing __iomem markers in core.h file
and makes some changes in drd.c file related with
these markers.

The lack of __iomem has reported by sparse checker
on parsic architecture.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>


# 3d829045 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

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

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>


# 0b490046 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Refactoring names in reusable code

Patch change the functions and objects names in reusable code.
The reusable code includes core.c, core.h, drd.c and drd.h files.
It also changes the names of all references to these functions and
objects in other cdns3 files. There are a lot of changes, but all
changes are very trivial.
The reason of this patch is to avoid of mixing prefix cdns3 and cdnsp in
in cdnsp driver what could introduce some confusion in understanding
of cdnsp driver.
This patch assumes to use three different prefixes in Cadence
USB drivers:
cdns: for common reusable code
cdnsp: for names related only with cdnsp driver
cdns3: for names related only with cdns3 driver

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# 394c3a14 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Moves reusable code to separate module

Patch moves common reusable code used by cdns3 and cdnsp driver
to cdns-usb-common library. This library include core.c, drd.c
and host.c files.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# f7389572 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

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

Patch splits file core.c into core.c containing the common reusable code
and cnd3-plat.c containing device platform specific code. These changes
are required to make possible reuse DRD part of CDNS3 driver in CDNSP
driver.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# db8892bb 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Add support for DRD CDNSP

Patch adds support for Cadence DRD Super Speed Plus controller(CDNSP).
CDNSP DRD is a part of Cadence CDNSP controller.
The DRD CDNSP controller has a lot of difference on hardware level but on
software level is quite compatible with CDNS3 DRD. For this reason
CDNS3 DRD part of CDNS3 driver was reused for CDNSP driver.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# 9f650135 31-Aug-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: drd: call PHY .set_mode accordingly

Some PHYs may need to enter related mode, and do some settings.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 2eae2dfd 15-Sep-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY lockup

USB2.0 PHY hangs in Rx Compliance test when the incoming packet
amplitude is varied below and above the Squelch Level of
Receiver during the active packet multiple times.

Version 1 of the controller allows PHY to be reset when RX fail condition
is detected to work around the above issue. This feature is
disabled by default and needs to be enabled using a bit from
the newly added PHYRST_CFG register. This patch enables the workaround.

There is no way to know controller version before device controller
is started and the workaround needs to be applied for both host and
device modes, so we rely on a DT property do decide when to
apply the workaround.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# b1234e3b 02-Sep-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: add runtime PM support

Introduce runtime PM and wakeup interrupt handler for cdns3,
the runtime PM is default off since other cdns3 may not
implement glue layer support for runtime PM.

One typical wakeup event use case is xHCI runtime suspend will clear
USBCMD.RS bit, after that the xHCI will not trigger any interrupts,
so its parent (cdns core device) needs to resume xHCI device when
any (wakeup) events occurs at host port.

When the controller is in low power mode, the lpm flag will be set.
The interrupt triggered later than lpm flag is set considers as
wakeup interrupt and handled at cdns_wakeup_irq. Once the wakeup
occurs, it first disables interrupt to avoid later interrupt
occurrence since the controller is in low power mode at that
time, and access registers may be invalid at that time. At wakeup
handler, it will call pm_request_resume to wakeup xHCI device, and
at runtime resume handler, it will enable interrupt again.

The API platform_suspend is introduced for glue layer to implement
platform specific PM sequence.

Reviewed-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# b2aeb6da 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: drd: simplify *switch_gadet and *switch_host

Patch split function cdns3_drd_switch_gadget and
cdns3_drd_switch_host into:
- cdns3_drd_host_on
- cdns3_drd_host_off
- cdns3_drd_gadget_on
- cdns3_drd_gadgett_off

These functions don't have any shared code so it's better to
have smaller, faster and easier functions.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 08c35dd3 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Added CDNS3_ID_PERIPHERAL and CDNS3_ID_HOST

Patch adds 2 definitions that make it easier to understand the code.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 24525849 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: drd: changed return type from int to bool

Patch changes return type from int to bool for
cdns3_is_host and cdns3_is_device functions.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 03cce68a 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: drd: return IRQ_NONE explicitly.

IRQ_NONE can be returned indirect.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# ecf4f823 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cnds3: drd: deleted !=

Patch deletes unnecessary != from condition statement in cdns3_drd_init
function.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 27afe166 12-Jul-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: drd: removed not needed variables initialization

Patch remove some variables initialization from core.c and drd.c
file.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# a55b8dce 31-Mar-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: change dev_info to dev_dbg for debug message

During device mode initialization, lots of device information
are printed to console, see below. Change them as debug message.

cdns-usb3 5b130000.cdns3: Initialized ep0 support:
cdns-usb3 5b130000.cdns3: Initialized ep1out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep2out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep3out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep4out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep5out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep6out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep7out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep1in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep2in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep3in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep4in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep5in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep6in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep7in support: BULK, INT ISO

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# eed6ed6e 31-Mar-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: change dev_info to dev_dbg for debug message

During device mode initialization, lots of device information
are printed to console, see below. Change them as debug message.

cdns-usb3 5b130000.cdns3: Initialized ep0 support:
cdns-usb3 5b130000.cdns3: Initialized ep1out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep2out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep3out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep4out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep5out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep6out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep7out support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep1in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep2in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep3in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep4in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep5in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep6in support: BULK, INT ISO
cdns-usb3 5b130000.cdns3: Initialized ep7in support: BULK, INT ISO

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Link: https://lore.kernel.org/r/20200331081005.32752-4-peter.chen@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7733f6c3 25-Aug-2019 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Add Cadence USB3 DRD Driver

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

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

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# de4ad1b1 04-Jul-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "usb:cdns3 Add Cadence USB3 DRD Driver"

This reverts commit 8bc1901ca7b07d864fca11461b3875b31f949765.

It's broken.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8bc1901c 02-Jul-2019 Pawel Laszczak <pawell@cadence.com>

usb:cdns3 Add Cadence USB3 DRD Driver

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

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

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>