From 08ed93fed9806c150b025487429c644731505353 Mon Sep 17 00:00:00 2001 From: Abhishek Shah Date: Wed, 15 Jul 2020 00:35:55 +0530 Subject: [PATCH] drivers: pcie: refactor pcie directory to make RC and EP independent With this refactoring of pcie directory, RC drivers are placed under host/ directory, EP drivers are placed under endpoint/ directory and they are completely independent of each other. Signed-off-by: Abhishek Shah --- drivers/CMakeLists.txt | 2 +- drivers/pcie/CMakeLists.txt | 5 +---- drivers/pcie/Kconfig | 30 ++---------------------------- drivers/pcie/host/CMakeLists.txt | 3 +++ drivers/pcie/host/Kconfig | 28 ++++++++++++++++++++++++++++ drivers/pcie/{ => host}/msi.c | 0 drivers/pcie/{ => host}/pcie.c | 0 drivers/pcie/{ => host}/shell.c | 0 8 files changed, 35 insertions(+), 33 deletions(-) create mode 100644 drivers/pcie/host/CMakeLists.txt create mode 100644 drivers/pcie/host/Kconfig rename drivers/pcie/{ => host}/msi.c (100%) rename drivers/pcie/{ => host}/pcie.c (100%) rename drivers/pcie/{ => host}/shell.c (100%) diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index be7ddc75b91..53fadf71774 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -4,6 +4,7 @@ add_definitions(-D__ZEPHYR_SUPERVISOR__) add_subdirectory(console) add_subdirectory(interrupt_controller) +add_subdirectory(pcie) add_subdirectory_if_kconfig(adc) add_subdirectory_if_kconfig(clock_control) @@ -21,7 +22,6 @@ add_subdirectory_if_kconfig(ipm) add_subdirectory_if_kconfig(led) add_subdirectory_if_kconfig(led_strip) add_subdirectory_if_kconfig(modem) -add_subdirectory_if_kconfig(pcie) add_subdirectory_if_kconfig(pinmux) add_subdirectory_if_kconfig(pwm) add_subdirectory_if_kconfig(rtc) diff --git a/drivers/pcie/CMakeLists.txt b/drivers/pcie/CMakeLists.txt index 9ede6778767..351f355ffec 100644 --- a/drivers/pcie/CMakeLists.txt +++ b/drivers/pcie/CMakeLists.txt @@ -1,5 +1,2 @@ -zephyr_sources(pcie.c) -zephyr_sources_ifdef(CONFIG_PCIE_MSI msi.c) -zephyr_sources_ifdef(CONFIG_PCIE_SHELL shell.c) - +add_subdirectory_ifdef(CONFIG_PCIE host) add_subdirectory_ifdef(CONFIG_PCIE_ENDPOINT endpoint) diff --git a/drivers/pcie/Kconfig b/drivers/pcie/Kconfig index fe1f7ea8324..2651a84f6a6 100644 --- a/drivers/pcie/Kconfig +++ b/drivers/pcie/Kconfig @@ -1,30 +1,4 @@ -# PCIe/new PCI configuration options - -# Copyright (c) 2019 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -menuconfig PCIE - bool "Enable new PCI/PCIe support" - help - This option enables support for new PCI(e) drivers. - -if PCIE - -config PCIE_MSI - bool "Enable support for PCI(e) MSI" - help - Use Message-Signaled Interrupts where possible. With this option - enabled, PCI(e) devices which support MSI will be configured (at - runtime) to use them. This is typically required for PCIe devices - to generate interrupts at all. - -config PCIE_SHELL - bool "Enable PCIe/new PCI Shell" - default y - depends on SHELL && !PCIE_ENDPOINT - help - Enable commands for debugging PCI(e) using the built-in shell. +# PCIe RC/EP drivers configuration options +source "drivers/pcie/host/Kconfig" source "drivers/pcie/endpoint/Kconfig" - -endif # PCIE diff --git a/drivers/pcie/host/CMakeLists.txt b/drivers/pcie/host/CMakeLists.txt new file mode 100644 index 00000000000..c6443fcb6ab --- /dev/null +++ b/drivers/pcie/host/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources(pcie.c) +zephyr_sources_ifdef(CONFIG_PCIE_MSI msi.c) +zephyr_sources_ifdef(CONFIG_PCIE_SHELL shell.c) diff --git a/drivers/pcie/host/Kconfig b/drivers/pcie/host/Kconfig new file mode 100644 index 00000000000..22dbfb74f3c --- /dev/null +++ b/drivers/pcie/host/Kconfig @@ -0,0 +1,28 @@ +# PCIe/new PCI configuration options + +# Copyright (c) 2019 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +menuconfig PCIE + bool "Enable new PCI/PCIe Root Complex support" + help + This option enables support for new PCI(e) drivers. + +if PCIE + +config PCIE_MSI + bool "Enable support for PCI(e) MSI" + help + Use Message-Signaled Interrupts where possible. With this option + enabled, PCI(e) devices which support MSI will be configured (at + runtime) to use them. This is typically required for PCIe devices + to generate interrupts at all. + +config PCIE_SHELL + bool "Enable PCIe/new PCI Shell" + default y + depends on SHELL + help + Enable commands for debugging PCI(e) using the built-in shell. + +endif # PCIE diff --git a/drivers/pcie/msi.c b/drivers/pcie/host/msi.c similarity index 100% rename from drivers/pcie/msi.c rename to drivers/pcie/host/msi.c diff --git a/drivers/pcie/pcie.c b/drivers/pcie/host/pcie.c similarity index 100% rename from drivers/pcie/pcie.c rename to drivers/pcie/host/pcie.c diff --git a/drivers/pcie/shell.c b/drivers/pcie/host/shell.c similarity index 100% rename from drivers/pcie/shell.c rename to drivers/pcie/host/shell.c