mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-18 16:08:53 +09:00
![Keng Soon Cheah](/assets/img/avatar_default.png)
Some device the serial console's initialization cannot run early during the boot process. Hence, nulldev serial device is helpful on that situation. For example, if the serial module was implemented in FPGA. Serial initialization is prohibited to run until the FPGA was programmed. This commit is to adding nulldev serial driver. This will allows the default console to be specified as a nulldev. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Keng Soon Cheah <keng.soon.cheah@ni.com> Cc: Chen Yee Chew <chen.yee.chew@ni.com>
49 lines
857 B
C
49 lines
857 B
C
/*
|
|
* Copyright (c) 2015 National Instruments
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#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_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,
|
|
.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,
|
|
};
|