summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_nulldev.c
blob: efae14dd6ca55a5f9e284cd7e9f6ee1f41261739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (c) 2015 National Instruments
 */

#include <common.h>
#include <dm.h>
#include <serial.h>

static int nulldev_serial_setbrg(struct udevice *dev, int baudrate)
{
	return 0;
}

static int nulldev_serial_getc(struct udevice *dev)
{
	return -EAGAIN;
}

static int nulldev_serial_pending(struct udevice *dev, bool input)
{
	return 0;
}

static int nulldev_serial_input(struct udevice *dev)
{
	return 0;
}

static int nulldev_serial_putc(struct udevice *dev, const char ch)
{
	return 0;
}

static const struct udevice_id nulldev_serial_ids[] = {
	{ .compatible = "nulldev-serial" },
	{ }
};


const struct dm_serial_ops nulldev_serial_ops = {
	.putc = nulldev_serial_putc,
	.pending = nulldev_serial_pending,
	.getc = nulldev_serial_getc,
	.setbrg = nulldev_serial_setbrg,
};

U_BOOT_DRIVER(serial_nulldev) = {
	.name	= "serial_nulldev",
	.id	= UCLASS_SERIAL,
	.of_match = nulldev_serial_ids,
	.ops	= &nulldev_serial_ops,
};