aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/r8a66597.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/r8a66597.h')
-rw-r--r--drivers/usb/host/r8a66597.h38
1 files changed, 21 insertions, 17 deletions
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
204static 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
204static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, 219static 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
238static 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
253static inline unsigned long get_syscfg_reg(int port) 257static inline unsigned long get_syscfg_reg(int port)
254{ 258{
255 return port == 0 ? SYSCFG0 : SYSCFG1; 259 return port == 0 ? SYSCFG0 : SYSCFG1;