sunxi-serial: Don't report an irq as handled when it is not handled

The sunxi uarts have a state where they report an interrupt-type unknown
to the generic 8250 code (more about that in a later patch in this series),
on my 1 GB RAM mini-x u-boot seems to always hit the exact right timing to
trigger this interrupt getting asserted, and since the Linux kernel code
does not know how to clear it, we end up with a stuck interrupt.

For some reasons the sunxi kernel tree has a hack simply reporting any serial
interrupt as handled, even though it was not handled. This causes the kernel
to hang in a loop servicing the unhandled interrupt for ever.

This patch reverts this hack, bringing this part of the sunxi kernel tree
in sync with mainline. This causes the kernel to correctly detect the stuck
interrupts and continue working (except for the serial port), when the uart
raises this special interrupt.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-serial: Fix bad pointer access in sw_serial_pm

The sunxi-serial code assumes that the struct uart_port *port parameter
passed to the pm callback it the address of the struct it used to register.

But this is completely wrong! The argument passed to serial8250_register_port
is only a template, it is copied not used directly. Instead store the
correct address in port->private_data and use that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-serial: No need to keep the port struct in memory

Since it is only a template we don't need to keep it around.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-serial: Get rid of sw_serial global array

There is no need for global state here, instead store the line-number we
got from registering together with our other info in the sw_serial_port
struct.

While at it, also add proper error checking for the serial8250_register_port
call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-serial: Get rid of useless sw_serial_get_config

All info gathered there is never uses, so while we're cleaning up the
sunxi-serial code lets nuke this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-serial: Deal with sunxi 8250-s special busy interrupt

The sunxi uarts report interrupts with the iir register no interrupt bit
set, which causes a stuck interrupt. I can reproduce this 100% on my mini-x
with 1 GB of RAM.

When this happens this bit (bit 0) is combined with bit 1 and bit 2, this
is also done by Synopsys DesignWare 8250, and is called a busy interrupt
condition there. Likely the sunxi and the Synopsys DesignWare 8250-s have some
common ancestry.

This patch fixes the stuck interrupt condition by re-using the code for the
busy-interrupt from 8250_dw.c after this ttyS0 works reliable on my mini-x.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>