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