serial_nulldev.c 904 B

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