Message ID | PH7PR07MB95387AD98EDCA695FECE52BADD96A@PH7PR07MB9538.namprd07.prod.outlook.com |
---|---|
State | New |
Headers | show |
Series | usb: cdnsp: Fix issue with detecting USB 3.2 speed | expand |
On 25-05-13 06:54:03, Pawel Laszczak wrote: > Patch adds support for detecting SuperSpeedPlus Gen1 x2 > and SuperSpeedPlus Gen2 x2 speed. > > Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") > cc: stable@vger.kernel.org > Signed-off-by: Pawel Laszczak <pawell@cadence.com> Acked-by: Peter Chen <peter.chen@kernel.org> Peter > --- > drivers/usb/cdns3/cdnsp-gadget.c | 3 ++- > drivers/usb/cdns3/cdnsp-gadget.h | 4 ++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c > index 52431ea41669..893b55823261 100644 > --- a/drivers/usb/cdns3/cdnsp-gadget.c > +++ b/drivers/usb/cdns3/cdnsp-gadget.c > @@ -29,7 +29,8 @@ > unsigned int cdnsp_port_speed(unsigned int port_status) > { > /*Detect gadget speed based on PORTSC register*/ > - if (DEV_SUPERSPEEDPLUS(port_status)) > + if (DEV_SUPERSPEEDPLUS(port_status) || > + DEV_SSP_GEN1x2(port_status) || DEV_SSP_GEN2x2(port_status)) > return USB_SPEED_SUPER_PLUS; > else if (DEV_SUPERSPEED(port_status)) > return USB_SPEED_SUPER; > diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h > index 12534be52f39..2afa3e558f85 100644 > --- a/drivers/usb/cdns3/cdnsp-gadget.h > +++ b/drivers/usb/cdns3/cdnsp-gadget.h > @@ -285,11 +285,15 @@ struct cdnsp_port_regs { > #define XDEV_HS (0x3 << 10) > #define XDEV_SS (0x4 << 10) > #define XDEV_SSP (0x5 << 10) > +#define XDEV_SSP1x2 (0x6 << 10) > +#define XDEV_SSP2x2 (0x7 << 10) > #define DEV_UNDEFSPEED(p) (((p) & DEV_SPEED_MASK) == (0x0 << 10)) > #define DEV_FULLSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_FS) > #define DEV_HIGHSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_HS) > #define DEV_SUPERSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_SS) > #define DEV_SUPERSPEEDPLUS(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP) > +#define DEV_SSP_GEN1x2(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP1x2) > +#define DEV_SSP_GEN2x2(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP2x2) > #define DEV_SUPERSPEED_ANY(p) (((p) & DEV_SPEED_MASK) >= XDEV_SS) > #define DEV_PORT_SPEED(p) (((p) >> 10) & 0x0f) > /* Port Link State Write Strobe - set this when changing link state */ > -- > 2.43.0 >
diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index 52431ea41669..893b55823261 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -29,7 +29,8 @@ unsigned int cdnsp_port_speed(unsigned int port_status) { /*Detect gadget speed based on PORTSC register*/ - if (DEV_SUPERSPEEDPLUS(port_status)) + if (DEV_SUPERSPEEDPLUS(port_status) || + DEV_SSP_GEN1x2(port_status) || DEV_SSP_GEN2x2(port_status)) return USB_SPEED_SUPER_PLUS; else if (DEV_SUPERSPEED(port_status)) return USB_SPEED_SUPER; diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h index 12534be52f39..2afa3e558f85 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.h +++ b/drivers/usb/cdns3/cdnsp-gadget.h @@ -285,11 +285,15 @@ struct cdnsp_port_regs { #define XDEV_HS (0x3 << 10) #define XDEV_SS (0x4 << 10) #define XDEV_SSP (0x5 << 10) +#define XDEV_SSP1x2 (0x6 << 10) +#define XDEV_SSP2x2 (0x7 << 10) #define DEV_UNDEFSPEED(p) (((p) & DEV_SPEED_MASK) == (0x0 << 10)) #define DEV_FULLSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_FS) #define DEV_HIGHSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_HS) #define DEV_SUPERSPEED(p) (((p) & DEV_SPEED_MASK) == XDEV_SS) #define DEV_SUPERSPEEDPLUS(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP) +#define DEV_SSP_GEN1x2(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP1x2) +#define DEV_SSP_GEN2x2(p) (((p) & DEV_SPEED_MASK) == XDEV_SSP2x2) #define DEV_SUPERSPEED_ANY(p) (((p) & DEV_SPEED_MASK) >= XDEV_SS) #define DEV_PORT_SPEED(p) (((p) >> 10) & 0x0f) /* Port Link State Write Strobe - set this when changing link state */
Patch adds support for detecting SuperSpeedPlus Gen1 x2 and SuperSpeedPlus Gen2 x2 speed. Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") cc: stable@vger.kernel.org Signed-off-by: Pawel Laszczak <pawell@cadence.com> --- drivers/usb/cdns3/cdnsp-gadget.c | 3 ++- drivers/usb/cdns3/cdnsp-gadget.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)