]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/serial/serial_x86.c
video: ipu: fix out of bounds access
[people/ms/u-boot.git] / drivers / serial / serial_x86.c
CommitLineData
e98a03ca
SG
1/*
2 * Copyright (c) 2014 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
1eb47efc 9#include <fdtdec.h>
e98a03ca
SG
10#include <ns16550.h>
11#include <serial.h>
12
1eb47efc
BM
13DECLARE_GLOBAL_DATA_PTR;
14
41702bac
BM
15static const struct udevice_id x86_serial_ids[] = {
16 { .compatible = "x86-uart" },
e98a03ca
SG
17 { }
18};
19
41702bac 20static int x86_serial_ofdata_to_platdata(struct udevice *dev)
e98a03ca
SG
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;
1eb47efc
BM
28
29 plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
30 "clock-frequency", 1843200);
e98a03ca
SG
31
32 return 0;
33}
1eb47efc 34
e98a03ca 35U_BOOT_DRIVER(serial_ns16550) = {
41702bac 36 .name = "serial_x86",
e98a03ca 37 .id = UCLASS_SERIAL,
41702bac
BM
38 .of_match = x86_serial_ids,
39 .ofdata_to_platdata = x86_serial_ofdata_to_platdata,
e98a03ca
SG
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};