X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fserial%2Fserial-uclass.c;h=d4488a2cc288a55c977825a4c92d575388e9a41f;hb=95468e6c9bfc8a552ec3681dacb666ef854f21cf;hp=665cca85cb5683f024cba340ab96d6742075fd4b;hpb=cdef6bb43cd10360eef5af05fea4e10158d2ff55;p=oweals%2Fu-boot.git diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 665cca85cb..d4488a2cc2 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -62,7 +62,7 @@ static int serial_check_stdout(const void *blob, struct udevice **devp) * anyway. */ if (node > 0 && !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node), - devp)) { + devp, false)) { if (!device_probe(*devp)) return 0; } @@ -294,20 +294,44 @@ void serial_setbrg(void) ops->setbrg(gd->cur_serial_dev, gd->baudrate); } -int serial_setconfig(uint config) +int serial_getconfig(struct udevice *dev, uint *config) { struct dm_serial_ops *ops; - if (!gd->cur_serial_dev) - return 0; + ops = serial_get_ops(dev); + if (ops->getconfig) + return ops->getconfig(dev, config); - ops = serial_get_ops(gd->cur_serial_dev); + return 0; +} + +int serial_setconfig(struct udevice *dev, uint config) +{ + struct dm_serial_ops *ops; + + ops = serial_get_ops(dev); if (ops->setconfig) - return ops->setconfig(gd->cur_serial_dev, config); + return ops->setconfig(dev, config); return 0; } +int serial_getinfo(struct udevice *dev, struct serial_device_info *info) +{ + struct dm_serial_ops *ops; + + if (!info) + return -EINVAL; + + info->baudrate = gd->baudrate; + + ops = serial_get_ops(dev); + if (ops->getinfo) + return ops->getinfo(dev, info); + + return -EINVAL; +} + void serial_stdio_init(void) { } @@ -419,12 +443,16 @@ static int serial_post_probe(struct udevice *dev) ops->pending += gd->reloc_off; if (ops->clear) ops->clear += gd->reloc_off; + if (ops->getconfig) + ops->getconfig += gd->reloc_off; if (ops->setconfig) ops->setconfig += gd->reloc_off; #if CONFIG_POST & CONFIG_SYS_POST_UART if (ops->loop) ops->loop += gd->reloc_off; #endif + if (ops->getinfo) + ops->getinfo += gd->reloc_off; #endif /* Set the baud rate */ if (ops->setbrg) {