+static int bcm283x_pl011_serial_setbrg(struct udevice *dev, int baudrate)
+{
+ int r;
+
+ r = pl01x_serial_setbrg(dev, baudrate);
+
+ /*
+ * We may have been muxed to a bogus line before. Drain the RX
+ * queue so we start at a clean slate.
+ */
+ while (pl01x_serial_getc(dev) != -EAGAIN) ;
+
+ return r;
+}
+
+static const struct dm_serial_ops bcm283x_pl011_serial_ops = {
+ .putc = pl01x_serial_putc,
+ .pending = pl01x_serial_pending,
+ .getc = pl01x_serial_getc,
+ .setbrg = bcm283x_pl011_serial_setbrg,
+};
+