serial_x86.c 951 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <fdtdec.h>
  9. #include <ns16550.h>
  10. #include <serial.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. static const struct udevice_id x86_serial_ids[] = {
  13. { .compatible = "x86-uart" },
  14. { }
  15. };
  16. static int x86_serial_ofdata_to_platdata(struct udevice *dev)
  17. {
  18. struct ns16550_platdata *plat = dev_get_platdata(dev);
  19. int ret;
  20. ret = ns16550_serial_ofdata_to_platdata(dev);
  21. if (ret)
  22. return ret;
  23. plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
  24. "clock-frequency", 1843200);
  25. return 0;
  26. }
  27. U_BOOT_DRIVER(serial_ns16550) = {
  28. .name = "serial_x86",
  29. .id = UCLASS_SERIAL,
  30. .of_match = x86_serial_ids,
  31. .ofdata_to_platdata = x86_serial_ofdata_to_platdata,
  32. .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
  33. .priv_auto_alloc_size = sizeof(struct NS16550),
  34. .probe = ns16550_serial_probe,
  35. .ops = &ns16550_serial_ops,
  36. };