blob: c06afc58f7ea3483298a62a64596a7cc5c322d92 [file] [log] [blame]
Simon Glassb3068ad2016-07-04 11:58:24 -06001/*
2 * Copyright (c) 2015 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <debug_uart.h>
9#include <dm.h>
10#include <dt-structs.h>
11#include <ns16550.h>
12#include <serial.h>
13#include <asm/arch/clock.h>
14
15struct rockchip_uart_platdata {
16 struct dtd_rockchip_rk3288_uart dtplat;
17 struct ns16550_platdata plat;
18};
19
20struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat;
21
22static int rockchip_serial_probe(struct udevice *dev)
23{
24 struct rockchip_uart_platdata *plat = dev_get_platdata(dev);
25
26 /* Create some new platform data for the standard driver */
27 plat->plat.base = plat->dtplat.reg[0];
28 plat->plat.reg_shift = plat->dtplat.reg_shift;
29 plat->plat.clock = plat->dtplat.clock_frequency;
Heiko Schocher06f108e2017-01-18 08:05:49 +010030 plat->plat.fcr = UART_FCR_DEFVAL;
Simon Glassb3068ad2016-07-04 11:58:24 -060031 dev->platdata = &plat->plat;
32
33 return ns16550_serial_probe(dev);
34}
35
36U_BOOT_DRIVER(rockchip_rk3288_uart) = {
37 .name = "rockchip_rk3288_uart",
38 .id = UCLASS_SERIAL,
39 .priv_auto_alloc_size = sizeof(struct NS16550),
40 .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata),
41 .probe = rockchip_serial_probe,
42 .ops = &ns16550_serial_ops,
43 .flags = DM_FLAG_PRE_RELOC,
44};