serial_ppc.c 869 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 ppc_serial_ids[] = {
  11. { .compatible = "ns16550" },
  12. { }
  13. };
  14. static int ppc_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 = get_serial_clock();
  22. return 0;
  23. }
  24. U_BOOT_DRIVER(serial_ns16550) = {
  25. .name = "serial_ppc",
  26. .id = UCLASS_SERIAL,
  27. .of_match = ppc_serial_ids,
  28. .ofdata_to_platdata = ppc_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. .flags = DM_FLAG_PRE_RELOC,
  34. };