From d7c09684d73c4831a0240ce1fcbe7644bc3ab6e7 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Fri, 3 Aug 2018 15:07:41 +0200 Subject: sandbox: Add serial test Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- drivers/serial/sandbox.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/serial/sandbox.c') diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index a60dabe588..94b4fdfb17 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -143,6 +143,19 @@ static int sandbox_serial_getc(struct udevice *dev) return result; } +static int sandbox_serial_setconfig(struct udevice *dev, uint serial_config) +{ + u8 parity = SERIAL_GET_PARITY(serial_config); + u8 bits = SERIAL_GET_BITS(serial_config); + u8 stop = SERIAL_GET_STOP(serial_config); + + if (bits != SERIAL_8_BITS || stop != SERIAL_ONE_STOP || + parity != SERIAL_PAR_NONE) + return -ENOTSUPP; /* not supported in driver*/ + + return 0; +} + static const char * const ansi_colour[] = { "black", "red", "green", "yellow", "blue", "megenta", "cyan", "white", @@ -173,6 +186,7 @@ static const struct dm_serial_ops sandbox_serial_ops = { .putc = sandbox_serial_putc, .pending = sandbox_serial_pending, .getc = sandbox_serial_getc, + .setconfig = sandbox_serial_setconfig, }; static const struct udevice_id sandbox_serial_ids[] = { -- cgit v1.2.3