summaryrefslogtreecommitdiffstats
path: root/drivers/usb/c67x00
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2013-12-25 16:01:30 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-07 16:15:39 -0800
commit8f668fbbd571bbd5187a9a0eae150b768fc388ac (patch)
tree3def8b18a00f20ce2ea41acd3f831450ac982ac7 /drivers/usb/c67x00
parent543d7784b07ffd16cc82a9cb4e1e0323fd0040f1 (diff)
downloadlinux-stable-8f668fbbd571bbd5187a9a0eae150b768fc388ac.tar.gz
linux-stable-8f668fbbd571bbd5187a9a0eae150b768fc388ac.tar.bz2
linux-stable-8f668fbbd571bbd5187a9a0eae150b768fc388ac.zip
USB: c67x00: add proper delays to HPI read/write
According to CY7C67300 specification HPI read and write cycle duration Tcyc must be at least 6T long, where T is 1/48MHz, which is 125ns. Without this delay fast host processor cannot write to chip registers. Add proper ndelay to hpi_{read,write}_reg. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/c67x00')
-rw-r--r--drivers/usb/c67x00/c67x00-ll-hpi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c b/drivers/usb/c67x00/c67x00-ll-hpi.c
index 3a1ca4dfc83a..cd2c6ed67493 100644
--- a/drivers/usb/c67x00/c67x00-ll-hpi.c
+++ b/drivers/usb/c67x00/c67x00-ll-hpi.c
@@ -22,6 +22,7 @@
*/
#include <asm/byteorder.h>
+#include <linux/delay.h>
#include <linux/io.h>
#include <linux/jiffies.h>
#include <linux/usb/c67x00.h>
@@ -73,13 +74,22 @@ struct c67x00_lcp_int_data {
#define HPI_ADDR 2
#define HPI_STATUS 3
+/*
+ * According to CY7C67300 specification (tables 140 and 141) HPI read and
+ * write cycle duration Tcyc must be at least 6T long, where T is 1/48MHz,
+ * which is 125ns.
+ */
+#define HPI_T_CYC_NS 125
+
static inline u16 hpi_read_reg(struct c67x00_device *dev, int reg)
{
+ ndelay(HPI_T_CYC_NS);
return __raw_readw(dev->hpi.base + reg * dev->hpi.regstep);
}
static inline void hpi_write_reg(struct c67x00_device *dev, int reg, u16 value)
{
+ ndelay(HPI_T_CYC_NS);
__raw_writew(value, dev->hpi.base + reg * dev->hpi.regstep);
}