drivers: uart: ns16550: Move all PCIe-using nodes to a PCIe bus in DTS
The existing method of testing for any of the first four DT instances having the pcie property feels a bit clumsy and will get more so when support for more than four UARTs is added. A much more cleaner way to do this (and more correct probably as well) is to list any PCIe-based UART nodes under a pcie bus in the Device Tree hierarchy. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
7a2bddd75a
commit
1d5d5fcf49
5 changed files with 36 additions and 42 deletions
|
@ -57,12 +57,8 @@
|
|||
#define UART_NS16550_DLF_ENABLED
|
||||
#endif
|
||||
|
||||
#if DT_INST_PROP(0, pcie) || \
|
||||
DT_INST_PROP(1, pcie) || \
|
||||
DT_INST_PROP(2, pcie) || \
|
||||
DT_INST_PROP(3, pcie)
|
||||
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
|
||||
BUILD_ASSERT(IS_ENABLED(CONFIG_PCIE), "NS16550(s) in DT need CONFIG_PCIE");
|
||||
#define UART_NS16550_PCIE_ENABLED
|
||||
#include <drivers/pcie/pcie.h>
|
||||
#endif
|
||||
|
||||
|
@ -268,7 +264,7 @@ struct uart_ns16550_device_config {
|
|||
#ifdef UART_NS16550_PCP_ENABLED
|
||||
uint32_t pcp;
|
||||
#endif
|
||||
#ifdef UART_NS16550_PCIE_ENABLED
|
||||
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
|
||||
bool pcie;
|
||||
pcie_bdf_t pcie_bdf;
|
||||
pcie_id_t pcie_id;
|
||||
|
@ -350,7 +346,7 @@ static int uart_ns16550_configure(const struct device *dev,
|
|||
ARG_UNUSED(dev_cfg);
|
||||
|
||||
#ifndef UART_NS16550_ACCESS_IOPORT
|
||||
#ifdef UART_NS16550_PCIE_ENABLED
|
||||
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
|
||||
if (dev_cfg->pcie) {
|
||||
struct pcie_mbar mbar;
|
||||
|
||||
|
@ -365,7 +361,7 @@ static int uart_ns16550_configure(const struct device *dev,
|
|||
device_map(DEVICE_MMIO_RAM_PTR(dev), mbar.phys_addr, mbar.size,
|
||||
K_MEM_CACHE_NONE);
|
||||
} else
|
||||
#endif /* UART_NS16550_PCIE_ENABLED */
|
||||
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie) */
|
||||
{
|
||||
/* Map directly from DTS */
|
||||
DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue