--- zzzz-none-000/linux-3.10.107/drivers/usb/renesas_usbhs/mod.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/renesas_usbhs/mod.c 2021-02-04 17:41:59.000000000 +0000 @@ -213,12 +213,19 @@ { struct usbhs_mod *mod = usbhs_mod_get_current(priv); u16 intenb0, intenb1; + unsigned long flags; + /******************** spin lock ********************/ + usbhs_lock(priv, flags); state->intsts0 = usbhs_read(priv, INTSTS0); - state->intsts1 = usbhs_read(priv, INTSTS1); - intenb0 = usbhs_read(priv, INTENB0); - intenb1 = usbhs_read(priv, INTENB1); + + if (usbhs_mod_is_host(priv)) { + state->intsts1 = usbhs_read(priv, INTSTS1); + intenb1 = usbhs_read(priv, INTENB1); + } else { + state->intsts1 = intenb1 = 0; + } /* mask */ if (mod) { @@ -229,6 +236,8 @@ state->bempsts &= mod->irq_bempsts; state->brdysts &= mod->irq_brdysts; } + usbhs_unlock(priv, flags); + /******************** spin unlock ******************/ /* * Check whether the irq enable registers and the irq status are set @@ -270,7 +279,8 @@ * - Function :: VALID bit should 0 */ usbhs_write(priv, INTSTS0, ~irq_state.intsts0 & INTSTS0_MAGIC); - usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); + if (usbhs_mod_is_host(priv)) + usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); /* * The driver should not clear the xxxSTS after the line of @@ -305,19 +315,20 @@ if (irq_state.intsts0 & BRDY) usbhs_mod_call(priv, irq_ready, priv, &irq_state); - /* INTSTS1 */ - if (irq_state.intsts1 & ATTCH) - usbhs_mod_call(priv, irq_attch, priv, &irq_state); - - if (irq_state.intsts1 & DTCH) - usbhs_mod_call(priv, irq_dtch, priv, &irq_state); + if (usbhs_mod_is_host(priv)) { + /* INTSTS1 */ + if (irq_state.intsts1 & ATTCH) + usbhs_mod_call(priv, irq_attch, priv, &irq_state); - if (irq_state.intsts1 & SIGN) - usbhs_mod_call(priv, irq_sign, priv, &irq_state); + if (irq_state.intsts1 & DTCH) + usbhs_mod_call(priv, irq_dtch, priv, &irq_state); - if (irq_state.intsts1 & SACK) - usbhs_mod_call(priv, irq_sack, priv, &irq_state); + if (irq_state.intsts1 & SIGN) + usbhs_mod_call(priv, irq_sign, priv, &irq_state); + if (irq_state.intsts1 & SACK) + usbhs_mod_call(priv, irq_sack, priv, &irq_state); + } return IRQ_HANDLED; } @@ -336,7 +347,8 @@ * - update INTSTS0 */ usbhs_write(priv, INTENB0, 0); - usbhs_write(priv, INTENB1, 0); + if (usbhs_mod_is_host(priv)) + usbhs_write(priv, INTENB1, 0); usbhs_write(priv, BEMPENB, 0); usbhs_write(priv, BRDYENB, 0); @@ -370,25 +382,27 @@ intenb0 |= BRDYE; } - /* - * INTSTS1 - */ - if (mod->irq_attch) - intenb1 |= ATTCHE; + if (usbhs_mod_is_host(priv)) { + /* + * INTSTS1 + */ + if (mod->irq_attch) + intenb1 |= ATTCHE; - if (mod->irq_dtch) - intenb1 |= DTCHE; + if (mod->irq_dtch) + intenb1 |= DTCHE; - if (mod->irq_sign) - intenb1 |= SIGNE; + if (mod->irq_sign) + intenb1 |= SIGNE; - if (mod->irq_sack) - intenb1 |= SACKE; + if (mod->irq_sack) + intenb1 |= SACKE; + } } if (intenb0) usbhs_write(priv, INTENB0, intenb0); - if (intenb1) + if (usbhs_mod_is_host(priv) && intenb1) usbhs_write(priv, INTENB1, intenb1); }