static int pl01x_generic_serial_init(struct pl01x_regs *regs,
enum pl01x_type type)
{
+ switch (type) {
+ case TYPE_PL010:
+ /* disable everything */
+ writel(0, ®s->pl010_cr);
+ break;
+ case TYPE_PL011:
#ifdef CONFIG_PL011_SERIAL_FLUSH_ON_INIT
- if (type == TYPE_PL011) {
/* Empty RX fifo if necessary */
if (readl(®s->pl011_cr) & UART_PL011_CR_UARTEN) {
while (!(readl(®s->fr) & UART_PL01x_FR_RXFE))
readl(®s->dr);
}
- }
#endif
-
- /* First, disable everything */
- writel(0, ®s->pl010_cr);
-
- switch (type) {
- case TYPE_PL010:
- break;
- case TYPE_PL011:
+ /* disable everything */
+ writel(0, ®s->pl011_cr);
break;
default:
return -EINVAL;
.probe = pl01x_serial_probe,
.ops = &pl01x_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
+ .priv_auto_alloc_size = sizeof(struct pl01x_priv),
};
#endif