r8a66597 33 drivers/usb/gadget/udc/r8a66597-udc.c static void init_controller(struct r8a66597 *r8a66597); r8a66597 34 drivers/usb/gadget/udc/r8a66597-udc.c static void disable_controller(struct r8a66597 *r8a66597); r8a66597 45 drivers/usb/gadget/udc/r8a66597-udc.c static inline u16 get_usb_speed(struct r8a66597 *r8a66597) r8a66597 47 drivers/usb/gadget/udc/r8a66597-udc.c return r8a66597_read(r8a66597, DVSTCTR0) & RHST; r8a66597 50 drivers/usb/gadget/udc/r8a66597-udc.c static void enable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 55 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, INTENB0); r8a66597 56 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, BEMPE | NRDYE | BRDYE, r8a66597 58 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, (1 << pipenum), reg); r8a66597 59 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, tmp, INTENB0); r8a66597 62 drivers/usb/gadget/udc/r8a66597-udc.c static void disable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 67 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, INTENB0); r8a66597 68 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, BEMPE | NRDYE | BRDYE, r8a66597 70 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, (1 << pipenum), reg); r8a66597 71 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, tmp, INTENB0); r8a66597 74 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_usb_connect(struct r8a66597 *r8a66597) r8a66597 76 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, CTRE, INTENB0); r8a66597 77 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, BEMPE | BRDYE, INTENB0); r8a66597 79 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, DPRPU, SYSCFG0); r8a66597 82 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597) r8a66597 83 drivers/usb/gadget/udc/r8a66597-udc.c __releases(r8a66597->lock) r8a66597 84 drivers/usb/gadget/udc/r8a66597-udc.c __acquires(r8a66597->lock) r8a66597 86 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, CTRE, INTENB0); r8a66597 87 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, BEMPE | BRDYE, INTENB0); r8a66597 88 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); r8a66597 90 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.speed = USB_SPEED_UNKNOWN; r8a66597 91 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 92 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->driver->disconnect(&r8a66597->gadget); r8a66597 93 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 95 drivers/usb/gadget/udc/r8a66597-udc.c disable_controller(r8a66597); r8a66597 96 drivers/usb/gadget/udc/r8a66597-udc.c init_controller(r8a66597); r8a66597 97 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, VBSE, INTENB0); r8a66597 98 drivers/usb/gadget/udc/r8a66597-udc.c INIT_LIST_HEAD(&r8a66597->ep[0].queue); r8a66597 101 drivers/usb/gadget/udc/r8a66597-udc.c static inline u16 control_reg_get_pid(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 107 drivers/usb/gadget/udc/r8a66597-udc.c pid = r8a66597_read(r8a66597, DCPCTR) & PID; r8a66597 110 drivers/usb/gadget/udc/r8a66597-udc.c pid = r8a66597_read(r8a66597, offset) & PID; r8a66597 112 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", r8a66597 119 drivers/usb/gadget/udc/r8a66597-udc.c static inline void control_reg_set_pid(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 125 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, pid, PID, DCPCTR); r8a66597 128 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, pid, PID, offset); r8a66597 130 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", r8a66597 135 drivers/usb/gadget/udc/r8a66597-udc.c static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 137 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_set_pid(r8a66597, pipenum, PID_BUF); r8a66597 140 drivers/usb/gadget/udc/r8a66597-udc.c static inline void pipe_stop(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 142 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_set_pid(r8a66597, pipenum, PID_NAK); r8a66597 145 drivers/usb/gadget/udc/r8a66597-udc.c static inline void pipe_stall(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 147 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_set_pid(r8a66597, pipenum, PID_STALL); r8a66597 150 drivers/usb/gadget/udc/r8a66597-udc.c static inline u16 control_reg_get(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 156 drivers/usb/gadget/udc/r8a66597-udc.c ret = r8a66597_read(r8a66597, DCPCTR); r8a66597 159 drivers/usb/gadget/udc/r8a66597-udc.c ret = r8a66597_read(r8a66597, offset); r8a66597 161 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", r8a66597 168 drivers/usb/gadget/udc/r8a66597-udc.c static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 172 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 175 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SQCLR, DCPCTR); r8a66597 178 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SQCLR, offset); r8a66597 180 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", r8a66597 185 drivers/usb/gadget/udc/r8a66597-udc.c static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 189 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 192 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SQSET, DCPCTR); r8a66597 195 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SQSET, offset); r8a66597 197 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 202 drivers/usb/gadget/udc/r8a66597-udc.c static u16 control_reg_sqmon(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 207 drivers/usb/gadget/udc/r8a66597-udc.c return r8a66597_read(r8a66597, DCPCTR) & SQMON; r8a66597 210 drivers/usb/gadget/udc/r8a66597-udc.c return r8a66597_read(r8a66597, offset) & SQMON; r8a66597 212 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 219 drivers/usb/gadget/udc/r8a66597-udc.c static u16 save_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 221 drivers/usb/gadget/udc/r8a66597-udc.c return control_reg_sqmon(r8a66597, pipenum); r8a66597 224 drivers/usb/gadget/udc/r8a66597-udc.c static void restore_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 228 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_sqset(r8a66597, pipenum); r8a66597 230 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_sqclr(r8a66597, pipenum); r8a66597 233 drivers/usb/gadget/udc/r8a66597-udc.c static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 239 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, DCPCFG); r8a66597 243 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, DCPMAXP); r8a66597 247 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, pipenum, PIPESEL); r8a66597 248 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, PIPECFG); r8a66597 250 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, PIPEBUF); r8a66597 253 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, PIPEMAXP); r8a66597 261 drivers/usb/gadget/udc/r8a66597-udc.c static inline unsigned short mbw_value(struct r8a66597 *r8a66597) r8a66597 263 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) r8a66597 269 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_change_curpipe(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 282 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, loop, mask, fifosel); r8a66597 285 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, fifosel); r8a66597 287 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 296 drivers/usb/gadget/udc/r8a66597-udc.c static void pipe_change(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 298 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; r8a66597 301 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DREQE, ep->fifosel); r8a66597 303 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, pipenum, CURPIPE, ep->fifosel); r8a66597 307 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597_is_sudmac(r8a66597) && ep->use_dma) r8a66597 308 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, mbw_value(r8a66597), ep->fifosel); r8a66597 310 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); r8a66597 313 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, DREQE, ep->fifosel); r8a66597 316 drivers/usb/gadget/udc/r8a66597-udc.c static int pipe_buffer_setting(struct r8a66597 *r8a66597, r8a66597 325 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, info->pipe, PIPESEL); r8a66597 361 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, pipecfg, PIPECFG); r8a66597 362 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, (buf_bsize << 10) | (bufnum), PIPEBUF); r8a66597 363 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, info->maxpacket, PIPEMAXP); r8a66597 366 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, info->interval, PIPEPERI); r8a66597 371 drivers/usb/gadget/udc/r8a66597-udc.c static void pipe_buffer_release(struct r8a66597 *r8a66597, r8a66597 378 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->bulk--; r8a66597 380 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->interrupt--; r8a66597 382 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->isochronous--; r8a66597 384 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->bulk--; r8a66597 386 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 393 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 395 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, 0, CURPIPE, ep->fifosel); r8a66597 397 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ACLRM, ep->pipectr); r8a66597 398 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, ep->pipectr); r8a66597 399 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, SQCLR, ep->pipectr); r8a66597 401 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, ep->pipenum, CURPIPE, ep->fifosel); r8a66597 405 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel); r8a66597 409 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_ep_setting(struct r8a66597 *r8a66597, r8a66597 429 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->pipenum2ep[pipenum] = ep; r8a66597 430 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->epaddr2ep[usb_endpoint_num(desc)] r8a66597 437 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 444 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->num_dma--; r8a66597 453 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 466 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) { r8a66597 467 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { r8a66597 468 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 473 drivers/usb/gadget/udc/r8a66597-udc.c + r8a66597->isochronous; r8a66597 474 drivers/usb/gadget/udc/r8a66597-udc.c counter = &r8a66597->isochronous; r8a66597 477 drivers/usb/gadget/udc/r8a66597-udc.c info.pipe = R8A66597_BASE_PIPENUM_BULK + r8a66597->bulk; r8a66597 478 drivers/usb/gadget/udc/r8a66597-udc.c counter = &r8a66597->bulk; r8a66597 484 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->interrupt >= R8A66597_MAX_NUM_INT) { r8a66597 485 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 489 drivers/usb/gadget/udc/r8a66597-udc.c info.pipe = R8A66597_BASE_PIPENUM_INT + r8a66597->interrupt; r8a66597 491 drivers/usb/gadget/udc/r8a66597-udc.c counter = &r8a66597->interrupt; r8a66597 494 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { r8a66597 495 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 499 drivers/usb/gadget/udc/r8a66597-udc.c info.pipe = R8A66597_BASE_PIPENUM_ISOC + r8a66597->isochronous; r8a66597 501 drivers/usb/gadget/udc/r8a66597-udc.c counter = &r8a66597->isochronous; r8a66597 504 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "unexpect xfer type\n"); r8a66597 517 drivers/usb/gadget/udc/r8a66597-udc.c ret = pipe_buffer_setting(r8a66597, &info); r8a66597 519 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 525 drivers/usb/gadget/udc/r8a66597-udc.c if ((counter == &r8a66597->isochronous) && info.type == R8A66597_BULK) r8a66597 526 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->bulk++; r8a66597 528 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_ep_setting(r8a66597, ep, desc, info.pipe, dma); r8a66597 536 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 541 drivers/usb/gadget/udc/r8a66597-udc.c pipe_buffer_release(r8a66597, &info); r8a66597 548 drivers/usb/gadget/udc/r8a66597-udc.c static void pipe_irq_enable(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 550 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_ready(r8a66597, pipenum); r8a66597 551 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_nrdy(r8a66597, pipenum); r8a66597 554 drivers/usb/gadget/udc/r8a66597-udc.c static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 556 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_ready(r8a66597, pipenum); r8a66597 557 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_nrdy(r8a66597, pipenum); r8a66597 561 drivers/usb/gadget/udc/r8a66597-udc.c static void control_end(struct r8a66597 *r8a66597, unsigned ccpl) r8a66597 563 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].internal_ccpl = ccpl; r8a66597 564 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, 0); r8a66597 565 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, CCPL, DCPCTR); r8a66597 571 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 573 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, ep->pipenum); r8a66597 574 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, ISEL, (ISEL | CURPIPE), CFIFOSEL); r8a66597 575 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, BCLR, ep->fifoctr); r8a66597 577 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, BVAL, ep->fifoctr); r8a66597 578 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, 0); r8a66597 581 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~BEMP0, BEMPSTS); r8a66597 586 drivers/usb/gadget/udc/r8a66597-udc.c static void disable_fifosel(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 591 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, fifosel) & CURPIPE; r8a66597 593 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_change_curpipe(r8a66597, 0, 0, fifosel); r8a66597 596 drivers/usb/gadget/udc/r8a66597-udc.c static void change_bfre_mode(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 599 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; r8a66597 603 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, pipenum, PIPESEL); r8a66597 604 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, PIPECFG) & R8A66597_BFRE; r8a66597 609 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 610 drivers/usb/gadget/udc/r8a66597-udc.c disable_fifosel(r8a66597, pipenum, CFIFOSEL); r8a66597 611 drivers/usb/gadget/udc/r8a66597-udc.c disable_fifosel(r8a66597, pipenum, D0FIFOSEL); r8a66597 612 drivers/usb/gadget/udc/r8a66597-udc.c disable_fifosel(r8a66597, pipenum, D1FIFOSEL); r8a66597 614 drivers/usb/gadget/udc/r8a66597-udc.c toggle = save_usb_toggle(r8a66597, pipenum); r8a66597 616 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, pipenum, PIPESEL); r8a66597 618 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, R8A66597_BFRE, PIPECFG); r8a66597 620 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, R8A66597_BFRE, PIPECFG); r8a66597 623 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, ACLRM, ep->pipectr); r8a66597 624 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, ACLRM, ep->pipectr); r8a66597 626 drivers/usb/gadget/udc/r8a66597-udc.c restore_usb_toggle(r8a66597, pipenum, toggle); r8a66597 629 drivers/usb/gadget/udc/r8a66597-udc.c static int sudmac_alloc_channel(struct r8a66597 *r8a66597, r8a66597 635 drivers/usb/gadget/udc/r8a66597-udc.c if (!r8a66597_is_sudmac(r8a66597)) r8a66597 642 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->dma.used) r8a66597 646 drivers/usb/gadget/udc/r8a66597-udc.c dma = &r8a66597->dma; r8a66597 652 drivers/usb/gadget/udc/r8a66597-udc.c change_bfre_mode(r8a66597, ep->pipenum, 1); r8a66597 663 drivers/usb/gadget/udc/r8a66597-udc.c return usb_gadget_map_request(&r8a66597->gadget, &req->req, dma->dir); r8a66597 666 drivers/usb/gadget/udc/r8a66597-udc.c static void sudmac_free_channel(struct r8a66597 *r8a66597, r8a66597 670 drivers/usb/gadget/udc/r8a66597-udc.c if (!r8a66597_is_sudmac(r8a66597)) r8a66597 673 drivers/usb/gadget/udc/r8a66597-udc.c usb_gadget_unmap_request(&r8a66597->gadget, &req->req, ep->dma->dir); r8a66597 675 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DREQE, ep->fifosel); r8a66597 676 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_change_curpipe(r8a66597, 0, 0, ep->fifosel); r8a66597 685 drivers/usb/gadget/udc/r8a66597-udc.c static void sudmac_start(struct r8a66597 *r8a66597, struct r8a66597_ep *ep, r8a66597 690 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, LBA_WAIT, CH0CFG); r8a66597 691 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, req->req.dma, CH0BA); r8a66597 692 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, req->req.length, CH0BBC); r8a66597 693 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, CH0ENDE, DINTCTRL); r8a66597 695 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, DEN, CH0DEN); r8a66597 701 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 704 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, ep->pipenum); r8a66597 705 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_empty(r8a66597, ep->pipenum); r8a66597 706 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, ep->pipenum); r8a66597 711 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~(1 << ep->pipenum), BRDYSTS); r8a66597 712 drivers/usb/gadget/udc/r8a66597-udc.c if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { r8a66597 714 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, ep->pipenum); r8a66597 715 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_empty(r8a66597, ep->pipenum); r8a66597 716 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, ep->pipenum); r8a66597 717 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, ep->fifoctr); r8a66597 719 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_enable(r8a66597, ep->pipenum); r8a66597 724 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, ep->pipenum); r8a66597 725 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_nrdy(r8a66597, ep->pipenum); r8a66597 726 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, ep->pipenum); r8a66597 727 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_nrdy(r8a66597, ep->pipenum); r8a66597 728 drivers/usb/gadget/udc/r8a66597-udc.c sudmac_start(r8a66597, ep, req); r8a66597 736 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 740 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, 0, (ISEL | CURPIPE), CFIFOSEL); r8a66597 741 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, BCLR, ep->fifoctr); r8a66597 742 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, pipenum); r8a66597 743 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_enable(r8a66597, pipenum); r8a66597 745 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 747 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_nrdy(r8a66597, pipenum); r8a66597 748 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, TRCLR, ep->pipetre); r8a66597 749 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, r8a66597 752 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, TRENB, ep->pipetre); r8a66597 755 drivers/usb/gadget/udc/r8a66597-udc.c if (sudmac_alloc_channel(r8a66597, ep, req) < 0) { r8a66597 757 drivers/usb/gadget/udc/r8a66597-udc.c change_bfre_mode(r8a66597, ep->pipenum, 0); r8a66597 758 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, pipenum); /* trigger once */ r8a66597 759 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_enable(r8a66597, pipenum); r8a66597 761 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, pipenum); r8a66597 762 drivers/usb/gadget/udc/r8a66597-udc.c sudmac_start(r8a66597, ep, req); r8a66597 763 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, pipenum); /* trigger once */ r8a66597 780 drivers/usb/gadget/udc/r8a66597-udc.c ctsq = r8a66597_read(ep->r8a66597, INTSTS0) & CTSQ; r8a66597 791 drivers/usb/gadget/udc/r8a66597-udc.c control_end(ep->r8a66597, 0); r8a66597 794 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(ep->r8a66597), r8a66597 800 drivers/usb/gadget/udc/r8a66597-udc.c static void init_controller(struct r8a66597 *r8a66597) r8a66597 802 drivers/usb/gadget/udc/r8a66597-udc.c u16 vif = r8a66597->pdata->vif ? LDRV : 0; r8a66597 803 drivers/usb/gadget/udc/r8a66597-udc.c u16 irq_sense = r8a66597->irq_sense_low ? INTL : 0; r8a66597 804 drivers/usb/gadget/udc/r8a66597-udc.c u16 endian = r8a66597->pdata->endian ? BIGEND : 0; r8a66597 806 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) { r8a66597 807 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->buswait) r8a66597 808 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, r8a66597->pdata->buswait, r8a66597 811 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0x0f, SYSCFG1); r8a66597 812 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, HSE, SYSCFG0); r8a66597 814 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, USBE, SYSCFG0); r8a66597 815 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); r8a66597 816 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, USBE, SYSCFG0); r8a66597 818 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SCKE, SYSCFG0); r8a66597 820 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, irq_sense, INTENB1); r8a66597 821 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, r8a66597 824 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, vif | endian, PINCFG); r8a66597 825 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, HSE, SYSCFG0); /* High spd */ r8a66597 826 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, get_xtal_from_pdata(r8a66597->pdata), r8a66597 829 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, USBE, SYSCFG0); r8a66597 830 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); r8a66597 831 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, USBE, SYSCFG0); r8a66597 833 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, XCKE, SYSCFG0); r8a66597 837 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, PLLC, SYSCFG0); r8a66597 841 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SCKE, SYSCFG0); r8a66597 843 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, irq_sense, INTENB1); r8a66597 844 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, r8a66597 849 drivers/usb/gadget/udc/r8a66597-udc.c static void disable_controller(struct r8a66597 *r8a66597) r8a66597 851 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) { r8a66597 852 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, SCKE, SYSCFG0); r8a66597 853 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, UTST, TESTMODE); r8a66597 856 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, INTENB0); r8a66597 857 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, INTENB1); r8a66597 858 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, BRDYENB); r8a66597 859 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, BEMPENB); r8a66597 860 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, NRDYENB); r8a66597 863 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, BRDYSTS); r8a66597 864 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, NRDYSTS); r8a66597 865 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0, BEMPSTS); r8a66597 867 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, USBE, SYSCFG0); r8a66597 868 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, SCKE, SYSCFG0); r8a66597 871 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, UTST, TESTMODE); r8a66597 872 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, SCKE, SYSCFG0); r8a66597 874 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, PLLC, SYSCFG0); r8a66597 877 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, XCKE, SYSCFG0); r8a66597 881 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_start_xclock(struct r8a66597 *r8a66597) r8a66597 885 drivers/usb/gadget/udc/r8a66597-udc.c if (!r8a66597->pdata->on_chip) { r8a66597 886 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, SYSCFG0); r8a66597 888 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, XCKE, SYSCFG0); r8a66597 900 drivers/usb/gadget/udc/r8a66597-udc.c __releases(r8a66597->lock) r8a66597 901 drivers/usb/gadget/udc/r8a66597-udc.c __acquires(r8a66597->lock) r8a66597 913 drivers/usb/gadget/udc/r8a66597-udc.c if (ep->r8a66597->gadget.speed == USB_SPEED_UNKNOWN) r8a66597 922 drivers/usb/gadget/udc/r8a66597-udc.c sudmac_free_channel(ep->r8a66597, ep, req); r8a66597 924 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&ep->r8a66597->lock); r8a66597 926 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&ep->r8a66597->lock); r8a66597 943 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 945 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, pipenum); r8a66597 946 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, ISEL, ep->fifosel); r8a66597 950 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, ep->fifoctr); r8a66597 952 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 961 drivers/usb/gadget/udc/r8a66597-udc.c bufsize = get_buffer_size(r8a66597, pipenum); r8a66597 968 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write_fifo(r8a66597, ep, buf, size); r8a66597 970 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, BVAL, ep->fifoctr); r8a66597 980 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_ready(r8a66597, pipenum); r8a66597 981 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_empty(r8a66597, pipenum); r8a66597 983 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_ready(r8a66597, pipenum); r8a66597 984 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_empty(r8a66597, pipenum); r8a66597 986 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, pipenum); r8a66597 997 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 999 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, pipenum); r8a66597 1000 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, ep->fifoctr); r8a66597 1002 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 1003 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1004 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 1010 drivers/usb/gadget/udc/r8a66597-udc.c bufsize = get_buffer_size(r8a66597, pipenum); r8a66597 1016 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write_fifo(r8a66597, ep, buf, size); r8a66597 1021 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, BVAL, ep->fifoctr); r8a66597 1030 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_ready(r8a66597, pipenum); r8a66597 1031 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_empty(r8a66597, pipenum); r8a66597 1033 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_empty(r8a66597, pipenum); r8a66597 1034 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_enable(r8a66597, pipenum); r8a66597 1046 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = ep->r8a66597; r8a66597 1049 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, pipenum); r8a66597 1050 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, ep->fifoctr); r8a66597 1053 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 1054 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1055 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "read fifo not ready"); r8a66597 1061 drivers/usb/gadget/udc/r8a66597-udc.c bufsize = get_buffer_size(r8a66597, pipenum); r8a66597 1077 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 1078 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1085 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, BCLR, ep->fifoctr); r8a66597 1087 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_read_fifo(r8a66597, ep->fifoaddr, buf, size); r8a66597 1095 drivers/usb/gadget/udc/r8a66597-udc.c static void irq_pipe_ready(struct r8a66597 *r8a66597, u16 status, u16 enb) r8a66597 1103 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~BRDY0, BRDYSTS); r8a66597 1104 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_mdfy(r8a66597, 0, CURPIPE, CFIFOSEL); r8a66597 1106 drivers/usb/gadget/udc/r8a66597-udc.c ep = &r8a66597->ep[0]; r8a66597 1113 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~check, BRDYSTS); r8a66597 1114 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->pipenum2ep[pipenum]; r8a66597 1125 drivers/usb/gadget/udc/r8a66597-udc.c static void irq_pipe_empty(struct r8a66597 *r8a66597, u16 status, u16 enb) r8a66597 1134 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~BEMP0, BEMPSTS); r8a66597 1136 drivers/usb/gadget/udc/r8a66597-udc.c ep = &r8a66597->ep[0]; r8a66597 1143 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~check, BEMPSTS); r8a66597 1144 drivers/usb/gadget/udc/r8a66597-udc.c tmp = control_reg_get(r8a66597, pipenum); r8a66597 1146 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_empty(r8a66597, pipenum); r8a66597 1147 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1148 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, pipenum); r8a66597 1149 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->pipenum2ep[pipenum]; r8a66597 1159 drivers/usb/gadget/udc/r8a66597-udc.c static void get_status(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) r8a66597 1160 drivers/usb/gadget/udc/r8a66597-udc.c __releases(r8a66597->lock) r8a66597 1161 drivers/usb/gadget/udc/r8a66597-udc.c __acquires(r8a66597->lock) r8a66597 1170 drivers/usb/gadget/udc/r8a66597-udc.c status = r8a66597->device_status; r8a66597 1176 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->epaddr2ep[w_index & USB_ENDPOINT_NUMBER_MASK]; r8a66597 1177 drivers/usb/gadget/udc/r8a66597-udc.c pid = control_reg_get_pid(r8a66597, ep->pipenum); r8a66597 1184 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, 0); r8a66597 1188 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep0_data = cpu_to_le16(status); r8a66597 1189 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep0_req->buf = &r8a66597->ep0_data; r8a66597 1190 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep0_req->length = 2; r8a66597 1192 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 1193 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_queue(r8a66597->gadget.ep0, r8a66597->ep0_req, GFP_ATOMIC); r8a66597 1194 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 1197 drivers/usb/gadget/udc/r8a66597-udc.c static void clear_feature(struct r8a66597 *r8a66597, r8a66597 1202 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1205 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1212 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->epaddr2ep[w_index & USB_ENDPOINT_NUMBER_MASK]; r8a66597 1214 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(r8a66597, ep->pipenum); r8a66597 1215 drivers/usb/gadget/udc/r8a66597-udc.c control_reg_sqclr(r8a66597, ep->pipenum); r8a66597 1216 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 1218 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 1221 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1230 drivers/usb/gadget/udc/r8a66597-udc.c pipe_start(r8a66597, ep->pipenum); r8a66597 1234 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, 0); r8a66597 1239 drivers/usb/gadget/udc/r8a66597-udc.c static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) r8a66597 1248 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1251 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; r8a66597 1256 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, r8a66597 1261 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, 0); r8a66597 1266 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1272 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->epaddr2ep[w_index & USB_ENDPOINT_NUMBER_MASK]; r8a66597 1273 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, ep->pipenum); r8a66597 1275 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 1); r8a66597 1279 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, 0); r8a66597 1285 drivers/usb/gadget/udc/r8a66597-udc.c static int setup_packet(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) r8a66597 1292 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~VALID, INTSTS0); r8a66597 1295 drivers/usb/gadget/udc/r8a66597-udc.c p[i] = r8a66597_read(r8a66597, offset + i*2); r8a66597 1301 drivers/usb/gadget/udc/r8a66597-udc.c get_status(r8a66597, ctrl); r8a66597 1304 drivers/usb/gadget/udc/r8a66597-udc.c clear_feature(r8a66597, ctrl); r8a66597 1307 drivers/usb/gadget/udc/r8a66597-udc.c set_feature(r8a66597, ctrl); r8a66597 1318 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_update_usb_speed(struct r8a66597 *r8a66597) r8a66597 1320 drivers/usb/gadget/udc/r8a66597-udc.c u16 speed = get_usb_speed(r8a66597); r8a66597 1324 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.speed = USB_SPEED_HIGH; r8a66597 1327 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.speed = USB_SPEED_FULL; r8a66597 1330 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.speed = USB_SPEED_UNKNOWN; r8a66597 1331 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), "USB speed unknown\n"); r8a66597 1335 drivers/usb/gadget/udc/r8a66597-udc.c static void irq_device_state(struct r8a66597 *r8a66597) r8a66597 1339 drivers/usb/gadget/udc/r8a66597-udc.c dvsq = r8a66597_read(r8a66597, INTSTS0) & DVSQ; r8a66597 1340 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~DVST, INTSTS0); r8a66597 1344 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 1345 drivers/usb/gadget/udc/r8a66597-udc.c usb_gadget_udc_reset(&r8a66597->gadget, r8a66597->driver); r8a66597 1346 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 1347 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_update_usb_speed(r8a66597); r8a66597 1349 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) r8a66597 1350 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_update_usb_speed(r8a66597); r8a66597 1352 drivers/usb/gadget/udc/r8a66597-udc.c && r8a66597->gadget.speed == USB_SPEED_UNKNOWN) r8a66597 1353 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_update_usb_speed(r8a66597); r8a66597 1355 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->old_dvsq = dvsq; r8a66597 1358 drivers/usb/gadget/udc/r8a66597-udc.c static void irq_control_stage(struct r8a66597 *r8a66597) r8a66597 1359 drivers/usb/gadget/udc/r8a66597-udc.c __releases(r8a66597->lock) r8a66597 1360 drivers/usb/gadget/udc/r8a66597-udc.c __acquires(r8a66597->lock) r8a66597 1365 drivers/usb/gadget/udc/r8a66597-udc.c ctsq = r8a66597_read(r8a66597, INTSTS0) & CTSQ; r8a66597 1366 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~CTRT, INTSTS0); r8a66597 1372 drivers/usb/gadget/udc/r8a66597-udc.c ep = &r8a66597->ep[0]; r8a66597 1381 drivers/usb/gadget/udc/r8a66597-udc.c if (setup_packet(r8a66597, &ctrl)) { r8a66597 1382 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 1383 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->driver->setup(&r8a66597->gadget, &ctrl) r8a66597 1385 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(r8a66597, 0); r8a66597 1386 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 1391 drivers/usb/gadget/udc/r8a66597-udc.c control_end(r8a66597, 0); r8a66597 1394 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 1400 drivers/usb/gadget/udc/r8a66597-udc.c static void sudmac_finish(struct r8a66597 *r8a66597, struct r8a66597_ep *ep) r8a66597 1408 drivers/usb/gadget/udc/r8a66597-udc.c pipe_change(r8a66597, pipenum); r8a66597 1410 drivers/usb/gadget/udc/r8a66597-udc.c while (!(r8a66597_read(r8a66597, ep->fifoctr) & FRDY)) { r8a66597 1413 drivers/usb/gadget/udc/r8a66597-udc.c dev_err(r8a66597_to_dev(r8a66597), r8a66597 1420 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, BCLR, ep->fifoctr); r8a66597 1424 drivers/usb/gadget/udc/r8a66597-udc.c len = r8a66597_sudmac_read(r8a66597, CH0CBC); r8a66597 1428 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, CH0STCLR, DSTSCLR); r8a66597 1434 drivers/usb/gadget/udc/r8a66597-udc.c disable_irq_ready(r8a66597, pipenum); r8a66597 1435 drivers/usb/gadget/udc/r8a66597-udc.c enable_irq_empty(r8a66597, pipenum); r8a66597 1438 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, ~(1 << pipenum), BRDYSTS); r8a66597 1444 drivers/usb/gadget/udc/r8a66597-udc.c static void r8a66597_sudmac_irq(struct r8a66597 *r8a66597) r8a66597 1450 drivers/usb/gadget/udc/r8a66597-udc.c irqsts = r8a66597_sudmac_read(r8a66597, DINTSTS); r8a66597 1452 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_write(r8a66597, CH0ENDC, DINTSTSCLR); r8a66597 1453 drivers/usb/gadget/udc/r8a66597-udc.c pipenum = (r8a66597_read(r8a66597, D0FIFOSEL) & CURPIPE); r8a66597 1454 drivers/usb/gadget/udc/r8a66597-udc.c ep = r8a66597->pipenum2ep[pipenum]; r8a66597 1455 drivers/usb/gadget/udc/r8a66597-udc.c sudmac_finish(r8a66597, ep); r8a66597 1461 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = _r8a66597; r8a66597 1467 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock(&r8a66597->lock); r8a66597 1469 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597_is_sudmac(r8a66597)) r8a66597 1470 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_sudmac_irq(r8a66597); r8a66597 1472 drivers/usb/gadget/udc/r8a66597-udc.c intsts0 = r8a66597_read(r8a66597, INTSTS0); r8a66597 1473 drivers/usb/gadget/udc/r8a66597-udc.c intenb0 = r8a66597_read(r8a66597, INTENB0); r8a66597 1475 drivers/usb/gadget/udc/r8a66597-udc.c savepipe = r8a66597_read(r8a66597, CFIFOSEL); r8a66597 1479 drivers/usb/gadget/udc/r8a66597-udc.c u16 brdysts = r8a66597_read(r8a66597, BRDYSTS); r8a66597 1480 drivers/usb/gadget/udc/r8a66597-udc.c u16 bempsts = r8a66597_read(r8a66597, BEMPSTS); r8a66597 1481 drivers/usb/gadget/udc/r8a66597-udc.c u16 brdyenb = r8a66597_read(r8a66597, BRDYENB); r8a66597 1482 drivers/usb/gadget/udc/r8a66597-udc.c u16 bempenb = r8a66597_read(r8a66597, BEMPENB); r8a66597 1485 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, 0xffff & ~VBINT, r8a66597 1487 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_start_xclock(r8a66597); r8a66597 1490 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->old_vbus = r8a66597_read(r8a66597, INTSTS0) r8a66597 1492 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->scount = R8A66597_MAX_SAMPLING; r8a66597 1494 drivers/usb/gadget/udc/r8a66597-udc.c mod_timer(&r8a66597->timer, r8a66597 1498 drivers/usb/gadget/udc/r8a66597-udc.c irq_device_state(r8a66597); r8a66597 1502 drivers/usb/gadget/udc/r8a66597-udc.c irq_pipe_ready(r8a66597, brdysts, brdyenb); r8a66597 1505 drivers/usb/gadget/udc/r8a66597-udc.c irq_pipe_empty(r8a66597, bempsts, bempenb); r8a66597 1508 drivers/usb/gadget/udc/r8a66597-udc.c irq_control_stage(r8a66597); r8a66597 1511 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(r8a66597, savepipe, CFIFOSEL); r8a66597 1513 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock(&r8a66597->lock); r8a66597 1519 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = from_timer(r8a66597, t, timer); r8a66597 1523 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1524 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, SYSCFG0); r8a66597 1525 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->scount > 0) { r8a66597 1526 drivers/usb/gadget/udc/r8a66597-udc.c tmp = r8a66597_read(r8a66597, INTSTS0) & VBSTS; r8a66597 1527 drivers/usb/gadget/udc/r8a66597-udc.c if (tmp == r8a66597->old_vbus) { r8a66597 1528 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->scount--; r8a66597 1529 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->scount == 0) { r8a66597 1531 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_usb_connect(r8a66597); r8a66597 1533 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_usb_disconnect(r8a66597); r8a66597 1535 drivers/usb/gadget/udc/r8a66597-udc.c mod_timer(&r8a66597->timer, r8a66597 1539 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->scount = R8A66597_MAX_SAMPLING; r8a66597 1540 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->old_vbus = tmp; r8a66597 1541 drivers/usb/gadget/udc/r8a66597-udc.c mod_timer(&r8a66597->timer, r8a66597 1545 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1569 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1571 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1574 drivers/usb/gadget/udc/r8a66597-udc.c pipe_irq_disable(ep->r8a66597, ep->pipenum); r8a66597 1611 drivers/usb/gadget/udc/r8a66597-udc.c if (ep->r8a66597->gadget.speed == USB_SPEED_UNKNOWN) r8a66597 1614 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1630 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1644 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1647 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1658 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1663 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stall(ep->r8a66597, ep->pipenum); r8a66597 1667 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(ep->r8a66597, ep->pipenum); r8a66597 1669 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1683 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1685 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1696 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&ep->r8a66597->lock, flags); r8a66597 1698 drivers/usb/gadget/udc/r8a66597-udc.c pipe_stop(ep->r8a66597, ep->pipenum); r8a66597 1699 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr); r8a66597 1700 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(ep->r8a66597, ACLRM, ep->pipectr); r8a66597 1701 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_write(ep->r8a66597, 0, ep->pipectr); r8a66597 1703 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&ep->r8a66597->lock, flags); r8a66597 1725 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); r8a66597 1731 drivers/usb/gadget/udc/r8a66597-udc.c if (!r8a66597) r8a66597 1735 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->driver = driver; r8a66597 1737 drivers/usb/gadget/udc/r8a66597-udc.c init_controller(r8a66597); r8a66597 1738 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, VBSE, INTENB0); r8a66597 1739 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { r8a66597 1740 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_start_xclock(r8a66597); r8a66597 1742 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->old_vbus = r8a66597_read(r8a66597, r8a66597 1744 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->scount = R8A66597_MAX_SAMPLING; r8a66597 1745 drivers/usb/gadget/udc/r8a66597-udc.c mod_timer(&r8a66597->timer, jiffies + msecs_to_jiffies(50)); r8a66597 1753 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); r8a66597 1756 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1757 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, VBSE, INTENB0); r8a66597 1758 drivers/usb/gadget/udc/r8a66597-udc.c disable_controller(r8a66597); r8a66597 1759 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1761 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->driver = NULL; r8a66597 1768 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = gadget_to_r8a66597(_gadget); r8a66597 1769 drivers/usb/gadget/udc/r8a66597-udc.c return r8a66597_read(r8a66597, FRMNUM) & 0x03FF; r8a66597 1774 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); r8a66597 1777 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1779 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bset(r8a66597, DPRPU, SYSCFG0); r8a66597 1781 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); r8a66597 1782 drivers/usb/gadget/udc/r8a66597-udc.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1789 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); r8a66597 1793 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->device_status |= 1 << USB_DEVICE_SELF_POWERED; r8a66597 1795 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->device_status &= ~(1 << USB_DEVICE_SELF_POWERED); r8a66597 1810 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = platform_get_drvdata(pdev); r8a66597 1812 drivers/usb/gadget/udc/r8a66597-udc.c usb_del_gadget_udc(&r8a66597->gadget); r8a66597 1813 drivers/usb/gadget/udc/r8a66597-udc.c del_timer_sync(&r8a66597->timer); r8a66597 1814 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); r8a66597 1816 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) { r8a66597 1817 drivers/usb/gadget/udc/r8a66597-udc.c clk_disable_unprepare(r8a66597->clk); r8a66597 1827 drivers/usb/gadget/udc/r8a66597-udc.c static int r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597, r8a66597 1833 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->sudmac_reg = devm_ioremap_resource(&pdev->dev, res); r8a66597 1834 drivers/usb/gadget/udc/r8a66597-udc.c return PTR_ERR_OR_ZERO(r8a66597->sudmac_reg); r8a66597 1844 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597 *r8a66597 = NULL; r8a66597 1864 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597 = devm_kzalloc(dev, sizeof(struct r8a66597), GFP_KERNEL); r8a66597 1865 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597 == NULL) r8a66597 1868 drivers/usb/gadget/udc/r8a66597-udc.c spin_lock_init(&r8a66597->lock); r8a66597 1869 drivers/usb/gadget/udc/r8a66597-udc.c platform_set_drvdata(pdev, r8a66597); r8a66597 1870 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->pdata = dev_get_platdata(dev); r8a66597 1871 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; r8a66597 1873 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.ops = &r8a66597_gadget_ops; r8a66597 1874 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.max_speed = USB_SPEED_HIGH; r8a66597 1875 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.name = udc_name; r8a66597 1877 drivers/usb/gadget/udc/r8a66597-udc.c timer_setup(&r8a66597->timer, r8a66597_timer, 0); r8a66597 1878 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->reg = reg; r8a66597 1880 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) { r8a66597 1882 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->clk = devm_clk_get(dev, clk_name); r8a66597 1883 drivers/usb/gadget/udc/r8a66597-udc.c if (IS_ERR(r8a66597->clk)) { r8a66597 1885 drivers/usb/gadget/udc/r8a66597-udc.c return PTR_ERR(r8a66597->clk); r8a66597 1887 drivers/usb/gadget/udc/r8a66597-udc.c clk_prepare_enable(r8a66597->clk); r8a66597 1890 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->sudmac) { r8a66597 1891 drivers/usb/gadget/udc/r8a66597-udc.c ret = r8a66597_sudmac_ioremap(r8a66597, pdev); r8a66597 1896 drivers/usb/gadget/udc/r8a66597-udc.c disable_controller(r8a66597); /* make sure controller is disabled */ r8a66597 1899 drivers/usb/gadget/udc/r8a66597-udc.c udc_name, r8a66597); r8a66597 1905 drivers/usb/gadget/udc/r8a66597-udc.c INIT_LIST_HEAD(&r8a66597->gadget.ep_list); r8a66597 1906 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->gadget.ep0 = &r8a66597->ep[0].ep; r8a66597 1907 drivers/usb/gadget/udc/r8a66597-udc.c INIT_LIST_HEAD(&r8a66597->gadget.ep0->ep_list); r8a66597 1909 drivers/usb/gadget/udc/r8a66597-udc.c struct r8a66597_ep *ep = &r8a66597->ep[i]; r8a66597 1912 drivers/usb/gadget/udc/r8a66597-udc.c INIT_LIST_HEAD(&r8a66597->ep[i].ep.ep_list); r8a66597 1913 drivers/usb/gadget/udc/r8a66597-udc.c list_add_tail(&r8a66597->ep[i].ep.ep_list, r8a66597 1914 drivers/usb/gadget/udc/r8a66597-udc.c &r8a66597->gadget.ep_list); r8a66597 1916 drivers/usb/gadget/udc/r8a66597-udc.c ep->r8a66597 = r8a66597; r8a66597 1932 drivers/usb/gadget/udc/r8a66597-udc.c usb_ep_set_maxpacket_limit(&r8a66597->ep[0].ep, 64); r8a66597 1933 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].pipenum = 0; r8a66597 1934 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].fifoaddr = CFIFO; r8a66597 1935 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].fifosel = CFIFOSEL; r8a66597 1936 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].fifoctr = CFIFOCTR; r8a66597 1937 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep[0].pipectr = get_pipectr_addr(0); r8a66597 1938 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->pipenum2ep[0] = &r8a66597->ep[0]; r8a66597 1939 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->epaddr2ep[0] = &r8a66597->ep[0]; r8a66597 1941 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep, r8a66597 1943 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->ep0_req == NULL) { r8a66597 1947 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597->ep0_req->complete = nop_completion; r8a66597 1949 drivers/usb/gadget/udc/r8a66597-udc.c ret = usb_add_gadget_udc(dev, &r8a66597->gadget); r8a66597 1957 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); r8a66597 1959 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->pdata->on_chip) r8a66597 1960 drivers/usb/gadget/udc/r8a66597-udc.c clk_disable_unprepare(r8a66597->clk); r8a66597 1962 drivers/usb/gadget/udc/r8a66597-udc.c if (r8a66597->ep0_req) r8a66597 1963 drivers/usb/gadget/udc/r8a66597-udc.c r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); r8a66597 40 drivers/usb/gadget/udc/r8a66597-udc.h #define r8a66597_is_sudmac(r8a66597) (r8a66597->pdata->sudmac) r8a66597 57 drivers/usb/gadget/udc/r8a66597-udc.h struct r8a66597 *r8a66597; r8a66597 118 drivers/usb/gadget/udc/r8a66597-udc.h container_of(_gadget, struct r8a66597, gadget) r8a66597 119 drivers/usb/gadget/udc/r8a66597-udc.h #define r8a66597_to_gadget(r8a66597) (&r8a66597->gadget) r8a66597 120 drivers/usb/gadget/udc/r8a66597-udc.h #define r8a66597_to_dev(r8a66597) (r8a66597->gadget.dev.parent) r8a66597 122 drivers/usb/gadget/udc/r8a66597-udc.h static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) r8a66597 124 drivers/usb/gadget/udc/r8a66597-udc.h return ioread16(r8a66597->reg + offset); r8a66597 127 drivers/usb/gadget/udc/r8a66597-udc.h static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, r8a66597 132 drivers/usb/gadget/udc/r8a66597-udc.h void __iomem *fifoaddr = r8a66597->reg + offset; r8a66597 136 drivers/usb/gadget/udc/r8a66597-udc.h if (r8a66597->pdata->on_chip) { r8a66597 173 drivers/usb/gadget/udc/r8a66597-udc.h static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, r8a66597 176 drivers/usb/gadget/udc/r8a66597-udc.h iowrite16(val, r8a66597->reg + offset); r8a66597 179 drivers/usb/gadget/udc/r8a66597-udc.h static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, r8a66597 183 drivers/usb/gadget/udc/r8a66597-udc.h tmp = r8a66597_read(r8a66597, offset); r8a66597 186 drivers/usb/gadget/udc/r8a66597-udc.h r8a66597_write(r8a66597, tmp, offset); r8a66597 189 drivers/usb/gadget/udc/r8a66597-udc.h #define r8a66597_bclr(r8a66597, val, offset) \ r8a66597 190 drivers/usb/gadget/udc/r8a66597-udc.h r8a66597_mdfy(r8a66597, 0, val, offset) r8a66597 191 drivers/usb/gadget/udc/r8a66597-udc.h #define r8a66597_bset(r8a66597, val, offset) \ r8a66597 192 drivers/usb/gadget/udc/r8a66597-udc.h r8a66597_mdfy(r8a66597, val, 0, offset) r8a66597 194 drivers/usb/gadget/udc/r8a66597-udc.h static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, r8a66597 199 drivers/usb/gadget/udc/r8a66597-udc.h void __iomem *fifoaddr = r8a66597->reg + ep->fifoaddr; r8a66597 203 drivers/usb/gadget/udc/r8a66597-udc.h if (r8a66597->pdata->on_chip) { r8a66597 220 drivers/usb/gadget/udc/r8a66597-udc.h if (!(r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)) { r8a66597 221 drivers/usb/gadget/udc/r8a66597-udc.h if (r8a66597->pdata->on_chip) r8a66597 227 drivers/usb/gadget/udc/r8a66597-udc.h if (r8a66597->pdata->wr0_shorted_to_wr1) r8a66597 228 drivers/usb/gadget/udc/r8a66597-udc.h r8a66597_bclr(r8a66597, MBW_16, ep->fifosel); r8a66597 231 drivers/usb/gadget/udc/r8a66597-udc.h if (r8a66597->pdata->wr0_shorted_to_wr1) r8a66597 232 drivers/usb/gadget/udc/r8a66597-udc.h r8a66597_bclr(r8a66597, MBW_16, ep->fifosel); r8a66597 257 drivers/usb/gadget/udc/r8a66597-udc.h static inline u32 r8a66597_sudmac_read(struct r8a66597 *r8a66597, r8a66597 260 drivers/usb/gadget/udc/r8a66597-udc.h return ioread32(r8a66597->sudmac_reg + offset); r8a66597 263 drivers/usb/gadget/udc/r8a66597-udc.h static inline void r8a66597_sudmac_write(struct r8a66597 *r8a66597, u32 val, r8a66597 266 drivers/usb/gadget/udc/r8a66597-udc.h iowrite32(val, r8a66597->sudmac_reg + offset); r8a66597 273 drivers/usb/gadget/udc/r8a66597-udc.h #define enable_irq_ready(r8a66597, pipenum) \ r8a66597 274 drivers/usb/gadget/udc/r8a66597-udc.h enable_pipe_irq(r8a66597, pipenum, BRDYENB) r8a66597 275 drivers/usb/gadget/udc/r8a66597-udc.h #define disable_irq_ready(r8a66597, pipenum) \ r8a66597 276 drivers/usb/gadget/udc/r8a66597-udc.h disable_pipe_irq(r8a66597, pipenum, BRDYENB) r8a66597 277 drivers/usb/gadget/udc/r8a66597-udc.h #define enable_irq_empty(r8a66597, pipenum) \ r8a66597 278 drivers/usb/gadget/udc/r8a66597-udc.h enable_pipe_irq(r8a66597, pipenum, BEMPENB) r8a66597 279 drivers/usb/gadget/udc/r8a66597-udc.h #define disable_irq_empty(r8a66597, pipenum) \ r8a66597 280 drivers/usb/gadget/udc/r8a66597-udc.h disable_pipe_irq(r8a66597, pipenum, BEMPENB) r8a66597 281 drivers/usb/gadget/udc/r8a66597-udc.h #define enable_irq_nrdy(r8a66597, pipenum) \ r8a66597 282 drivers/usb/gadget/udc/r8a66597-udc.h enable_pipe_irq(r8a66597, pipenum, NRDYENB) r8a66597 283 drivers/usb/gadget/udc/r8a66597-udc.h #define disable_irq_nrdy(r8a66597, pipenum) \ r8a66597 284 drivers/usb/gadget/udc/r8a66597-udc.h disable_pipe_irq(r8a66597, pipenum, NRDYENB) r8a66597 41 drivers/usb/host/r8a66597-hcd.c static void packet_write(struct r8a66597 *r8a66597, u16 pipenum); r8a66597 45 drivers/usb/host/r8a66597-hcd.c static void enable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 50 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, INTENB0); r8a66597 51 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, BEMPE | NRDYE | BRDYE, INTENB0); r8a66597 52 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, 1 << pipenum, reg); r8a66597 53 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, tmp, INTENB0); r8a66597 57 drivers/usb/host/r8a66597-hcd.c static void disable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, r8a66597 62 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, INTENB0); r8a66597 63 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, BEMPE | NRDYE | BRDYE, INTENB0); r8a66597 64 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, 1 << pipenum, reg); r8a66597 65 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, tmp, INTENB0); r8a66597 68 drivers/usb/host/r8a66597-hcd.c static void set_devadd_reg(struct r8a66597 *r8a66597, u8 r8a66597_address, r8a66597 75 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, val, devadd_reg); r8a66597 78 drivers/usb/host/r8a66597-hcd.c static int r8a66597_clock_enable(struct r8a66597 *r8a66597) r8a66597 83 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) { r8a66597 84 drivers/usb/host/r8a66597-hcd.c clk_prepare_enable(r8a66597->clk); r8a66597 86 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, SCKE, SYSCFG0); r8a66597 87 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, SYSCFG0); r8a66597 93 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0x04, 0x02); r8a66597 96 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, USBE, SYSCFG0); r8a66597 97 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, SYSCFG0); r8a66597 103 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, USBE, SYSCFG0); r8a66597 104 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, get_xtal_from_pdata(r8a66597->pdata), r8a66597 108 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, XCKE, SYSCFG0); r8a66597 111 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, SYSCFG0); r8a66597 122 drivers/usb/host/r8a66597-hcd.c static void r8a66597_clock_disable(struct r8a66597 *r8a66597) r8a66597 124 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, SCKE, SYSCFG0); r8a66597 127 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) { r8a66597 128 drivers/usb/host/r8a66597-hcd.c clk_disable_unprepare(r8a66597->clk); r8a66597 130 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, PLLC, SYSCFG0); r8a66597 131 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, XCKE, SYSCFG0); r8a66597 132 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, USBE, SYSCFG0); r8a66597 136 drivers/usb/host/r8a66597-hcd.c static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) r8a66597 141 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, val, get_syscfg_reg(port)); r8a66597 142 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); r8a66597 144 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, get_dmacfg_reg(port)); r8a66597 145 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, DTCHE, get_intenb_reg(port)); r8a66597 146 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); r8a66597 149 drivers/usb/host/r8a66597-hcd.c static void r8a66597_disable_port(struct r8a66597 *r8a66597, int port) r8a66597 153 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, get_intenb_reg(port)); r8a66597 154 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, get_intsts_reg(port)); r8a66597 156 drivers/usb/host/r8a66597-hcd.c r8a66597_port_power(r8a66597, port, 0); r8a66597 159 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, SOFCFG) & EDGESTS; r8a66597 164 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, val, get_syscfg_reg(port)); r8a66597 165 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port)); r8a66597 168 drivers/usb/host/r8a66597-hcd.c static int enable_controller(struct r8a66597 *r8a66597) r8a66597 171 drivers/usb/host/r8a66597-hcd.c u16 vif = r8a66597->pdata->vif ? LDRV : 0; r8a66597 172 drivers/usb/host/r8a66597-hcd.c u16 irq_sense = r8a66597->irq_sense_low ? INTL : 0; r8a66597 173 drivers/usb/host/r8a66597-hcd.c u16 endian = r8a66597->pdata->endian ? BIGEND : 0; r8a66597 175 drivers/usb/host/r8a66597-hcd.c ret = r8a66597_clock_enable(r8a66597); r8a66597 179 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, vif & LDRV, PINCFG); r8a66597 180 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, USBE, SYSCFG0); r8a66597 182 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, BEMPE | NRDYE | BRDYE, INTENB0); r8a66597 183 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, irq_sense & INTL, SOFCFG); r8a66597 184 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, BRDY0, BRDYENB); r8a66597 185 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, BEMP0, BEMPENB); r8a66597 187 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, endian & BIGEND, CFIFOSEL); r8a66597 188 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, endian & BIGEND, D0FIFOSEL); r8a66597 189 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, endian & BIGEND, D1FIFOSEL); r8a66597 190 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, TRNENSEL, SOFCFG); r8a66597 192 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, SIGNE | SACKE, INTENB1); r8a66597 194 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) r8a66597 195 drivers/usb/host/r8a66597-hcd.c r8a66597_enable_port(r8a66597, port); r8a66597 200 drivers/usb/host/r8a66597-hcd.c static void disable_controller(struct r8a66597 *r8a66597) r8a66597 205 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, INTENB0); r8a66597 206 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, INTENB1); r8a66597 207 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, BRDYENB); r8a66597 208 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, BEMPENB); r8a66597 209 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, NRDYENB); r8a66597 212 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, BRDYSTS); r8a66597 213 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, NRDYSTS); r8a66597 214 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, 0, BEMPSTS); r8a66597 216 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) r8a66597 217 drivers/usb/host/r8a66597-hcd.c r8a66597_disable_port(r8a66597, port); r8a66597 219 drivers/usb/host/r8a66597-hcd.c r8a66597_clock_disable(r8a66597); r8a66597 222 drivers/usb/host/r8a66597-hcd.c static int get_parent_r8a66597_address(struct r8a66597 *r8a66597, r8a66597 247 drivers/usb/host/r8a66597-hcd.c static void get_port_number(struct r8a66597 *r8a66597, r8a66597 252 drivers/usb/host/r8a66597-hcd.c if (*root_port >= r8a66597->max_root_hub) r8a66597 281 drivers/usb/host/r8a66597-hcd.c static void set_child_connect_map(struct r8a66597 *r8a66597, int address) r8a66597 286 drivers/usb/host/r8a66597-hcd.c r8a66597->child_connect_map[idx] |= 1 << (address % 32); r8a66597 289 drivers/usb/host/r8a66597-hcd.c static void put_child_connect_map(struct r8a66597 *r8a66597, int address) r8a66597 294 drivers/usb/host/r8a66597-hcd.c r8a66597->child_connect_map[idx] &= ~(1 << (address % 32)); r8a66597 326 drivers/usb/host/r8a66597-hcd.c get_urb_to_r8a66597_dev(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 329 drivers/usb/host/r8a66597-hcd.c return &r8a66597->device0; r8a66597 334 drivers/usb/host/r8a66597-hcd.c static int make_r8a66597_device(struct r8a66597 *r8a66597, r8a66597 352 drivers/usb/host/r8a66597-hcd.c list_add_tail(&dev->device_list, &r8a66597->child_device); r8a66597 354 drivers/usb/host/r8a66597-hcd.c get_port_number(r8a66597, urb->dev->devpath, r8a66597 357 drivers/usb/host/r8a66597-hcd.c r8a66597->root_hub[dev->root_port].dev = dev; r8a66597 359 drivers/usb/host/r8a66597-hcd.c set_devadd_reg(r8a66597, dev->address, r8a66597 361 drivers/usb/host/r8a66597-hcd.c get_parent_r8a66597_address(r8a66597, urb->dev), r8a66597 368 drivers/usb/host/r8a66597-hcd.c static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 378 drivers/usb/host/r8a66597-hcd.c dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 383 drivers/usb/host/r8a66597-hcd.c if (r8a66597->address_map & (1 << addr)) r8a66597 387 drivers/usb/host/r8a66597-hcd.c r8a66597->address_map |= 1 << addr; r8a66597 389 drivers/usb/host/r8a66597-hcd.c if (make_r8a66597_device(r8a66597, urb, addr) < 0) r8a66597 397 drivers/usb/host/r8a66597-hcd.c r8a66597->address_map); r8a66597 403 drivers/usb/host/r8a66597-hcd.c static void free_usb_address(struct r8a66597 *r8a66597, r8a66597 414 drivers/usb/host/r8a66597-hcd.c r8a66597->address_map &= ~(1 << dev->address); r8a66597 426 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) { r8a66597 427 drivers/usb/host/r8a66597-hcd.c if (r8a66597->root_hub[port].dev == dev) { r8a66597 428 drivers/usb/host/r8a66597-hcd.c r8a66597->root_hub[port].dev = NULL; r8a66597 434 drivers/usb/host/r8a66597-hcd.c static void r8a66597_reg_wait(struct r8a66597 *r8a66597, unsigned long reg, r8a66597 441 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, reg); r8a66597 452 drivers/usb/host/r8a66597-hcd.c static void pipe_start(struct r8a66597 *r8a66597, struct r8a66597_pipe *pipe) r8a66597 456 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, pipe->pipectr) & PID; r8a66597 458 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, PID_NAK, PID, pipe->pipectr); r8a66597 459 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, PID_BUF, PID, pipe->pipectr); r8a66597 463 drivers/usb/host/r8a66597-hcd.c static void pipe_stop(struct r8a66597 *r8a66597, struct r8a66597_pipe *pipe) r8a66597 467 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, pipe->pipectr) & PID; r8a66597 469 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, PID_STALL, PID, pipe->pipectr); r8a66597 470 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, PID_NAK, PID, pipe->pipectr); r8a66597 471 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, pipe->pipectr, PBUSY, 0); r8a66597 475 drivers/usb/host/r8a66597-hcd.c static void clear_all_buffer(struct r8a66597 *r8a66597, r8a66597 483 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, pipe); r8a66597 484 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, ACLRM, pipe->pipectr); r8a66597 485 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, pipe->pipectr); r8a66597 486 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, pipe->pipectr); r8a66597 487 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, pipe->pipectr); r8a66597 488 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, ACLRM, pipe->pipectr); r8a66597 492 drivers/usb/host/r8a66597-hcd.c static void r8a66597_pipe_toggle(struct r8a66597 *r8a66597, r8a66597 496 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, SQSET, pipe->pipectr); r8a66597 498 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, SQCLR, pipe->pipectr); r8a66597 501 drivers/usb/host/r8a66597-hcd.c static inline unsigned short mbw_value(struct r8a66597 *r8a66597) r8a66597 503 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) r8a66597 510 drivers/usb/host/r8a66597-hcd.c static inline void cfifo_change(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 512 drivers/usb/host/r8a66597-hcd.c unsigned short mbw = mbw_value(r8a66597); r8a66597 514 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, mbw | pipenum, mbw | CURPIPE, CFIFOSEL); r8a66597 515 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, pipenum); r8a66597 519 drivers/usb/host/r8a66597-hcd.c static inline void fifo_change_from_pipe(struct r8a66597 *r8a66597, r8a66597 522 drivers/usb/host/r8a66597-hcd.c unsigned short mbw = mbw_value(r8a66597); r8a66597 524 drivers/usb/host/r8a66597-hcd.c cfifo_change(r8a66597, 0); r8a66597 525 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, mbw | 0, mbw | CURPIPE, D0FIFOSEL); r8a66597 526 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, mbw | 0, mbw | CURPIPE, D1FIFOSEL); r8a66597 528 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, mbw | pipe->info.pipenum, mbw | CURPIPE, r8a66597 530 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, pipe->info.pipenum); r8a66597 543 drivers/usb/host/r8a66597-hcd.c static u16 get_urb_to_r8a66597_addr(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 545 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 560 drivers/usb/host/r8a66597-hcd.c static void pipe_toggle_set(struct r8a66597 *r8a66597, r8a66597 564 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 578 drivers/usb/host/r8a66597-hcd.c static void pipe_toggle_save(struct r8a66597 *r8a66597, r8a66597 582 drivers/usb/host/r8a66597-hcd.c if (r8a66597_read(r8a66597, pipe->pipectr) & SQMON) r8a66597 583 drivers/usb/host/r8a66597-hcd.c pipe_toggle_set(r8a66597, pipe, urb, 1); r8a66597 585 drivers/usb/host/r8a66597-hcd.c pipe_toggle_set(r8a66597, pipe, urb, 0); r8a66597 589 drivers/usb/host/r8a66597-hcd.c static void pipe_toggle_restore(struct r8a66597 *r8a66597, r8a66597 593 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 600 drivers/usb/host/r8a66597-hcd.c r8a66597_pipe_toggle(r8a66597, pipe, *toggle & (1 << endpoint)); r8a66597 604 drivers/usb/host/r8a66597-hcd.c static void pipe_buffer_setting(struct r8a66597 *r8a66597, r8a66597 612 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, ACLRM, get_pipectr_addr(info->pipenum)); r8a66597 613 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, ACLRM, get_pipectr_addr(info->pipenum)); r8a66597 614 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, info->pipenum, PIPESEL); r8a66597 620 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, val, PIPECFG); r8a66597 622 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, (info->buf_bsize << 10) | (info->bufnum), r8a66597 624 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, make_devsel(info->address) | info->maxpacket, r8a66597 626 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, info->interval, PIPEPERI); r8a66597 630 drivers/usb/host/r8a66597-hcd.c static void pipe_setting(struct r8a66597 *r8a66597, struct r8a66597_td *td) r8a66597 637 drivers/usb/host/r8a66597-hcd.c cfifo_change(r8a66597, 0); r8a66597 638 drivers/usb/host/r8a66597-hcd.c pipe_buffer_setting(r8a66597, info); r8a66597 643 drivers/usb/host/r8a66597-hcd.c r8a66597_pipe_toggle(r8a66597, td->pipe, 0); r8a66597 644 drivers/usb/host/r8a66597-hcd.c pipe_toggle_set(r8a66597, td->pipe, urb, 0); r8a66597 645 drivers/usb/host/r8a66597-hcd.c clear_all_buffer(r8a66597, td->pipe); r8a66597 649 drivers/usb/host/r8a66597-hcd.c pipe_toggle_restore(r8a66597, td->pipe, urb); r8a66597 654 drivers/usb/host/r8a66597-hcd.c static u16 get_empty_pipenum(struct r8a66597 *r8a66597, r8a66597 691 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pipe_cnt[min] > r8a66597->pipe_cnt[array[i]]) r8a66597 755 drivers/usb/host/r8a66597-hcd.c static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, r8a66597 762 drivers/usb/host/r8a66597-hcd.c unsigned short mbw = mbw_value(r8a66597); r8a66597 765 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) r8a66597 770 drivers/usb/host/r8a66597-hcd.c if ((r8a66597->dma_map & (1 << i)) != 0) r8a66597 780 drivers/usb/host/r8a66597-hcd.c r8a66597->dma_map |= 1 << i; r8a66597 784 drivers/usb/host/r8a66597-hcd.c cfifo_change(r8a66597, 0); r8a66597 785 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, mbw | pipe->info.pipenum, r8a66597 788 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, r8a66597 790 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, BCLR, pipe->fifoctr); r8a66597 797 drivers/usb/host/r8a66597-hcd.c static void enable_r8a66597_pipe(struct r8a66597 *r8a66597, struct urb *urb, r8a66597 801 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 808 drivers/usb/host/r8a66597-hcd.c r8a66597->pipe_cnt[pipe->info.pipenum]++; r8a66597 811 drivers/usb/host/r8a66597-hcd.c enable_r8a66597_pipe_dma(r8a66597, dev, pipe, urb); r8a66597 814 drivers/usb/host/r8a66597-hcd.c static void r8a66597_urb_done(struct r8a66597 *r8a66597, struct urb *urb, r8a66597 816 drivers/usb/host/r8a66597-hcd.c __releases(r8a66597->lock) r8a66597 817 drivers/usb/host/r8a66597-hcd.c __acquires(r8a66597->lock) r8a66597 828 drivers/usb/host/r8a66597-hcd.c usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597), urb); r8a66597 829 drivers/usb/host/r8a66597-hcd.c spin_unlock(&r8a66597->lock); r8a66597 830 drivers/usb/host/r8a66597-hcd.c usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb, status); r8a66597 831 drivers/usb/host/r8a66597-hcd.c spin_lock(&r8a66597->lock); r8a66597 835 drivers/usb/host/r8a66597-hcd.c static void force_dequeue(struct r8a66597 *r8a66597, u16 pipenum, u16 address) r8a66597 839 drivers/usb/host/r8a66597-hcd.c struct list_head *list = &r8a66597->pipe_queue[pipenum]; r8a66597 853 drivers/usb/host/r8a66597-hcd.c r8a66597_urb_done(r8a66597, urb, -ENODEV); r8a66597 860 drivers/usb/host/r8a66597-hcd.c static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597, r8a66597 875 drivers/usb/host/r8a66597-hcd.c force_dequeue(r8a66597, 0, dev->address); r8a66597 878 drivers/usb/host/r8a66597-hcd.c r8a66597->pipe_cnt[pipenum] -= dev->pipe_cnt[pipenum]; r8a66597 880 drivers/usb/host/r8a66597-hcd.c force_dequeue(r8a66597, pipenum, dev->address); r8a66597 885 drivers/usb/host/r8a66597-hcd.c r8a66597->dma_map &= ~(dev->dma_map); r8a66597 935 drivers/usb/host/r8a66597-hcd.c static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb, r8a66597 941 drivers/usb/host/r8a66597-hcd.c info.pipenum = get_empty_pipenum(r8a66597, ep); r8a66597 942 drivers/usb/host/r8a66597-hcd.c info.address = get_urb_to_r8a66597_addr(r8a66597, urb); r8a66597 960 drivers/usb/host/r8a66597-hcd.c enable_r8a66597_pipe(r8a66597, urb, hep, &info); r8a66597 963 drivers/usb/host/r8a66597-hcd.c static void init_pipe_config(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 967 drivers/usb/host/r8a66597-hcd.c dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 971 drivers/usb/host/r8a66597-hcd.c static void pipe_irq_enable(struct r8a66597 *r8a66597, struct urb *urb, r8a66597 975 drivers/usb/host/r8a66597-hcd.c enable_irq_empty(r8a66597, pipenum); r8a66597 977 drivers/usb/host/r8a66597-hcd.c enable_irq_ready(r8a66597, pipenum); r8a66597 980 drivers/usb/host/r8a66597-hcd.c enable_irq_nrdy(r8a66597, pipenum); r8a66597 983 drivers/usb/host/r8a66597-hcd.c static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 985 drivers/usb/host/r8a66597-hcd.c disable_irq_ready(r8a66597, pipenum); r8a66597 986 drivers/usb/host/r8a66597-hcd.c disable_irq_nrdy(r8a66597, pipenum); r8a66597 989 drivers/usb/host/r8a66597-hcd.c static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597) r8a66597 991 drivers/usb/host/r8a66597-hcd.c mod_timer(&r8a66597->rh_timer, r8a66597 995 drivers/usb/host/r8a66597-hcd.c static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port, r8a66597 998 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 1000 drivers/usb/host/r8a66597-hcd.c rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; r8a66597 1008 drivers/usb/host/r8a66597-hcd.c r8a66597_root_hub_start_polling(r8a66597); r8a66597 1012 drivers/usb/host/r8a66597-hcd.c static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port, r8a66597 1014 drivers/usb/host/r8a66597-hcd.c __releases(r8a66597->lock) r8a66597 1015 drivers/usb/host/r8a66597-hcd.c __acquires(r8a66597->lock) r8a66597 1018 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); r8a66597 1019 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); r8a66597 1022 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); r8a66597 1024 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port)); r8a66597 1026 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~DTCH, get_intsts_reg(port)); r8a66597 1027 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, DTCHE, get_intenb_reg(port)); r8a66597 1029 drivers/usb/host/r8a66597-hcd.c if (r8a66597->bus_suspended) r8a66597 1030 drivers/usb/host/r8a66597-hcd.c usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597)); r8a66597 1033 drivers/usb/host/r8a66597-hcd.c spin_unlock(&r8a66597->lock); r8a66597 1034 drivers/usb/host/r8a66597-hcd.c usb_hcd_poll_rh_status(r8a66597_to_hcd(r8a66597)); r8a66597 1035 drivers/usb/host/r8a66597-hcd.c spin_lock(&r8a66597->lock); r8a66597 1039 drivers/usb/host/r8a66597-hcd.c static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port) r8a66597 1041 drivers/usb/host/r8a66597-hcd.c u16 speed = get_rh_usb_speed(r8a66597, port); r8a66597 1042 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 1055 drivers/usb/host/r8a66597-hcd.c static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port) r8a66597 1057 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = r8a66597->root_hub[port].dev; r8a66597 1059 drivers/usb/host/r8a66597-hcd.c disable_r8a66597_pipe_all(r8a66597, dev); r8a66597 1060 drivers/usb/host/r8a66597-hcd.c free_usb_address(r8a66597, dev, 0); r8a66597 1062 drivers/usb/host/r8a66597-hcd.c start_root_hub_sampling(r8a66597, port, 0); r8a66597 1066 drivers/usb/host/r8a66597-hcd.c static void prepare_setup_packet(struct r8a66597 *r8a66597, r8a66597 1073 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket, r8a66597 1075 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1); r8a66597 1078 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, le16_to_cpu(p[i]), setup_addr); r8a66597 1081 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, SUREQ, DCPCTR); r8a66597 1085 drivers/usb/host/r8a66597-hcd.c static void prepare_packet_read(struct r8a66597 *r8a66597, r8a66597 1091 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, R8A66597_DIR, DCPCFG); r8a66597 1092 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, 0, ISEL | CURPIPE, CFIFOSEL); r8a66597 1093 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, 0); r8a66597 1095 drivers/usb/host/r8a66597-hcd.c r8a66597_pipe_toggle(r8a66597, td->pipe, 1); r8a66597 1096 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BCLR, CFIFOCTR); r8a66597 1098 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, td->pipenum); r8a66597 1099 drivers/usb/host/r8a66597-hcd.c pipe_start(r8a66597, td->pipe); r8a66597 1100 drivers/usb/host/r8a66597-hcd.c pipe_irq_enable(r8a66597, urb, td->pipenum); r8a66597 1103 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, td->pipenum); r8a66597 1104 drivers/usb/host/r8a66597-hcd.c pipe_setting(r8a66597, td); r8a66597 1105 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1106 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~(1 << td->pipenum), BRDYSTS); r8a66597 1109 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, TRCLR, r8a66597 1111 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, r8a66597 1116 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, TRENB, r8a66597 1120 drivers/usb/host/r8a66597-hcd.c pipe_start(r8a66597, td->pipe); r8a66597 1121 drivers/usb/host/r8a66597-hcd.c pipe_irq_enable(r8a66597, urb, td->pipenum); r8a66597 1127 drivers/usb/host/r8a66597-hcd.c static void prepare_packet_write(struct r8a66597 *r8a66597, r8a66597 1134 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1135 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, R8A66597_DIR, DCPCFG); r8a66597 1136 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, ISEL, ISEL | CURPIPE, CFIFOSEL); r8a66597 1137 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, 0); r8a66597 1139 drivers/usb/host/r8a66597-hcd.c r8a66597_pipe_toggle(r8a66597, td->pipe, 1); r8a66597 1140 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BCLR, CFIFOCTR); r8a66597 1144 drivers/usb/host/r8a66597-hcd.c pipe_setting(r8a66597, td); r8a66597 1146 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, TRENB, td->pipe->pipetre); r8a66597 1148 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~(1 << td->pipenum), BRDYSTS); r8a66597 1150 drivers/usb/host/r8a66597-hcd.c fifo_change_from_pipe(r8a66597, td->pipe); r8a66597 1151 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); r8a66597 1153 drivers/usb/host/r8a66597-hcd.c pipe_irq_enable(r8a66597, urb, td->pipenum); r8a66597 1155 drivers/usb/host/r8a66597-hcd.c packet_write(r8a66597, td->pipenum); r8a66597 1156 drivers/usb/host/r8a66597-hcd.c pipe_start(r8a66597, td->pipe); r8a66597 1160 drivers/usb/host/r8a66597-hcd.c static void prepare_status_packet(struct r8a66597 *r8a66597, r8a66597 1165 drivers/usb/host/r8a66597-hcd.c r8a66597_pipe_toggle(r8a66597, td->pipe, 1); r8a66597 1166 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1169 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, R8A66597_DIR, DCPCFG); r8a66597 1170 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, ISEL, ISEL | CURPIPE, CFIFOSEL); r8a66597 1171 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, 0); r8a66597 1172 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~BEMP0, BEMPSTS); r8a66597 1173 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BCLR | BVAL, CFIFOCTR); r8a66597 1174 drivers/usb/host/r8a66597-hcd.c enable_irq_empty(r8a66597, 0); r8a66597 1176 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, R8A66597_DIR, DCPCFG); r8a66597 1177 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, 0, ISEL | CURPIPE, CFIFOSEL); r8a66597 1178 drivers/usb/host/r8a66597-hcd.c r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, 0); r8a66597 1179 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BCLR, CFIFOCTR); r8a66597 1180 drivers/usb/host/r8a66597-hcd.c enable_irq_ready(r8a66597, 0); r8a66597 1182 drivers/usb/host/r8a66597-hcd.c enable_irq_nrdy(r8a66597, 0); r8a66597 1183 drivers/usb/host/r8a66597-hcd.c pipe_start(r8a66597, td->pipe); r8a66597 1196 drivers/usb/host/r8a66597-hcd.c static int start_transfer(struct r8a66597 *r8a66597, struct r8a66597_td *td) r8a66597 1204 drivers/usb/host/r8a66597-hcd.c td->urb->setup_packet[2] = alloc_usb_address(r8a66597, r8a66597 1209 drivers/usb/host/r8a66597-hcd.c prepare_setup_packet(r8a66597, td); r8a66597 1212 drivers/usb/host/r8a66597-hcd.c prepare_packet_read(r8a66597, td); r8a66597 1215 drivers/usb/host/r8a66597-hcd.c prepare_packet_write(r8a66597, td); r8a66597 1218 drivers/usb/host/r8a66597-hcd.c prepare_status_packet(r8a66597, td); r8a66597 1244 drivers/usb/host/r8a66597-hcd.c static void set_td_timer(struct r8a66597 *r8a66597, struct r8a66597_td *td) r8a66597 1250 drivers/usb/host/r8a66597-hcd.c if (!list_empty(&r8a66597->pipe_queue[td->pipenum]) && r8a66597 1252 drivers/usb/host/r8a66597-hcd.c r8a66597->timeout_map |= 1 << td->pipenum; r8a66597 1263 drivers/usb/host/r8a66597-hcd.c mod_timer(&r8a66597->timers[td->pipenum].td, r8a66597 1269 drivers/usb/host/r8a66597-hcd.c static void finish_request(struct r8a66597 *r8a66597, struct r8a66597_td *td, r8a66597 1271 drivers/usb/host/r8a66597-hcd.c __releases(r8a66597->lock) __acquires(r8a66597->lock) r8a66597 1274 drivers/usb/host/r8a66597-hcd.c struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); r8a66597 1276 drivers/usb/host/r8a66597-hcd.c r8a66597->timeout_map &= ~(1 << pipenum); r8a66597 1280 drivers/usb/host/r8a66597-hcd.c r8a66597->address_map &= ~(1 << urb->setup_packet[2]); r8a66597 1282 drivers/usb/host/r8a66597-hcd.c pipe_toggle_save(r8a66597, td->pipe, urb); r8a66597 1287 drivers/usb/host/r8a66597-hcd.c if (!list_empty(&r8a66597->pipe_queue[pipenum])) r8a66597 1294 drivers/usb/host/r8a66597-hcd.c r8a66597_urb_done(r8a66597, urb, status); r8a66597 1298 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1302 drivers/usb/host/r8a66597-hcd.c start_transfer(r8a66597, td); r8a66597 1303 drivers/usb/host/r8a66597-hcd.c set_td_timer(r8a66597, td); r8a66597 1307 drivers/usb/host/r8a66597-hcd.c static void packet_read(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 1312 drivers/usb/host/r8a66597-hcd.c struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1321 drivers/usb/host/r8a66597-hcd.c fifo_change_from_pipe(r8a66597, td->pipe); r8a66597 1322 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); r8a66597 1324 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1325 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1327 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, td->urb, -EPIPE); r8a66597 1366 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1367 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1374 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BCLR, td->pipe->fifoctr); r8a66597 1376 drivers/usb/host/r8a66597-hcd.c r8a66597_read_fifo(r8a66597, td->pipe->fifoaddr, r8a66597 1381 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, urb, status); r8a66597 1384 drivers/usb/host/r8a66597-hcd.c static void packet_write(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 1389 drivers/usb/host/r8a66597-hcd.c struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1396 drivers/usb/host/r8a66597-hcd.c fifo_change_from_pipe(r8a66597, td->pipe); r8a66597 1397 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); r8a66597 1399 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1400 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1402 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, urb, -EPIPE); r8a66597 1421 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~(1 << pipenum), BEMPSTS); r8a66597 1423 drivers/usb/host/r8a66597-hcd.c r8a66597_write_fifo(r8a66597, td->pipe, buf, size); r8a66597 1425 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, BVAL, td->pipe->fifoctr); r8a66597 1438 drivers/usb/host/r8a66597-hcd.c disable_irq_ready(r8a66597, pipenum); r8a66597 1439 drivers/usb/host/r8a66597-hcd.c enable_irq_empty(r8a66597, pipenum); r8a66597 1441 drivers/usb/host/r8a66597-hcd.c enable_irq_nrdy(r8a66597, pipenum); r8a66597 1443 drivers/usb/host/r8a66597-hcd.c pipe_irq_enable(r8a66597, urb, pipenum); r8a66597 1447 drivers/usb/host/r8a66597-hcd.c static void check_next_phase(struct r8a66597 *r8a66597, int status) r8a66597 1449 drivers/usb/host/r8a66597-hcd.c struct r8a66597_td *td = r8a66597_get_td(r8a66597, 0); r8a66597 1477 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, 0, urb, status); r8a66597 1479 drivers/usb/host/r8a66597-hcd.c start_transfer(r8a66597, td); r8a66597 1482 drivers/usb/host/r8a66597-hcd.c static int get_urb_error(struct r8a66597 *r8a66597, u16 pipenum) r8a66597 1484 drivers/usb/host/r8a66597-hcd.c struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1487 drivers/usb/host/r8a66597-hcd.c u16 pid = r8a66597_read(r8a66597, td->pipe->pipectr) & PID; r8a66597 1497 drivers/usb/host/r8a66597-hcd.c static void irq_pipe_ready(struct r8a66597 *r8a66597) r8a66597 1504 drivers/usb/host/r8a66597-hcd.c mask = r8a66597_read(r8a66597, BRDYSTS) r8a66597 1505 drivers/usb/host/r8a66597-hcd.c & r8a66597_read(r8a66597, BRDYENB); r8a66597 1506 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~mask, BRDYSTS); r8a66597 1508 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, 0); r8a66597 1510 drivers/usb/host/r8a66597-hcd.c packet_read(r8a66597, 0); r8a66597 1512 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, 0); r8a66597 1513 drivers/usb/host/r8a66597-hcd.c check_next_phase(r8a66597, 0); r8a66597 1519 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1524 drivers/usb/host/r8a66597-hcd.c packet_read(r8a66597, pipenum); r8a66597 1526 drivers/usb/host/r8a66597-hcd.c packet_write(r8a66597, pipenum); r8a66597 1531 drivers/usb/host/r8a66597-hcd.c static void irq_pipe_empty(struct r8a66597 *r8a66597) r8a66597 1539 drivers/usb/host/r8a66597-hcd.c mask = r8a66597_read(r8a66597, BEMPSTS) r8a66597 1540 drivers/usb/host/r8a66597-hcd.c & r8a66597_read(r8a66597, BEMPENB); r8a66597 1541 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~mask, BEMPSTS); r8a66597 1543 drivers/usb/host/r8a66597-hcd.c cfifo_change(r8a66597, 0); r8a66597 1544 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, 0); r8a66597 1546 drivers/usb/host/r8a66597-hcd.c disable_irq_empty(r8a66597, 0); r8a66597 1547 drivers/usb/host/r8a66597-hcd.c check_next_phase(r8a66597, 0); r8a66597 1554 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1558 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, td->pipe->pipectr); r8a66597 1560 drivers/usb/host/r8a66597-hcd.c disable_irq_empty(r8a66597, pipenum); r8a66597 1561 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1562 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, td->urb, r8a66597 1569 drivers/usb/host/r8a66597-hcd.c static void irq_pipe_nrdy(struct r8a66597 *r8a66597) r8a66597 1576 drivers/usb/host/r8a66597-hcd.c mask = r8a66597_read(r8a66597, NRDYSTS) r8a66597 1577 drivers/usb/host/r8a66597-hcd.c & r8a66597_read(r8a66597, NRDYENB); r8a66597 1578 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~mask, NRDYSTS); r8a66597 1580 drivers/usb/host/r8a66597-hcd.c cfifo_change(r8a66597, 0); r8a66597 1581 drivers/usb/host/r8a66597-hcd.c status = get_urb_error(r8a66597, 0); r8a66597 1582 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, 0); r8a66597 1583 drivers/usb/host/r8a66597-hcd.c check_next_phase(r8a66597, status); r8a66597 1590 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1594 drivers/usb/host/r8a66597-hcd.c status = get_urb_error(r8a66597, pipenum); r8a66597 1595 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 1596 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1597 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, td->urb, status); r8a66597 1604 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1610 drivers/usb/host/r8a66597-hcd.c spin_lock(&r8a66597->lock); r8a66597 1612 drivers/usb/host/r8a66597-hcd.c intsts0 = r8a66597_read(r8a66597, INTSTS0); r8a66597 1613 drivers/usb/host/r8a66597-hcd.c intsts1 = r8a66597_read(r8a66597, INTSTS1); r8a66597 1614 drivers/usb/host/r8a66597-hcd.c intsts2 = r8a66597_read(r8a66597, INTSTS2); r8a66597 1615 drivers/usb/host/r8a66597-hcd.c intenb0 = r8a66597_read(r8a66597, INTENB0); r8a66597 1616 drivers/usb/host/r8a66597-hcd.c intenb1 = r8a66597_read(r8a66597, INTENB1); r8a66597 1617 drivers/usb/host/r8a66597-hcd.c intenb2 = r8a66597_read(r8a66597, INTENB2); r8a66597 1624 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~ATTCH, INTSTS2); r8a66597 1625 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, ATTCHE, INTENB2); r8a66597 1628 drivers/usb/host/r8a66597-hcd.c start_root_hub_sampling(r8a66597, 1, 1); r8a66597 1631 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~DTCH, INTSTS2); r8a66597 1632 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, DTCHE, INTENB2); r8a66597 1633 drivers/usb/host/r8a66597-hcd.c r8a66597_usb_disconnect(r8a66597, 1); r8a66597 1636 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~BCHG, INTSTS2); r8a66597 1637 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, BCHGE, INTENB2); r8a66597 1638 drivers/usb/host/r8a66597-hcd.c usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597)); r8a66597 1644 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~ATTCH, INTSTS1); r8a66597 1645 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, ATTCHE, INTENB1); r8a66597 1648 drivers/usb/host/r8a66597-hcd.c start_root_hub_sampling(r8a66597, 0, 1); r8a66597 1651 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~DTCH, INTSTS1); r8a66597 1652 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, DTCHE, INTENB1); r8a66597 1653 drivers/usb/host/r8a66597-hcd.c r8a66597_usb_disconnect(r8a66597, 0); r8a66597 1656 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~BCHG, INTSTS1); r8a66597 1657 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, BCHGE, INTENB1); r8a66597 1658 drivers/usb/host/r8a66597-hcd.c usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597)); r8a66597 1662 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~SIGN, INTSTS1); r8a66597 1663 drivers/usb/host/r8a66597-hcd.c status = get_urb_error(r8a66597, 0); r8a66597 1664 drivers/usb/host/r8a66597-hcd.c check_next_phase(r8a66597, status); r8a66597 1667 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~SACK, INTSTS1); r8a66597 1668 drivers/usb/host/r8a66597-hcd.c check_next_phase(r8a66597, 0); r8a66597 1673 drivers/usb/host/r8a66597-hcd.c irq_pipe_ready(r8a66597); r8a66597 1675 drivers/usb/host/r8a66597-hcd.c irq_pipe_empty(r8a66597); r8a66597 1677 drivers/usb/host/r8a66597-hcd.c irq_pipe_nrdy(r8a66597); r8a66597 1680 drivers/usb/host/r8a66597-hcd.c spin_unlock(&r8a66597->lock); r8a66597 1685 drivers/usb/host/r8a66597-hcd.c static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) r8a66597 1688 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 1693 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, dvstctr_reg); r8a66597 1695 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, r8a66597 1697 drivers/usb/host/r8a66597-hcd.c r8a66597_root_hub_start_polling(r8a66597); r8a66597 1699 drivers/usb/host/r8a66597-hcd.c r8a66597_usb_connect(r8a66597, port); r8a66597 1703 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); r8a66597 1704 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); r8a66597 1708 drivers/usb/host/r8a66597-hcd.c tmp = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; r8a66597 1712 drivers/usb/host/r8a66597-hcd.c r8a66597_check_syssts(r8a66597, port, tmp); r8a66597 1714 drivers/usb/host/r8a66597-hcd.c r8a66597_root_hub_start_polling(r8a66597); r8a66597 1718 drivers/usb/host/r8a66597-hcd.c r8a66597_root_hub_start_polling(r8a66597); r8a66597 1726 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = timers->r8a66597; r8a66597 1731 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1734 drivers/usb/host/r8a66597-hcd.c if (!(r8a66597->interval_map & (1 << pipenum))) r8a66597 1736 drivers/usb/host/r8a66597-hcd.c if (timer_pending(&r8a66597->timers[pipenum].interval)) r8a66597 1739 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1741 drivers/usb/host/r8a66597-hcd.c start_transfer(r8a66597, td); r8a66597 1744 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1750 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = timers->r8a66597; r8a66597 1756 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1758 drivers/usb/host/r8a66597-hcd.c if (!(r8a66597->timeout_map & (1 << pipenum))) r8a66597 1760 drivers/usb/host/r8a66597-hcd.c if (timer_pending(&r8a66597->timers[pipenum].td)) r8a66597 1763 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1765 drivers/usb/host/r8a66597-hcd.c r8a66597->timeout_map &= ~(1 << pipenum); r8a66597 1770 drivers/usb/host/r8a66597-hcd.c set_td_timer(r8a66597, td); r8a66597 1775 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, pipe); r8a66597 1781 drivers/usb/host/r8a66597-hcd.c &r8a66597->pipe_queue[pipenum]); r8a66597 1782 drivers/usb/host/r8a66597-hcd.c new_td = r8a66597_get_td(r8a66597, pipenum); r8a66597 1790 drivers/usb/host/r8a66597-hcd.c start_transfer(r8a66597, new_td); r8a66597 1793 drivers/usb/host/r8a66597-hcd.c r8a66597->timeout_map &= ~(1 << pipenum); r8a66597 1795 drivers/usb/host/r8a66597-hcd.c set_td_timer(r8a66597, new_td); r8a66597 1798 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1803 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = from_timer(r8a66597, t, rh_timer); r8a66597 1807 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1809 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) r8a66597 1810 drivers/usb/host/r8a66597-hcd.c r8a66597_root_hub_control(r8a66597, port); r8a66597 1812 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1815 drivers/usb/host/r8a66597-hcd.c static int check_pipe_config(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 1817 drivers/usb/host/r8a66597-hcd.c struct r8a66597_device *dev = get_urb_to_r8a66597_dev(r8a66597, urb); r8a66597 1828 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1831 drivers/usb/host/r8a66597-hcd.c return enable_controller(r8a66597); r8a66597 1836 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1838 drivers/usb/host/r8a66597-hcd.c disable_controller(r8a66597); r8a66597 1841 drivers/usb/host/r8a66597-hcd.c static void set_address_zero(struct r8a66597 *r8a66597, struct urb *urb) r8a66597 1847 drivers/usb/host/r8a66597-hcd.c get_port_number(r8a66597, urb->dev->devpath, r8a66597 1849 drivers/usb/host/r8a66597-hcd.c set_devadd_reg(r8a66597, 0, r8a66597 1851 drivers/usb/host/r8a66597-hcd.c get_parent_r8a66597_address(r8a66597, urb->dev), r8a66597 1856 drivers/usb/host/r8a66597-hcd.c static struct r8a66597_td *r8a66597_make_td(struct r8a66597 *r8a66597, r8a66597 1871 drivers/usb/host/r8a66597-hcd.c td->address = get_urb_to_r8a66597_addr(r8a66597, urb); r8a66597 1890 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1895 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1896 drivers/usb/host/r8a66597-hcd.c if (!get_urb_to_r8a66597_dev(r8a66597, urb)) { r8a66597 1914 drivers/usb/host/r8a66597-hcd.c init_pipe_info(r8a66597, urb, hep, &hep->desc); r8a66597 1917 drivers/usb/host/r8a66597-hcd.c if (unlikely(check_pipe_config(r8a66597, urb))) r8a66597 1918 drivers/usb/host/r8a66597-hcd.c init_pipe_config(r8a66597, urb); r8a66597 1920 drivers/usb/host/r8a66597-hcd.c set_address_zero(r8a66597, urb); r8a66597 1921 drivers/usb/host/r8a66597-hcd.c td = r8a66597_make_td(r8a66597, urb, hep); r8a66597 1926 drivers/usb/host/r8a66597-hcd.c if (list_empty(&r8a66597->pipe_queue[td->pipenum])) r8a66597 1928 drivers/usb/host/r8a66597-hcd.c list_add_tail(&td->queue, &r8a66597->pipe_queue[td->pipenum]); r8a66597 1933 drivers/usb/host/r8a66597-hcd.c r8a66597->interval_map |= 1 << td->pipenum; r8a66597 1934 drivers/usb/host/r8a66597-hcd.c mod_timer(&r8a66597->timers[td->pipenum].interval, r8a66597 1938 drivers/usb/host/r8a66597-hcd.c ret = start_transfer(r8a66597, td); r8a66597 1945 drivers/usb/host/r8a66597-hcd.c set_td_timer(r8a66597, td); r8a66597 1951 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1958 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1963 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 1970 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, td->pipe); r8a66597 1971 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, td->pipenum); r8a66597 1972 drivers/usb/host/r8a66597-hcd.c disable_irq_empty(r8a66597, td->pipenum); r8a66597 1973 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, td->pipenum, urb, status); r8a66597 1976 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 1982 drivers/usb/host/r8a66597-hcd.c __acquires(r8a66597->lock) r8a66597 1983 drivers/usb/host/r8a66597-hcd.c __releases(r8a66597->lock) r8a66597 1985 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 1996 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 2000 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 2004 drivers/usb/host/r8a66597-hcd.c pipe_stop(r8a66597, pipe); r8a66597 2005 drivers/usb/host/r8a66597-hcd.c pipe_irq_disable(r8a66597, pipenum); r8a66597 2006 drivers/usb/host/r8a66597-hcd.c disable_irq_empty(r8a66597, pipenum); r8a66597 2007 drivers/usb/host/r8a66597-hcd.c td = r8a66597_get_td(r8a66597, pipenum); r8a66597 2010 drivers/usb/host/r8a66597-hcd.c finish_request(r8a66597, td, pipenum, urb, -ESHUTDOWN); r8a66597 2013 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 2018 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2019 drivers/usb/host/r8a66597-hcd.c return r8a66597_read(r8a66597, FRMNUM) & 0x03FF; r8a66597 2037 drivers/usb/host/r8a66597-hcd.c static struct r8a66597_device *get_r8a66597_device(struct r8a66597 *r8a66597, r8a66597 2041 drivers/usb/host/r8a66597-hcd.c struct list_head *list = &r8a66597->child_device; r8a66597 2054 drivers/usb/host/r8a66597-hcd.c static void update_usb_address_map(struct r8a66597 *r8a66597, r8a66597 2063 drivers/usb/host/r8a66597-hcd.c diff = r8a66597->child_connect_map[i] ^ map[i]; r8a66597 2073 drivers/usb/host/r8a66597-hcd.c set_child_connect_map(r8a66597, addr); r8a66597 2077 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 2078 drivers/usb/host/r8a66597-hcd.c dev = get_r8a66597_device(r8a66597, addr); r8a66597 2079 drivers/usb/host/r8a66597-hcd.c disable_r8a66597_pipe_all(r8a66597, dev); r8a66597 2080 drivers/usb/host/r8a66597-hcd.c free_usb_address(r8a66597, dev, 0); r8a66597 2081 drivers/usb/host/r8a66597-hcd.c put_child_connect_map(r8a66597, addr); r8a66597 2082 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 2088 drivers/usb/host/r8a66597-hcd.c static void r8a66597_check_detect_child(struct r8a66597 *r8a66597, r8a66597 2100 drivers/usb/host/r8a66597-hcd.c update_usb_address_map(r8a66597, bus->root_hub, now_map); r8a66597 2107 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2111 drivers/usb/host/r8a66597-hcd.c r8a66597_check_detect_child(r8a66597, hcd); r8a66597 2113 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 2117 drivers/usb/host/r8a66597-hcd.c for (i = 0; i < r8a66597->max_root_hub; i++) { r8a66597 2118 drivers/usb/host/r8a66597-hcd.c if (r8a66597->root_hub[i].port & 0xffff0000) r8a66597 2122 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 2127 drivers/usb/host/r8a66597-hcd.c static void r8a66597_hub_descriptor(struct r8a66597 *r8a66597, r8a66597 2132 drivers/usb/host/r8a66597-hcd.c desc->bNbrPorts = r8a66597->max_root_hub; r8a66597 2138 drivers/usb/host/r8a66597-hcd.c ((1 << r8a66597->max_root_hub) - 1) << 1; r8a66597 2145 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2148 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 2153 drivers/usb/host/r8a66597-hcd.c spin_lock_irqsave(&r8a66597->lock, flags); r8a66597 2166 drivers/usb/host/r8a66597-hcd.c if (wIndex > r8a66597->max_root_hub) r8a66597 2178 drivers/usb/host/r8a66597-hcd.c r8a66597_port_power(r8a66597, port, 0); r8a66597 2192 drivers/usb/host/r8a66597-hcd.c r8a66597_hub_descriptor(r8a66597, r8a66597 2199 drivers/usb/host/r8a66597-hcd.c if (wIndex > r8a66597->max_root_hub) r8a66597 2204 drivers/usb/host/r8a66597-hcd.c if (wIndex > r8a66597->max_root_hub) r8a66597 2213 drivers/usb/host/r8a66597-hcd.c r8a66597_port_power(r8a66597, port, 1); r8a66597 2221 drivers/usb/host/r8a66597-hcd.c disable_r8a66597_pipe_all(r8a66597, dev); r8a66597 2222 drivers/usb/host/r8a66597-hcd.c free_usb_address(r8a66597, dev, 1); r8a66597 2224 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, r8a66597 2226 drivers/usb/host/r8a66597-hcd.c mod_timer(&r8a66597->rh_timer, r8a66597 2241 drivers/usb/host/r8a66597-hcd.c spin_unlock_irqrestore(&r8a66597->lock, flags); r8a66597 2248 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2251 drivers/usb/host/r8a66597-hcd.c dev_dbg(&r8a66597->device0.udev->dev, "%s\n", __func__); r8a66597 2253 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) { r8a66597 2254 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 2261 drivers/usb/host/r8a66597-hcd.c r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */ r8a66597 2266 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, RWUPE, dvstctr_reg); r8a66597 2267 drivers/usb/host/r8a66597-hcd.c r8a66597_write(r8a66597, ~BCHG, get_intsts_reg(port)); r8a66597 2268 drivers/usb/host/r8a66597-hcd.c r8a66597_bset(r8a66597, BCHGE, get_intenb_reg(port)); r8a66597 2272 drivers/usb/host/r8a66597-hcd.c r8a66597->bus_suspended = 1; r8a66597 2279 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2282 drivers/usb/host/r8a66597-hcd.c dev_dbg(&r8a66597->device0.udev->dev, "%s\n", __func__); r8a66597 2284 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) { r8a66597 2285 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 2294 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); r8a66597 2296 drivers/usb/host/r8a66597-hcd.c r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); r8a66597 2309 drivers/usb/host/r8a66597-hcd.c .hcd_priv_size = sizeof(struct r8a66597), r8a66597 2344 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = dev_get_drvdata(dev); r8a66597 2349 drivers/usb/host/r8a66597-hcd.c disable_controller(r8a66597); r8a66597 2351 drivers/usb/host/r8a66597-hcd.c for (port = 0; port < r8a66597->max_root_hub; port++) { r8a66597 2352 drivers/usb/host/r8a66597-hcd.c struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; r8a66597 2362 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = dev_get_drvdata(dev); r8a66597 2363 drivers/usb/host/r8a66597-hcd.c struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); r8a66597 2367 drivers/usb/host/r8a66597-hcd.c enable_controller(r8a66597); r8a66597 2387 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597 = platform_get_drvdata(pdev); r8a66597 2388 drivers/usb/host/r8a66597-hcd.c struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); r8a66597 2390 drivers/usb/host/r8a66597-hcd.c del_timer_sync(&r8a66597->rh_timer); r8a66597 2392 drivers/usb/host/r8a66597-hcd.c iounmap(r8a66597->reg); r8a66597 2393 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) r8a66597 2394 drivers/usb/host/r8a66597-hcd.c clk_put(r8a66597->clk); r8a66597 2406 drivers/usb/host/r8a66597-hcd.c struct r8a66597 *r8a66597; r8a66597 2452 drivers/usb/host/r8a66597-hcd.c r8a66597 = hcd_to_r8a66597(hcd); r8a66597 2453 drivers/usb/host/r8a66597-hcd.c memset(r8a66597, 0, sizeof(struct r8a66597)); r8a66597 2454 drivers/usb/host/r8a66597-hcd.c platform_set_drvdata(pdev, r8a66597); r8a66597 2455 drivers/usb/host/r8a66597-hcd.c r8a66597->pdata = dev_get_platdata(&pdev->dev); r8a66597 2456 drivers/usb/host/r8a66597-hcd.c r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; r8a66597 2458 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) { r8a66597 2460 drivers/usb/host/r8a66597-hcd.c r8a66597->clk = clk_get(&pdev->dev, clk_name); r8a66597 2461 drivers/usb/host/r8a66597-hcd.c if (IS_ERR(r8a66597->clk)) { r8a66597 2464 drivers/usb/host/r8a66597-hcd.c ret = PTR_ERR(r8a66597->clk); r8a66597 2467 drivers/usb/host/r8a66597-hcd.c r8a66597->max_root_hub = 1; r8a66597 2469 drivers/usb/host/r8a66597-hcd.c r8a66597->max_root_hub = 2; r8a66597 2471 drivers/usb/host/r8a66597-hcd.c spin_lock_init(&r8a66597->lock); r8a66597 2472 drivers/usb/host/r8a66597-hcd.c timer_setup(&r8a66597->rh_timer, r8a66597_timer, 0); r8a66597 2473 drivers/usb/host/r8a66597-hcd.c r8a66597->reg = reg; r8a66597 2476 drivers/usb/host/r8a66597-hcd.c ret = r8a66597_clock_enable(r8a66597); r8a66597 2479 drivers/usb/host/r8a66597-hcd.c disable_controller(r8a66597); r8a66597 2482 drivers/usb/host/r8a66597-hcd.c INIT_LIST_HEAD(&r8a66597->pipe_queue[i]); r8a66597 2483 drivers/usb/host/r8a66597-hcd.c r8a66597->timers[i].r8a66597 = r8a66597; r8a66597 2484 drivers/usb/host/r8a66597-hcd.c timer_setup(&r8a66597->timers[i].td, r8a66597_td_timer, 0); r8a66597 2485 drivers/usb/host/r8a66597-hcd.c timer_setup(&r8a66597->timers[i].interval, r8a66597 2488 drivers/usb/host/r8a66597-hcd.c INIT_LIST_HEAD(&r8a66597->child_device); r8a66597 2503 drivers/usb/host/r8a66597-hcd.c if (r8a66597->pdata->on_chip) r8a66597 2504 drivers/usb/host/r8a66597-hcd.c clk_put(r8a66597->clk); r8a66597 97 drivers/usb/host/r8a66597.h struct r8a66597; r8a66597 102 drivers/usb/host/r8a66597.h struct r8a66597 *r8a66597; r8a66597 131 drivers/usb/host/r8a66597.h static inline struct r8a66597 *hcd_to_r8a66597(struct usb_hcd *hcd) r8a66597 133 drivers/usb/host/r8a66597.h return (struct r8a66597 *)(hcd->hcd_priv); r8a66597 136 drivers/usb/host/r8a66597.h static inline struct usb_hcd *r8a66597_to_hcd(struct r8a66597 *r8a66597) r8a66597 138 drivers/usb/host/r8a66597.h return container_of((void *)r8a66597, struct usb_hcd, hcd_priv); r8a66597 141 drivers/usb/host/r8a66597.h static inline struct r8a66597_td *r8a66597_get_td(struct r8a66597 *r8a66597, r8a66597 144 drivers/usb/host/r8a66597.h if (unlikely(list_empty(&r8a66597->pipe_queue[pipenum]))) r8a66597 147 drivers/usb/host/r8a66597.h return list_entry(r8a66597->pipe_queue[pipenum].next, r8a66597 151 drivers/usb/host/r8a66597.h static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597, r8a66597 156 drivers/usb/host/r8a66597.h td = r8a66597_get_td(r8a66597, pipenum); r8a66597 160 drivers/usb/host/r8a66597.h static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) r8a66597 162 drivers/usb/host/r8a66597.h return ioread16(r8a66597->reg + offset); r8a66597 165 drivers/usb/host/r8a66597.h static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, r8a66597 169 drivers/usb/host/r8a66597.h void __iomem *fifoaddr = r8a66597->reg + offset; r8a66597 172 drivers/usb/host/r8a66597.h if (r8a66597->pdata->on_chip) { r8a66597 187 drivers/usb/host/r8a66597.h static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, r8a66597 190 drivers/usb/host/r8a66597.h iowrite16(val, r8a66597->reg + offset); r8a66597 193 drivers/usb/host/r8a66597.h static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, r8a66597 197 drivers/usb/host/r8a66597.h tmp = r8a66597_read(r8a66597, offset); r8a66597 200 drivers/usb/host/r8a66597.h r8a66597_write(r8a66597, tmp, offset); r8a66597 203 drivers/usb/host/r8a66597.h #define r8a66597_bclr(r8a66597, val, offset) \ r8a66597 204 drivers/usb/host/r8a66597.h r8a66597_mdfy(r8a66597, 0, val, offset) r8a66597 205 drivers/usb/host/r8a66597.h #define r8a66597_bset(r8a66597, val, offset) \ r8a66597 206 drivers/usb/host/r8a66597.h r8a66597_mdfy(r8a66597, val, 0, offset) r8a66597 208 drivers/usb/host/r8a66597.h static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, r8a66597 212 drivers/usb/host/r8a66597.h void __iomem *fifoaddr = r8a66597->reg + pipe->fifoaddr; r8a66597 217 drivers/usb/host/r8a66597.h if (r8a66597->pdata->on_chip) { r8a66597 224 drivers/usb/host/r8a66597.h if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) r8a66597 237 drivers/usb/host/r8a66597.h if (r8a66597->pdata->wr0_shorted_to_wr1) r8a66597 238 drivers/usb/host/r8a66597.h r8a66597_bclr(r8a66597, MBW_16, pipe->fifosel); r8a66597 240 drivers/usb/host/r8a66597.h if (r8a66597->pdata->wr0_shorted_to_wr1) r8a66597 241 drivers/usb/host/r8a66597.h r8a66597_bset(r8a66597, MBW_16, pipe->fifosel); r8a66597 276 drivers/usb/host/r8a66597.h static inline u16 get_rh_usb_speed(struct r8a66597 *r8a66597, int port) r8a66597 280 drivers/usb/host/r8a66597.h return r8a66597_read(r8a66597, dvstctr_reg) & RHST; r8a66597 283 drivers/usb/host/r8a66597.h static inline void r8a66597_port_power(struct r8a66597 *r8a66597, int port, r8a66597 288 drivers/usb/host/r8a66597.h if (r8a66597->pdata->port_power) { r8a66597 289 drivers/usb/host/r8a66597.h r8a66597->pdata->port_power(port, power); r8a66597 292 drivers/usb/host/r8a66597.h r8a66597_bset(r8a66597, VBOUT, dvstctr_reg); r8a66597 294 drivers/usb/host/r8a66597.h r8a66597_bclr(r8a66597, VBOUT, dvstctr_reg); r8a66597 325 drivers/usb/host/r8a66597.h #define enable_irq_ready(r8a66597, pipenum) \ r8a66597 326 drivers/usb/host/r8a66597.h enable_pipe_irq(r8a66597, pipenum, BRDYENB) r8a66597 327 drivers/usb/host/r8a66597.h #define disable_irq_ready(r8a66597, pipenum) \ r8a66597 328 drivers/usb/host/r8a66597.h disable_pipe_irq(r8a66597, pipenum, BRDYENB) r8a66597 329 drivers/usb/host/r8a66597.h #define enable_irq_empty(r8a66597, pipenum) \ r8a66597 330 drivers/usb/host/r8a66597.h enable_pipe_irq(r8a66597, pipenum, BEMPENB) r8a66597 331 drivers/usb/host/r8a66597.h #define disable_irq_empty(r8a66597, pipenum) \ r8a66597 332 drivers/usb/host/r8a66597.h disable_pipe_irq(r8a66597, pipenum, BEMPENB) r8a66597 333 drivers/usb/host/r8a66597.h #define enable_irq_nrdy(r8a66597, pipenum) \ r8a66597 334 drivers/usb/host/r8a66597.h enable_pipe_irq(r8a66597, pipenum, NRDYENB) r8a66597 335 drivers/usb/host/r8a66597.h #define disable_irq_nrdy(r8a66597, pipenum) \ r8a66597 336 drivers/usb/host/r8a66597.h disable_pipe_irq(r8a66597, pipenum, NRDYENB)