diff options
author | Patrice Chotard | 2018-08-03 15:07:41 +0200 |
---|---|---|
committer | Tom Rini | 2018-09-10 20:48:12 -0400 |
commit | d7c09684d73c4831a0240ce1fcbe7644bc3ab6e7 (patch) | |
tree | 84ef39679153e3ec0ec159b5a46e597acb7e16ad /drivers | |
parent | ad060c052bf8593c3d21bdab1f72f5f181064972 (diff) |
sandbox: Add serial test
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/sandbox.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index a60dabe5883..94b4fdfb171 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[] = { |