Simon Glass | 60cebe5 | 2014-10-10 07:49:20 -0600 | [diff] [blame] | 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 <ns16550.h> |
| 10 | #include <serial.h> |
| 11 | |
Bin Meng | 7bb2c3c | 2014-12-17 15:50:47 +0800 | [diff] [blame^] | 12 | static const struct udevice_id x86_serial_ids[] = { |
| 13 | { .compatible = "x86-uart" }, |
Simon Glass | 60cebe5 | 2014-10-10 07:49:20 -0600 | [diff] [blame] | 14 | { } |
| 15 | }; |
| 16 | |
Bin Meng | 7bb2c3c | 2014-12-17 15:50:47 +0800 | [diff] [blame^] | 17 | static int x86_serial_ofdata_to_platdata(struct udevice *dev) |
Simon Glass | 60cebe5 | 2014-10-10 07:49:20 -0600 | [diff] [blame] | 18 | { |
| 19 | struct ns16550_platdata *plat = dev_get_platdata(dev); |
| 20 | int ret; |
| 21 | |
| 22 | ret = ns16550_serial_ofdata_to_platdata(dev); |
| 23 | if (ret) |
| 24 | return ret; |
| 25 | plat->clock = 1843200; |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | U_BOOT_DRIVER(serial_ns16550) = { |
Bin Meng | 7bb2c3c | 2014-12-17 15:50:47 +0800 | [diff] [blame^] | 30 | .name = "serial_x86", |
Simon Glass | 60cebe5 | 2014-10-10 07:49:20 -0600 | [diff] [blame] | 31 | .id = UCLASS_SERIAL, |
Bin Meng | 7bb2c3c | 2014-12-17 15:50:47 +0800 | [diff] [blame^] | 32 | .of_match = x86_serial_ids, |
| 33 | .ofdata_to_platdata = x86_serial_ofdata_to_platdata, |
Simon Glass | 60cebe5 | 2014-10-10 07:49:20 -0600 | [diff] [blame] | 34 | .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), |
| 35 | .priv_auto_alloc_size = sizeof(struct NS16550), |
| 36 | .probe = ns16550_serial_probe, |
| 37 | .ops = &ns16550_serial_ops, |
| 38 | }; |