serial_coreboot.c 859 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2014 Google, Inc
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <ns16550.h>
  9. #include <serial.h>
  10. static const struct udevice_id coreboot_serial_ids[] = {
  11. { .compatible = "coreboot-uart" },
  12. { }
  13. };
  14. static int coreboot_serial_ofdata_to_platdata(struct udevice *dev)
  15. {
  16. struct ns16550_platdata *plat = dev_get_platdata(dev);
  17. int ret;
  18. ret = ns16550_serial_ofdata_to_platdata(dev);
  19. if (ret)
  20. return ret;
  21. plat->clock = 1843200;
  22. return 0;
  23. }
  24. U_BOOT_DRIVER(serial_ns16550) = {
  25. .name = "serial_coreboot",
  26. .id = UCLASS_SERIAL,
  27. .of_match = coreboot_serial_ids,
  28. .ofdata_to_platdata = coreboot_serial_ofdata_to_platdata,
  29. .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
  30. .priv_auto_alloc_size = sizeof(struct NS16550),
  31. .probe = ns16550_serial_probe,
  32. .ops = &ns16550_serial_ops,
  33. };