Commit e5ff15bec96ba18698dae5de0bbf7e6a0653ca65

Authored by Magnus Damm
Committed by Paul Mundt
1 parent e8708ef7e8

usb: r8a66597-hdc disable interrupts fix

This patch improves disable_controller() in the r8a66597-hdc
driver to disable all interrupts and clear status flags. It
also makes sure that disable_controller() is called during
probe(). This fixes the relatively rare case of unexpected
pending interrupts after kexec reboot.

Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 1 changed file with 16 additions and 1 deletions Side-by-side Diff

drivers/usb/host/r8a66597-hcd.c
... ... @@ -216,9 +216,18 @@
216 216 {
217 217 int port;
218 218  
  219 + /* disable interrupts */
219 220 r8a66597_write(r8a66597, 0, INTENB0);
220   - r8a66597_write(r8a66597, 0, INTSTS0);
  221 + r8a66597_write(r8a66597, 0, INTENB1);
  222 + r8a66597_write(r8a66597, 0, BRDYENB);
  223 + r8a66597_write(r8a66597, 0, BEMPENB);
  224 + r8a66597_write(r8a66597, 0, NRDYENB);
221 225  
  226 + /* clear status */
  227 + r8a66597_write(r8a66597, 0, BRDYSTS);
  228 + r8a66597_write(r8a66597, 0, NRDYSTS);
  229 + r8a66597_write(r8a66597, 0, BEMPSTS);
  230 +
222 231 for (port = 0; port < r8a66597->max_root_hub; port++)
223 232 r8a66597_disable_port(r8a66597, port);
224 233  
... ... @@ -2465,6 +2474,12 @@
2465 2474 r8a66597->rh_timer.function = r8a66597_timer;
2466 2475 r8a66597->rh_timer.data = (unsigned long)r8a66597;
2467 2476 r8a66597->reg = (unsigned long)reg;
  2477 +
  2478 + /* make sure no interrupts are pending */
  2479 + ret = r8a66597_clock_enable(r8a66597);
  2480 + if (ret < 0)
  2481 + goto clean_up3;
  2482 + disable_controller(r8a66597);
2468 2483  
2469 2484 for (i = 0; i < R8A66597_MAX_NUM_PIPE; i++) {
2470 2485 INIT_LIST_HEAD(&r8a66597->pipe_queue[i]);