Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 National Instruments |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 6 | #include <dm.h> |
| 7 | #include <serial.h> |
| 8 | |
| 9 | static int nulldev_serial_setbrg(struct udevice *dev, int baudrate) |
| 10 | { |
| 11 | return 0; |
| 12 | } |
| 13 | |
| 14 | static int nulldev_serial_getc(struct udevice *dev) |
| 15 | { |
| 16 | return -EAGAIN; |
| 17 | } |
| 18 | |
Wilson Lee | 7f69f68 | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 19 | static int nulldev_serial_pending(struct udevice *dev, bool input) |
| 20 | { |
| 21 | return 0; |
| 22 | } |
| 23 | |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 24 | static int nulldev_serial_putc(struct udevice *dev, const char ch) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static const struct udevice_id nulldev_serial_ids[] = { |
| 30 | { .compatible = "nulldev-serial" }, |
| 31 | { } |
| 32 | }; |
| 33 | |
| 34 | |
| 35 | const struct dm_serial_ops nulldev_serial_ops = { |
| 36 | .putc = nulldev_serial_putc, |
Wilson Lee | 7f69f68 | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 37 | .pending = nulldev_serial_pending, |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 38 | .getc = nulldev_serial_getc, |
| 39 | .setbrg = nulldev_serial_setbrg, |
| 40 | }; |
| 41 | |
| 42 | U_BOOT_DRIVER(serial_nulldev) = { |
| 43 | .name = "serial_nulldev", |
| 44 | .id = UCLASS_SERIAL, |
| 45 | .of_match = nulldev_serial_ids, |
| 46 | .ops = &nulldev_serial_ops, |
| 47 | }; |