2020-04-05 15:47:14 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-02-07 23:37:13 +01:00
|
|
|
|
|
|
|
#include <console/uart.h>
|
|
|
|
#include <device/pci.h>
|
|
|
|
#include <device/pci_def.h>
|
2016-02-17 17:47:58 +01:00
|
|
|
#include <device/pci_ids.h>
|
2016-02-17 17:47:58 +01:00
|
|
|
#include <soc/pci_devs.h>
|
2016-02-07 23:37:13 +01:00
|
|
|
|
2018-09-19 14:50:54 +02:00
|
|
|
static void uart_read_resources(struct device *dev)
|
2016-02-07 23:37:13 +01:00
|
|
|
{
|
2016-02-17 17:47:58 +01:00
|
|
|
struct resource *res;
|
2016-02-07 23:37:13 +01:00
|
|
|
|
2016-02-17 17:47:58 +01:00
|
|
|
/* Read the resources */
|
|
|
|
pci_dev_read_resources(dev);
|
2016-02-07 23:37:13 +01:00
|
|
|
|
2016-02-17 17:47:58 +01:00
|
|
|
/* Set the debug port configuration */
|
|
|
|
res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
|
|
|
res->base = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
|
|
|
|
res->size = 0x100;
|
|
|
|
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
2016-02-07 23:37:13 +01:00
|
|
|
}
|
2016-02-17 17:47:58 +01:00
|
|
|
|
|
|
|
static struct device_operations device_ops = {
|
2018-11-27 12:23:48 +01:00
|
|
|
.read_resources = uart_read_resources,
|
|
|
|
.set_resources = pci_dev_set_resources,
|
|
|
|
.enable_resources = pci_dev_enable_resources,
|
2016-02-17 17:47:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct pci_driver uart_driver __pci_driver = {
|
2016-02-17 17:47:58 +01:00
|
|
|
.ops = &device_ops,
|
|
|
|
.vendor = PCI_VENDOR_ID_INTEL,
|
|
|
|
.device = HSUART_DEVID,
|
2016-02-17 17:47:58 +01:00
|
|
|
};
|