blob: 47141c64ebbcf61b08ffc97fa713be068542d52a [file] [log] [blame]
Simon Glassfad486c2015-02-07 11:51:47 -07001/*
2 * Copyright (c) 2014 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <ns16550.h>
10#include <serial.h>
11
12static const struct udevice_id ppc_serial_ids[] = {
13 { .compatible = "ns16550" },
14 { }
15};
16
17static int ppc_serial_ofdata_to_platdata(struct udevice *dev)
18{
19 struct ns16550_platdata *plat = dev_get_platdata(dev);
20 int ret;
21
22 ret = ns16550_serial_ofdata_to_platdata(dev);
23 if (ret)
24 return ret;
25 plat->clock = get_serial_clock();
26
27 return 0;
28}
29
30U_BOOT_DRIVER(serial_ns16550) = {
31 .name = "serial_ppc",
32 .id = UCLASS_SERIAL,
33 .of_match = ppc_serial_ids,
34 .ofdata_to_platdata = ppc_serial_ofdata_to_platdata,
35 .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
36 .priv_auto_alloc_size = sizeof(struct NS16550),
37 .probe = ns16550_serial_probe,
38 .ops = &ns16550_serial_ops,
39 .flags = DM_FLAG_PRE_RELOC,
40};