]> Git Repo - J-u-boot.git/blame - drivers/serial/serial_omap.c
ns16550: unify serial_tegra
[J-u-boot.git] / drivers / serial / serial_omap.c
CommitLineData
0bf24951
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>
9#include <fdtdec.h>
10#include <ns16550.h>
11#include <serial.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
3a64845e
M
15#define DEFAULT_CLK_SPEED 48000000 /* 48Mhz */
16
0f925822 17#if CONFIG_IS_ENABLED(OF_CONTROL)
0bf24951 18static const struct udevice_id omap_serial_ids[] = {
e5a098b5 19 { .compatible = "ti,omap2-uart" },
0bf24951 20 { .compatible = "ti,omap3-uart" },
57cd681b 21 { .compatible = "ti,omap4-uart" },
e5a098b5
M
22 { .compatible = "ti,am3352-uart" },
23 { .compatible = "ti,am4372-uart" },
24 { .compatible = "ti,dra742-uart" },
0bf24951
SG
25 { }
26};
27
28static int omap_serial_ofdata_to_platdata(struct udevice *dev)
29{
30 struct ns16550_platdata *plat = dev_get_platdata(dev);
31 int ret;
32
33 ret = ns16550_serial_ofdata_to_platdata(dev);
34 if (ret)
35 return ret;
36 plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
3a64845e 37 "clock-frequency", DEFAULT_CLK_SPEED);
0bf24951
SG
38 plat->reg_shift = 2;
39
40 return 0;
41}
42#endif
43
44U_BOOT_DRIVER(serial_omap_ns16550) = {
45 .name = "serial_omap",
46 .id = UCLASS_SERIAL,
47 .of_match = of_match_ptr(omap_serial_ids),
48 .ofdata_to_platdata = of_match_ptr(omap_serial_ofdata_to_platdata),
49 .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
50 .priv_auto_alloc_size = sizeof(struct NS16550),
51 .probe = ns16550_serial_probe,
52 .ops = &ns16550_serial_ops,
53 .flags = DM_FLAG_PRE_RELOC,
54};
This page took 0.118662 seconds and 4 git commands to generate.