usb: renesas_usbhs: add support for CNEN bit
authorChris Brandt <chris.brandt@renesas.com>
Wed, 15 May 2019 15:20:42 +0000 (10:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 08:25:59 +0000 (10:25 +0200)
For some SoC, CNEN must be set for USB Device mode operation.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/common.c
drivers/usb/renesas_usbhs/common.h
include/linux/usb/renesas_usbhs.h

index 1de7a44f34158c621b12fda7df6b938ae35418c0..734fb4e542c5b3bd7ed40b9d129303ad9a7101fb 100644 (file)
@@ -114,6 +114,12 @@ void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
        u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
        u16 val  = HSE | USBE;
 
+       /* CNEN bit is required for function operation */
+       if (usbhs_get_dparam(priv, has_cnen)) {
+               mask |= CNEN;
+               val  |= CNEN;
+       }
+
        /*
         * if enable
         *
index 1fbffb7bbc8f73e4cc3cc151dc041f84583ed3ca..de74ebd1a3474d13a7ad963f753caab4e3d3ca6d 100644 (file)
@@ -104,6 +104,7 @@ struct usbhs_priv;
 
 /* SYSCFG */
 #define SCKE   (1 << 10)       /* USB Module Clock Enable */
+#define CNEN   (1 << 8)        /* Single-ended receiver operation Enable */
 #define HSE    (1 << 7)        /* High-Speed Operation Enable */
 #define DCFM   (1 << 6)        /* Controller Function Select */
 #define DRPD   (1 << 5)        /* D+ Line/D- Line Resistance Control */
index 17fae6e504cc51322a35f787a994fe12f7997f1f..9097a38fcda8c8bf6cecc44a9755fd8f3a48e448 100644 (file)
@@ -190,6 +190,7 @@ struct renesas_usbhs_driver_param {
        u32 has_sudmac:1; /* for SUDMAC */
        u32 has_usb_dmac:1; /* for USB-DMAC */
        u32 runtime_pwctrl:1;
+       u32 has_cnen:1;
 #define USBHS_USB_DMAC_XFER_SIZE       32      /* hardcode the xfer size */
 };