Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 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 | |
Wilson Lee | 7f69f68 | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 21 | static int nulldev_serial_pending(struct udevice *dev, bool input) |
| 22 | { |
| 23 | return 0; |
| 24 | } |
| 25 | |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 26 | static int nulldev_serial_input(struct udevice *dev) |
| 27 | { |
| 28 | return 0; |
| 29 | } |
| 30 | |
| 31 | static int nulldev_serial_putc(struct udevice *dev, const char ch) |
| 32 | { |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | static const struct udevice_id nulldev_serial_ids[] = { |
| 37 | { .compatible = "nulldev-serial" }, |
| 38 | { } |
| 39 | }; |
| 40 | |
| 41 | |
| 42 | const struct dm_serial_ops nulldev_serial_ops = { |
| 43 | .putc = nulldev_serial_putc, |
Wilson Lee | 7f69f68 | 2017-11-02 23:39:51 -0700 | [diff] [blame] | 44 | .pending = nulldev_serial_pending, |
Keng Soon Cheah | 755e2d0 | 2017-08-24 20:29:07 -0700 | [diff] [blame] | 45 | .getc = nulldev_serial_getc, |
| 46 | .setbrg = nulldev_serial_setbrg, |
| 47 | }; |
| 48 | |
| 49 | U_BOOT_DRIVER(serial_nulldev) = { |
| 50 | .name = "serial_nulldev", |
| 51 | .id = UCLASS_SERIAL, |
| 52 | .of_match = nulldev_serial_ids, |
| 53 | .ops = &nulldev_serial_ops, |
| 54 | }; |