• Stephen Boyd's avatar
    serial: msm_serial: Fix kgdb continue · 3fd48a66
    Stephen Boyd authored
    commit 8b374399 upstream.
    
    Frank reports that after continuing in kgdb the RX stale event
    doesn't occur until after the RX fifo is filled up with exactly
    the amount of characters programmed for the RX watermark (in this
    case it's 48). To read a single character from the uartdm
    hardware we force a stale event so that any characters in the RX
    packing buffer are flushed into the RX fifo immediately instead
    of waiting for a stale timeout or for the fifo to fill. Forcing
    that stale event asserts the stale interrupt but we never clear
    that interrupt via UART_CR_CMD_RESET_STALE_INT in the polling
    functions. So when kgdb continues the stale interrupt is left
    pending in the hardware and we don't timeout with a stale event,
    like we usually would if a user typed one character on the
    console, until the reset stale interrupt and stale event commands
    are sent. Frank could get things working again by running
    handle_rx_dm(). By putting enough characters into the fifo he
    could trigger a watermark interrupt, and thus cause
    handle_rx_dm() to run finally resetting the stale interrupt
    and enabling the stale event so that single characters would
    cause timeouts again.
    
    The fix is to just do what the interrupt routine was doing all
    along and clear the stale interrupt and enable the event again.
    Doing this also smooths over any differences in the fifo behavior
    between v1.3 and v1.4 hardware allowing us to skip forcing the
    uart into single character mode.
    Reviewed-by: default avatarFrank Rowand <frank.rowand@sonymobile.com>
    Tested-by: default avatarFrank Rowand <frank.rowand@sonymobile.com>
    Fixes: f7e54d7a "msm_serial: Add support for poll_{get,put}_char()"
    Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    3fd48a66
msm_serial.c 25.4 KB