]> git.sur5r.net Git - u-boot/blob - drivers/serial/serial_keystone.c
arc: Use the generic bitops headers
[u-boot] / drivers / serial / serial_keystone.c
1 /*
2  * Copyright (c) 2015 Texas Instruments, <www.ti.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <dm.h>
9 #include <fdtdec.h>
10 #include <ns16550.h>
11 #include <serial.h>
12 #include <asm/arch/clock.h>
13
14 DECLARE_GLOBAL_DATA_PTR;
15
16 #if CONFIG_IS_ENABLED(OF_CONTROL)
17 static const struct udevice_id keystone_serial_ids[] = {
18         { .compatible = "ti,keystone-uart" },
19         { .compatible = "ns16550a" },
20         { }
21 };
22
23 static int keystone_serial_ofdata_to_platdata(struct udevice *dev)
24 {
25         struct ns16550_platdata *plat = dev_get_platdata(dev);
26         int ret;
27
28         ret = ns16550_serial_ofdata_to_platdata(dev);
29         if (ret)
30                 return ret;
31         plat->clock = CONFIG_SYS_NS16550_CLK;
32         return 0;
33 }
34 #endif
35
36 U_BOOT_DRIVER(serial_keystone_ns16550) = {
37         .name   = "serial_keystone",
38         .id     = UCLASS_SERIAL,
39 #if CONFIG_IS_ENABLED(OF_CONTROL)
40         .of_match = of_match_ptr(keystone_serial_ids),
41         .ofdata_to_platdata = of_match_ptr(keystone_serial_ofdata_to_platdata),
42         .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
43 #endif
44         .priv_auto_alloc_size = sizeof(struct NS16550),
45         .probe = ns16550_serial_probe,
46         .ops    = &ns16550_serial_ops,
47         .flags  = DM_FLAG_PRE_RELOC,
48 };