+ struct arc_serial_platdata *plat = dev_get_platdata(dev);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ plat->reg = (struct arc_serial_regs *)devfdt_get_addr(dev);
+ plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+ "clock-frequency", 0);
+
+ return 0;
+}
+
+U_BOOT_DRIVER(serial_arc) = {
+ .name = "serial_arc",
+ .id = UCLASS_SERIAL,
+ .of_match = arc_serial_ids,
+ .ofdata_to_platdata = arc_serial_ofdata_to_platdata,
+ .platdata_auto_alloc_size = sizeof(struct arc_serial_platdata),
+ .probe = arc_serial_probe,
+ .ops = &arc_serial_ops,
+};
+
+#ifdef CONFIG_DEBUG_ARC_SERIAL
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+ struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
+ int arc_console_baud = CONFIG_DEBUG_UART_CLOCK / (CONFIG_BAUDRATE * 4) - 1;
+
+ writeb(arc_console_baud & 0xff, ®s->baudl);
+ writeb((arc_console_baud & 0xff00) >> 8, ®s->baudh);