dm: serial: Add ->getconfig() callback
In some cases it would be good to know the settings, such as parity, of current serial console. One example might be an ACPI SPCR table to generate using these parameters. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
4f86a724e8
commit
ac7f5db9dc
@@ -294,6 +294,20 @@ void serial_setbrg(void)
|
||||
ops->setbrg(gd->cur_serial_dev, gd->baudrate);
|
||||
}
|
||||
|
||||
int serial_getconfig(uint *config)
|
||||
{
|
||||
struct dm_serial_ops *ops;
|
||||
|
||||
if (!gd->cur_serial_dev)
|
||||
return 0;
|
||||
|
||||
ops = serial_get_ops(gd->cur_serial_dev);
|
||||
if (ops->getconfig)
|
||||
return ops->getconfig(gd->cur_serial_dev, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int serial_setconfig(uint config)
|
||||
{
|
||||
struct dm_serial_ops *ops;
|
||||
@@ -419,6 +433,8 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user