Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Keng Soon Cheah | cac73f2 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 National Instruments |
Keng Soon Cheah | cac73f2 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <serial.h> |
| 9 | |
| 10 | static int nulldev_serial_setbrg(struct udevice *dev, int baudrate) |
| 11 | { |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | static int nulldev_serial_getc(struct udevice *dev) |
| 16 | { |
| 17 | return -EAGAIN; |
| 18 | } |
| 19 | |
Wilson Lee | b12907f | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 20 | static int nulldev_serial_pending(struct udevice *dev, bool input) |
| 21 | { |
| 22 | return 0; |
| 23 | } |
| 24 | |
Keng Soon Cheah | cac73f2 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 25 | static int nulldev_serial_putc(struct udevice *dev, const char ch) |
| 26 | { |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | static const struct udevice_id nulldev_serial_ids[] = { |
| 31 | { .compatible = "nulldev-serial" }, |
| 32 | { } |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | const struct dm_serial_ops nulldev_serial_ops = { |
| 37 | .putc = nulldev_serial_putc, |
Wilson Lee | b12907f | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 38 | .pending = nulldev_serial_pending, |
Keng Soon Cheah | cac73f2 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 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 | }; |