usb: cdnsp: blocked some cdns3 specific code
Subsystems (2)
It is for both cdns3 and cdnsp.
Reply-To:
In-Reply-To: <[email protected]>
Quoted 43 lines · Pawel Laszczak
host.cfile 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_xhciobject
- cdns3 specificXECP_PORT_CAP_REGregister
- cdns3 specificXECP_AUX_CTRL_REG1registercc <[email protected]>Fixes 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")Signed-off-by Pawel Laszczak <[email protected]>--- drivers/usb/cdns3/host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)drivers/usb/cdns3/host.c +7
-0@@ -18,6 +18,11 @@#include "../host/xhci.h" #include "../host/xhci-plat.h" +/* +* The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only +* in Cadence USB3 dual-role controller, so it can't be used +* with Cadence CDNSP dual-role controller. +*/ #define XECP_PORT_CAP_REG 0x8000#define XECP_AUX_CTRL_REG1 0x8120@@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_plat_cdns3_xhci = { .resume_quirk = xhci_cdns3_resume_quirk, }; +static const struct xhci_plat_priv xhci_plat_cdnsp_xhci; +static int __cdns_host_init (struct cdns *cdns) {struct platform_device *xhci;@@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns *cdns) goto err1; }
drivers/usb/cdns3/host.c static int __cdns_host_init(struct cdns *cdns) · line 97
Quoted 10 lines
drivers/usb/cdns3/host.c +7
-2- cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, -sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (cdns->version <CDNSP_CONTROLLER_V2 ) + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +else + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdnsp_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +
You may explain why you duplicate another structure for cdnsp at commit log.
drivers/usb/cdns3/host.c static int __cdns_host_init(struct cdns *cdns) · line 100
Quoted 4 lines
drivers/usb/cdns3/host.c +0
-0if (!cdns->xhci_plat_data) { ret = -ENOMEM ; goto err1;
Others are okay for me.
Signature · 2 lines
Thanks, Peter Chen
Quoted 51 lines
It is for both cdns3 and cdnsp.
Reply-To:
In-Reply-To: <[email protected]>drivers/usb/cdns3/host.c static const struct xhci_plat_priv xhci_plat_cdns3_xhci =
Quoted 33 lines · Pawel Laszczak
host.cfile 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_xhciobject
- cdns3 specificXECP_PORT_CAP_REGregister
- cdns3 specificXECP_AUX_CTRL_REG1registercc <[email protected]>Fixes 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of CadenceUSBSSP DRD Driver")
Signed-off-by Pawel Laszczak <[email protected]>--- drivers/usb/cdns3/host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)drivers/usb/cdns3/host.c index renamed from drivers/usb/cdns3/host.c +0
-0
6164fc4c96a4..ceca4d839dfd100644drivers/usb/cdns3/host.c +5
-0@@ -18,6 +18,11 @@#include "../host/xhci.h" #include "../host/xhci-plat.h" +/* +* The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only +* in Cadence USB3 dual-role controller, so it can't be used +* with Cadence CDNSP dual-role controller. +*/ #define XECP_PORT_CAP_REG 0x8000#define XECP_AUX_CTRL_REG1 0x8120@@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_plat_cdns3_xhci ={
Quoted 10 lines
drivers/usb/cdns3/host.c +2
-0.resume_quirk = xhci_cdns3_resume_quirk, }; +static const struct xhci_plat_priv xhci_plat_cdnsp_xhci; +static int __cdns_host_init (struct cdns *cdns) {struct platform_device *xhci;@@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns *cdns) goto err1; }
Quoted 11 lines
drivers/usb/cdns3/host.c static int __cdns_host_init(struct cdns *cdns) · line 97
Quoted 9 lines
drivers/usb/cdns3/host.c +7
-2- cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, -sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (cdns->version <CDNSP_CONTROLLER_V2 ) + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +else + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdnsp_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +You may explain why you duplicate another structure for cdnsp at commit log.
In my opinion it is more readable. If someone will review the code then easier to notice the difference between these driver.
Thanks
Pawel
Quoted 12 lines
drivers/usb/cdns3/host.c static int __cdns_host_init(struct cdns *cdns) · line 100
Quoted 5 lines
drivers/usb/cdns3/host.c +0
-0if (!cdns->xhci_plat_data) { ret = -ENOMEM ; goto err1;Others are okay for me.
--
Thanks,
Peter Chen