Skip to content

Commit 18a6be6

Browse files
pawellcdnsgregkh
authored andcommitted
usb: cdnsp: blocked some cdns3 specific code
host.c file has some parts of code that were introduced for CDNS3 driver and should not be used with CDNSP driver. This patch blocks using these parts of codes by CDNSP driver. These elements include: - xhci_plat_cdns3_xhci object - cdns3 specific XECP_PORT_CAP_REG register - cdns3 specific XECP_AUX_CTRL_REG1 register cc: stable@vger.kernel.org Fixes: 3d82904 ("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/20240206104018.48272-1-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d70c7a6 commit 18a6be6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/usb/cdns3/host.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#include "../host/xhci.h"
1919
#include "../host/xhci-plat.h"
2020

21+
/*
22+
* The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only
23+
* in Cadence USB3 dual-role controller, so it can't be used
24+
* with Cadence CDNSP dual-role controller.
25+
*/
2126
#define XECP_PORT_CAP_REG 0x8000
2227
#define XECP_AUX_CTRL_REG1 0x8120
2328

@@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_plat_cdns3_xhci = {
5762
.resume_quirk = xhci_cdns3_resume_quirk,
5863
};
5964

65+
static const struct xhci_plat_priv xhci_plat_cdnsp_xhci;
66+
6067
static int __cdns_host_init(struct cdns *cdns)
6168
{
6269
struct platform_device *xhci;
@@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns *cdns)
8188
goto err1;
8289
}
8390

84-
cdns->xhci_plat_data = kmemdup(&xhci_plat_cdns3_xhci,
85-
sizeof(struct xhci_plat_priv), GFP_KERNEL);
91+
if (cdns->version < CDNSP_CONTROLLER_V2)
92+
cdns->xhci_plat_data = kmemdup(&xhci_plat_cdns3_xhci,
93+
sizeof(struct xhci_plat_priv), GFP_KERNEL);
94+
else
95+
cdns->xhci_plat_data = kmemdup(&xhci_plat_cdnsp_xhci,
96+
sizeof(struct xhci_plat_priv), GFP_KERNEL);
97+
8698
if (!cdns->xhci_plat_data) {
8799
ret = -ENOMEM;
88100
goto err1;

0 commit comments

Comments
 (0)