serial-refactor: Fixed circular includes

Modify hardware_gen script to only include chosen
serial path. Added newlines to serial drivers to fix
concat issues when compiling. Move cmake macro RegisterDriver
 up a level to support timer refactor. Modify arm cmake to reflect
this.
This commit is contained in:
Oliver Scott
2019-03-07 16:32:20 +11:00
parent 2943f042a7
commit 96c63a4b55
6 changed files with 33 additions and 16 deletions

View File

@@ -132,7 +132,7 @@ if (DEFINED KernelDTSList)
OUTPUT_VARIABLE compatibility_strings
)
include(src/drivers/serial/config.cmake)
include(src/drivers/config.cmake)
endif()
# Now enshrine all the common variables in the config

25
src/drivers/config.cmake Normal file
View File

@@ -0,0 +1,25 @@
#
# Copyright 2019, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DATA61_GPL)
#
cmake_minimum_required(VERSION 3.7.2)
macro(RegisterDriver compatibility_strings match_strings)
foreach(match_string IN ITEMS ${match_strings})
list(FIND ${compatibility_strings} ${match_string} res)
if(NOT (res EQUAL -1))
add_sources(${ARGN})
break()
endif()
endforeach()
endmacro()
include(src/drivers/serial/config.cmake)

View File

@@ -56,4 +56,4 @@ unsigned char getDebugChar(void)
while ( !(*UART_REG(MU_LSR) & MU_LSR_DATAREADY) );
return *UART_REG(MU_IO);
}
#endif //CONFIG_DEBUG_BUILD
#endif //CONFIG_DEBUG_BUILD

View File

@@ -12,20 +12,10 @@
cmake_minimum_required(VERSION 3.7.2)
macro(RegisterDriver compatibility_strings match_strings)
foreach(match_string IN ITEMS ${match_strings})
list(FIND ${compatibility_strings} ${match_string} res)
if(NOT (res EQUAL -1))
add_sources(${ARGN})
break()
endif()
endforeach()
endmacro()
RegisterDriver(compatibility_strings "nvidia,tegra20-uart;ti,omap3-uart;snps,dw-apb-uart" PREFIX src/drivers/serial CFILES "tegra_omap3_dwapb.c")
RegisterDriver(compatibility_strings "brcm,bcm2835-aux-uart" PREFIX src/drivers/serial CFILES "bcm2835-aux-uart.c")
RegisterDriver(compatibility_strings "fsl,imx31-uart;fsl,imx6q-uart" PREFIX src/drivers/serial CFILES "imx.c")
RegisterDriver(compatibility_strings "arm,pl011" PREFIX src/drivers/serial CFILES "pl011.c")
RegisterDriver(compatibility_strings "nvidia,tegra20-uart;ti,omap3-uart;snps,dw-apb-uart" PREFIX src/drivers/serial CFILES "tegra_omap3_dwapb.c")
RegisterDriver(compatibility_strings "fsl,imx31-uart;fsl,imx6q-uart" PREFIX src/drivers/serial CFILES "imx.c")
RegisterDriver(compatibility_strings "samsung,exynos4210-uart" PREFIX src/drivers/serial CFILES "exynos4210-uart.c")
RegisterDriver(compatibility_strings "qcom,msm-uartdm" PREFIX src/drivers/serial CFILES "msm-uartdm.c")
RegisterDriver(compatibility_strings "xlnx,xuartps" PREFIX src/drivers/serial CFILES "xuartps.c")

View File

@@ -40,4 +40,4 @@ getDebugChar(void)
return *UART_REG(UARTDR);
}
#endif //CONFIG_DEBUG_BUILD
#endif //CONFIG_DEBUG_BUILD

View File

@@ -528,7 +528,6 @@ class Config:
if reg.user_macro or ('user' in reg_rule and reg_rule['user'] == True):
user.add(reg)
regs.append(reg)
self.matched_devices.add(compatible)
kernel.update(set(regs))
@@ -546,6 +545,9 @@ class Config:
continue
for rule in self.devices[compatible]:
if self._is_chosen(device, rule, by_phandle):
self.matched_devices.add(compatible)
if 'interrupts' not in rule or not self._is_chosen(device, rule, by_phandle):
continue
for irq in rule['interrupts']: