]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/serial/serial-uclass.c
dm: Add support for all targets which requires MANUAL_RELOC
[karo-tx-uboot.git] / drivers / serial / serial-uclass.c
index b09053f1402bdf55aa3c89abea593ab0bd82d2dd..3fc7104359d3ccfd73e97ab81dd466cc6c62877a 100644 (file)
@@ -39,7 +39,7 @@ static void serial_find_console_or_panic(void)
        /* Check for a chosen console */
        node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path");
        if (node < 0)
-               node = fdtdec_get_alias_node(gd->fdt_blob, "console");
+               node = fdt_path_offset(gd->fdt_blob, "console");
        if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, &dev)) {
                gd->cur_serial_dev = dev;
                return;
@@ -258,6 +258,22 @@ static int serial_post_probe(struct udevice *dev)
 #endif
        int ret;
 
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+       if (ops->setbrg)
+               ops->setbrg += gd->reloc_off;
+       if (ops->getc)
+               ops->getc += gd->reloc_off;
+       if (ops->putc)
+               ops->putc += gd->reloc_off;
+       if (ops->pending)
+               ops->pending += gd->reloc_off;
+       if (ops->clear)
+               ops->clear += gd->reloc_off;
+#if CONFIG_POST & CONFIG_SYS_POST_UART
+       if (ops->loop)
+               ops->loop += gd->reloc_off
+#endif
+#endif
        /* Set the baud rate */
        if (ops->setbrg) {
                ret = ops->setbrg(dev, gd->baudrate);
@@ -297,6 +313,7 @@ static int serial_pre_remove(struct udevice *dev)
 UCLASS_DRIVER(serial) = {
        .id             = UCLASS_SERIAL,
        .name           = "serial",
+       .flags          = DM_UC_FLAG_SEQ_ALIAS,
        .post_probe     = serial_post_probe,
        .pre_remove     = serial_pre_remove,
        .per_device_auto_alloc_size = sizeof(struct serial_dev_priv),