1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2015 Google, Inc
7 #include <debug_uart.h>
9 #include <dt-structs.h>
12 #include <asm/arch-rockchip/clock.h>
13 #include <dm/device-internal.h>
15 #if defined(CONFIG_ROCKCHIP_RK3188)
16 struct rockchip_uart_plat {
17 struct dtd_rockchip_rk3188_uart dtplat;
18 struct ns16550_plat plat;
20 struct dtd_rockchip_rk3188_uart *dtplat, s_dtplat;
21 #elif defined(CONFIG_ROCKCHIP_RK3288)
22 struct rockchip_uart_plat {
23 struct dtd_rockchip_rk3288_uart dtplat;
24 struct ns16550_plat plat;
26 struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat;
29 static int rockchip_serial_probe(struct udevice *dev)
31 struct rockchip_uart_plat *plat = dev_get_plat(dev);
33 /* Create some new platform data for the standard driver */
34 plat->plat.base = plat->dtplat.reg[0];
35 plat->plat.reg_shift = plat->dtplat.reg_shift;
36 plat->plat.clock = plat->dtplat.clock_frequency;
37 plat->plat.fcr = UART_FCR_DEFVAL;
38 dev_set_plat(dev, &plat->plat);
40 return ns16550_serial_probe(dev);
43 U_BOOT_DRIVER(rockchip_rk3188_uart) = {
44 .name = "rockchip_rk3188_uart",
46 .priv_auto = sizeof(struct ns16550),
47 .plat_auto = sizeof(struct rockchip_uart_plat),
48 .probe = rockchip_serial_probe,
49 .ops = &ns16550_serial_ops,
50 .flags = DM_FLAG_PRE_RELOC,
53 U_BOOT_DRIVER(rockchip_rk3288_uart) = {
54 .name = "rockchip_rk3288_uart",
56 .priv_auto = sizeof(struct ns16550),
57 .plat_auto = sizeof(struct rockchip_uart_plat),
58 .probe = rockchip_serial_probe,
59 .ops = &ns16550_serial_ops,
60 .flags = DM_FLAG_PRE_RELOC,