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>
14 #if defined(CONFIG_ROCKCHIP_RK3188)
15 struct rockchip_uart_platdata {
16 struct dtd_rockchip_rk3188_uart dtplat;
17 struct ns16550_platdata plat;
19 struct dtd_rockchip_rk3188_uart *dtplat, s_dtplat;
20 #elif defined(CONFIG_ROCKCHIP_RK3288)
21 struct rockchip_uart_platdata {
22 struct dtd_rockchip_rk3288_uart dtplat;
23 struct ns16550_platdata plat;
25 struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat;
28 static int rockchip_serial_probe(struct udevice *dev)
30 struct rockchip_uart_platdata *plat = dev_get_platdata(dev);
32 /* Create some new platform data for the standard driver */
33 plat->plat.base = plat->dtplat.reg[0];
34 plat->plat.reg_shift = plat->dtplat.reg_shift;
35 plat->plat.clock = plat->dtplat.clock_frequency;
36 plat->plat.fcr = UART_FCR_DEFVAL;
37 dev->platdata = &plat->plat;
39 return ns16550_serial_probe(dev);
42 U_BOOT_DRIVER(rockchip_rk3188_uart) = {
43 .name = "rockchip_rk3188_uart",
45 .priv_auto_alloc_size = sizeof(struct NS16550),
46 .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata),
47 .probe = rockchip_serial_probe,
48 .ops = &ns16550_serial_ops,
49 .flags = DM_FLAG_PRE_RELOC,
52 U_BOOT_DRIVER(rockchip_rk3288_uart) = {
53 .name = "rockchip_rk3288_uart",
55 .priv_auto_alloc_size = sizeof(struct NS16550),
56 .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata),
57 .probe = rockchip_serial_probe,
58 .ops = &ns16550_serial_ops,
59 .flags = DM_FLAG_PRE_RELOC,