serial_dw.c 848 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 dw_serial_ids[] = {
  11. { .compatible = "snps,dw-apb-uart" },
  12. { }
  13. };
  14. static int dw_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 = CONFIG_SYS_NS16550_CLK;
  22. return 0;
  23. }
  24. U_BOOT_DRIVER(serial_ns16550) = {
  25. .name = "serial_dw",
  26. .id = UCLASS_SERIAL,
  27. .of_match = dw_serial_ids,
  28. .ofdata_to_platdata = dw_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. };