Re: [PATCH 2/2] USB: c67x00: add proper delays to HPI read/write

2013-12-25 Thread Peter Korsgaard
 Max == Max Filippov jcmvb...@gmail.com writes:

  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.

It would be good to add a sensible named define (with the above
description) as a comment and use that instead of the magic 125 constant
in the code.

With that fixed:

Acked-by: Peter Korsgaard pe...@korsgaard.com

-- 
Bye, Peter Korsgaard
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] USB: c67x00: add proper delays to HPI read/write

2013-12-24 Thread Max Filippov
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 jcmvb...@gmail.com
---
 drivers/usb/c67x00/c67x00-ll-hpi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c 
b/drivers/usb/c67x00/c67x00-ll-hpi.c
index 3a1ca4d..72fc34e 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
@@ -75,11 +76,13 @@ struct c67x00_lcp_int_data {
 
 static inline u16 hpi_read_reg(struct c67x00_device *dev, int reg)
 {
+   ndelay(125);
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(125);
__raw_writew(value, dev-hpi.base + reg * dev-hpi.regstep);
 }
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html