blob: c045c34a71719c54d22eaec9347569ea8c5449b6 [file] [log] [blame]
Angel Pons230e4f9d2020-04-05 15:47:14 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahy87df8d02016-02-07 14:37:13 -08002
Lee Leahy87df8d02016-02-07 14:37:13 -08003#include <console/uart.h>
4#include <device/pci.h>
5#include <device/pci_def.h>
Lee Leahy654fd072016-02-17 08:47:58 -08006#include <device/pci_ids.h>
Lee Leahyf55f3e62016-02-17 08:47:58 -08007#include <soc/pci_devs.h>
Lee Leahy87df8d02016-02-07 14:37:13 -08008
Elyes HAOUAS756a0bd2018-09-19 14:50:54 +02009static void uart_read_resources(struct device *dev)
Lee Leahy87df8d02016-02-07 14:37:13 -080010{
Lee Leahy654fd072016-02-17 08:47:58 -080011 struct resource *res;
12
13 /* Read the resources */
14 pci_dev_read_resources(dev);
15
16 /* Set the debug port configuration */
17 res = find_resource(dev, PCI_BASE_ADDRESS_0);
18 res->base = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
19 res->size = 0x100;
20 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
Lee Leahy87df8d02016-02-07 14:37:13 -080021}
22
Lee Leahy654fd072016-02-17 08:47:58 -080023static struct device_operations device_ops = {
Elyes HAOUAS1d191272018-11-27 12:23:48 +010024 .read_resources = uart_read_resources,
25 .set_resources = pci_dev_set_resources,
26 .enable_resources = pci_dev_enable_resources,
Lee Leahy654fd072016-02-17 08:47:58 -080027};
Lee Leahy87df8d02016-02-07 14:37:13 -080028
Lee Leahy654fd072016-02-17 08:47:58 -080029static const struct pci_driver uart_driver __pci_driver = {
Lee Leahyf55f3e62016-02-17 08:47:58 -080030 .ops = &device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010031 .vendor = PCI_VID_INTEL,
Lee Leahyf55f3e62016-02-17 08:47:58 -080032 .device = HSUART_DEVID,
Lee Leahy654fd072016-02-17 08:47:58 -080033};