Looking at the get_poll_char() function of the 8250.c serial driver,
we learn:
* poll_get_char() doesn't have to save/disable/restore the interrupt
registers. No interrupt handling is needed in this function at all.
Remove it.
* Don't block in case there is no data available. So instead blocking
in the do {} while loop, just return with NO_POLL_CHAR, immediately .
Additionally, while the i.MX6 register URXD[7-0] contain the RX_DATA,
the upper bits of this register (URXD[15-10]) might contain some
control flags. To ensure that these are not returned with the data
read, just mask out URXD[7-0].
These changes fix the 'hang' working with kdb:
$ echo ttymxc3 > /sys/module/kgdboc/parameters/kgdboc
$ echo g >/proc/sysrq-trigger
[0]kdb> help
...
<hang>