usb: renesas_usbhs: support byte addressable CFIFO
authorChris Brandt <chris.brandt@renesas.com>
Wed, 15 May 2019 15:20:43 +0000 (10:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 08:25:59 +0000 (10:25 +0200)
Some SoC have a CFIFO register that is byte addressable. This means
when the CFIFO access is set to 32-bit, you can write 8-bit values to
addresses CFIFO+0, CFIFO+1, CFIFO+2, CFIFO+3.

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/fifo.c
include/linux/usb/renesas_usbhs.h

index 39fa2fc1b8b767e10d37b6bde54a696d00de9f0c..452b456ac24e154e772c2f3490d6fe2247c6115f 100644 (file)
@@ -543,8 +543,13 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done)
        }
 
        /* the rest operation */
-       for (i = 0; i < len; i++)
-               iowrite8(buf[i], addr + (0x03 - (i & 0x03)));
+       if (usbhs_get_dparam(priv, cfifo_byte_addr)) {
+               for (i = 0; i < len; i++)
+                       iowrite8(buf[i], addr + (i & 0x03));
+       } else {
+               for (i = 0; i < len; i++)
+                       iowrite8(buf[i], addr + (0x03 - (i & 0x03)));
+       }
 
        /*
         * variable update
index 9097a38fcda8c8bf6cecc44a9755fd8f3a48e448..87043fd21d54c3b0b03ac9cf9621e45c65483531 100644 (file)
@@ -191,6 +191,7 @@ struct renesas_usbhs_driver_param {
        u32 has_usb_dmac:1; /* for USB-DMAC */
        u32 runtime_pwctrl:1;
        u32 has_cnen:1;
+       u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */
 #define USBHS_USB_DMAC_XFER_SIZE       32      /* hardcode the xfer size */
 };