blob: 0047664f15a8c7e88851194ff6a657acfa193a6b [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>
Lee Leahy654fd072016-02-17 08:47:58 -08005#include <device/pci_ids.h>
Lee Leahyf55f3e62016-02-17 08:47:58 -08006#include <soc/pci_devs.h>
Lee Leahy87df8d02016-02-07 14:37:13 -08007
Elyes HAOUAS756a0bd2018-09-19 14:50:54 +02008static void uart_read_resources(struct device *dev)
Lee Leahy87df8d02016-02-07 14:37:13 -08009{
Lee Leahy654fd072016-02-17 08:47:58 -080010 struct resource *res;
11
12 /* Read the resources */
13 pci_dev_read_resources(dev);
14
15 /* Set the debug port configuration */
16 res = find_resource(dev, PCI_BASE_ADDRESS_0);
17 res->base = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
18 res->size = 0x100;
19 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
Lee Leahy87df8d02016-02-07 14:37:13 -080020}
21
Lee Leahy654fd072016-02-17 08:47:58 -080022static struct device_operations device_ops = {
Elyes HAOUAS1d191272018-11-27 12:23:48 +010023 .read_resources = uart_read_resources,
24 .set_resources = pci_dev_set_resources,
25 .enable_resources = pci_dev_enable_resources,
Lee Leahy654fd072016-02-17 08:47:58 -080026};
Lee Leahy87df8d02016-02-07 14:37:13 -080027
Lee Leahy654fd072016-02-17 08:47:58 -080028static const struct pci_driver uart_driver __pci_driver = {
Lee Leahyf55f3e62016-02-17 08:47:58 -080029 .ops = &device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010030 .vendor = PCI_VID_INTEL,
Lee Leahyf55f3e62016-02-17 08:47:58 -080031 .device = HSUART_DEVID,
Lee Leahy654fd072016-02-17 08:47:58 -080032};