diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2011-07-06 20:57:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-08 17:57:11 -0400 |
commit | f2e9039a43b01f01cab9dfaea2cad5f304fb3343 (patch) | |
tree | 44ddb1f51f05b3cd51a8e08eea08d0d8d7c7362e /drivers/usb | |
parent | 81463c1d707186adbbe534016cd1249edeab0dac (diff) |
usb: r8a66597-hcd: add function for external controller
R8A66597 has the pin of WR0 and WR1. So, if one write-pin of CPU
connects to the pins, we have to change the setting of FIFOSEL
register in the controller. If we don't change the setting,
the controller cannot send the data of odd length.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597.h | 38 |
2 files changed, 22 insertions, 18 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index db6f8b9c19b6..cc8ba3c220b5 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -1438,7 +1438,7 @@ static void packet_write(struct r8a66597 *r8a66597, u16 pipenum) | |||
1438 | if (pipenum > 0) | 1438 | if (pipenum > 0) |
1439 | r8a66597_write(r8a66597, ~(1 << pipenum), BEMPSTS); | 1439 | r8a66597_write(r8a66597, ~(1 << pipenum), BEMPSTS); |
1440 | if (urb->transfer_buffer) { | 1440 | if (urb->transfer_buffer) { |
1441 | r8a66597_write_fifo(r8a66597, td->pipe->fifoaddr, buf, size); | 1441 | r8a66597_write_fifo(r8a66597, td->pipe, buf, size); |
1442 | if (!usb_pipebulk(urb->pipe) || td->maxpacket != size) | 1442 | if (!usb_pipebulk(urb->pipe) || td->maxpacket != size) |
1443 | r8a66597_write(r8a66597, BVAL, td->pipe->fifoctr); | 1443 | r8a66597_write(r8a66597, BVAL, td->pipe->fifoctr); |
1444 | } | 1444 | } |
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 25563e9a90bc..f28782d20eef 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -201,11 +201,26 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | |||
201 | iowrite16(val, r8a66597->reg + offset); | 201 | iowrite16(val, r8a66597->reg + offset); |
202 | } | 202 | } |
203 | 203 | ||
204 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | ||
205 | u16 val, u16 pat, unsigned long offset) | ||
206 | { | ||
207 | u16 tmp; | ||
208 | tmp = r8a66597_read(r8a66597, offset); | ||
209 | tmp = tmp & (~pat); | ||
210 | tmp = tmp | val; | ||
211 | r8a66597_write(r8a66597, tmp, offset); | ||
212 | } | ||
213 | |||
214 | #define r8a66597_bclr(r8a66597, val, offset) \ | ||
215 | r8a66597_mdfy(r8a66597, 0, val, offset) | ||
216 | #define r8a66597_bset(r8a66597, val, offset) \ | ||
217 | r8a66597_mdfy(r8a66597, val, 0, offset) | ||
218 | |||
204 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 219 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
205 | unsigned long offset, u16 *buf, | 220 | struct r8a66597_pipe *pipe, u16 *buf, |
206 | int len) | 221 | int len) |
207 | { | 222 | { |
208 | void __iomem *fifoaddr = r8a66597->reg + offset; | 223 | void __iomem *fifoaddr = r8a66597->reg + pipe->fifoaddr; |
209 | unsigned long count; | 224 | unsigned long count; |
210 | unsigned char *pb; | 225 | unsigned char *pb; |
211 | int i; | 226 | int i; |
@@ -230,26 +245,15 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
230 | iowrite16_rep(fifoaddr, buf, len); | 245 | iowrite16_rep(fifoaddr, buf, len); |
231 | if (unlikely(odd)) { | 246 | if (unlikely(odd)) { |
232 | buf = &buf[len]; | 247 | buf = &buf[len]; |
248 | if (r8a66597->pdata->wr0_shorted_to_wr1) | ||
249 | r8a66597_bclr(r8a66597, MBW_16, pipe->fifosel); | ||
233 | iowrite8((unsigned char)*buf, fifoaddr); | 250 | iowrite8((unsigned char)*buf, fifoaddr); |
251 | if (r8a66597->pdata->wr0_shorted_to_wr1) | ||
252 | r8a66597_bset(r8a66597, MBW_16, pipe->fifosel); | ||
234 | } | 253 | } |
235 | } | 254 | } |
236 | } | 255 | } |
237 | 256 | ||
238 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | ||
239 | u16 val, u16 pat, unsigned long offset) | ||
240 | { | ||
241 | u16 tmp; | ||
242 | tmp = r8a66597_read(r8a66597, offset); | ||
243 | tmp = tmp & (~pat); | ||
244 | tmp = tmp | val; | ||
245 | r8a66597_write(r8a66597, tmp, offset); | ||
246 | } | ||
247 | |||
248 | #define r8a66597_bclr(r8a66597, val, offset) \ | ||
249 | r8a66597_mdfy(r8a66597, 0, val, offset) | ||
250 | #define r8a66597_bset(r8a66597, val, offset) \ | ||
251 | r8a66597_mdfy(r8a66597, val, 0, offset) | ||
252 | |||
253 | static inline unsigned long get_syscfg_reg(int port) | 257 | static inline unsigned long get_syscfg_reg(int port) |
254 | { | 258 | { |
255 | return port == 0 ? SYSCFG0 : SYSCFG1; | 259 | return port == 0 ? SYSCFG0 : SYSCFG1; |