1 /* 2 * Copyright (c) 2015 National Instruments 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <dm.h> 9 #include <serial.h> 10 11 static int nulldev_serial_setbrg(struct udevice *dev, int baudrate) 12 { 13 return 0; 14 } 15 16 static int nulldev_serial_getc(struct udevice *dev) 17 { 18 return -EAGAIN; 19 } 20 21 static int nulldev_serial_input(struct udevice *dev) 22 { 23 return 0; 24 } 25 26 static int nulldev_serial_putc(struct udevice *dev, const char ch) 27 { 28 return 0; 29 } 30 31 static const struct udevice_id nulldev_serial_ids[] = { 32 { .compatible = "nulldev-serial" }, 33 { } 34 }; 35 36 37 const struct dm_serial_ops nulldev_serial_ops = { 38 .putc = nulldev_serial_putc, 39 .getc = nulldev_serial_getc, 40 .setbrg = nulldev_serial_setbrg, 41 }; 42 43 U_BOOT_DRIVER(serial_nulldev) = { 44 .name = "serial_nulldev", 45 .id = UCLASS_SERIAL, 46 .of_match = nulldev_serial_ids, 47 .ops = &nulldev_serial_ops, 48 }; 49