From 19224ec1d5f5f434a571c2590ffc5f33ecbe9e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 2 May 2019 15:32:17 +0200 Subject: [PATCH] kinetis: move filtering-out periph_hwrng in cpu/kinetis This removes doing `filter-out periph_hwrng, $(FEATURES_PROVIDED)` after processing `cpu/$(CPU)/Makefile.features`. The current solution is a HACK as `CPU_MODEL` is currently not available at that moment but will be in the near future. It will allow always including `cpu/$(CPU)/Makefile.features` after `boards/$(BOARD)/Makefile.features`. It is a part of moving `CPU/CPU_MODEL` definitions to `Makefile.features`. --- boards/frdm-k64f/Makefile.features | 3 --- boards/frdm-kw41z/Makefile.features | 2 -- boards/phynode-kw41z/Makefile.features | 3 --- boards/teensy31/Makefile.features | 2 -- boards/usb-kw41z/Makefile.features | 2 -- cpu/kinetis/Makefile.features | 15 ++++++++++++++- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/boards/frdm-k64f/Makefile.features b/boards/frdm-k64f/Makefile.features index 28849c4840..6a5f7c94c3 100644 --- a/boards/frdm-k64f/Makefile.features +++ b/boards/frdm-k64f/Makefile.features @@ -12,6 +12,3 @@ FEATURES_PROVIDED += periph_uart FEATURES_MCU_GROUP = cortex_m4_1 include $(RIOTCPU)/kinetis/Makefile.features -# HACK the board currently uses the wrong hwrng register -# Remove this line when fixed -FEATURES_PROVIDED := $(filter-out periph_hwrng,$(FEATURES_PROVIDED)) diff --git a/boards/frdm-kw41z/Makefile.features b/boards/frdm-kw41z/Makefile.features index 5cc311ad95..5477369f01 100644 --- a/boards/frdm-kw41z/Makefile.features +++ b/boards/frdm-kw41z/Makefile.features @@ -11,5 +11,3 @@ FEATURES_PROVIDED += periph_uart FEATURES_MCU_GROUP = cortex_m0_2 include $(RIOTCPU)/kinetis/Makefile.features -# Remove this line after TRNG driver is implemented -FEATURES_PROVIDED := $(filter-out periph_hwrng,$(FEATURES_PROVIDED)) diff --git a/boards/phynode-kw41z/Makefile.features b/boards/phynode-kw41z/Makefile.features index 3463bf7b1c..5477369f01 100644 --- a/boards/phynode-kw41z/Makefile.features +++ b/boards/phynode-kw41z/Makefile.features @@ -11,6 +11,3 @@ FEATURES_PROVIDED += periph_uart FEATURES_MCU_GROUP = cortex_m0_2 include $(RIOTCPU)/kinetis/Makefile.features -# -# Remove this line after TRNG driver is implemented -FEATURES_PROVIDED := $(filter-out periph_hwrng,$(FEATURES_PROVIDED)) diff --git a/boards/teensy31/Makefile.features b/boards/teensy31/Makefile.features index 8e732a00a6..7b261c1c88 100644 --- a/boards/teensy31/Makefile.features +++ b/boards/teensy31/Makefile.features @@ -9,5 +9,3 @@ FEATURES_PROVIDED += periph_uart FEATURES_MCU_GROUP = cortex_m4_2 include $(RIOTCPU)/kinetis/Makefile.features -# No HWRNG in MK20D7 devices -FEATURES_PROVIDED := $(filter-out periph_hwrng,$(FEATURES_PROVIDED)) diff --git a/boards/usb-kw41z/Makefile.features b/boards/usb-kw41z/Makefile.features index 5cc311ad95..5477369f01 100644 --- a/boards/usb-kw41z/Makefile.features +++ b/boards/usb-kw41z/Makefile.features @@ -11,5 +11,3 @@ FEATURES_PROVIDED += periph_uart FEATURES_MCU_GROUP = cortex_m0_2 include $(RIOTCPU)/kinetis/Makefile.features -# Remove this line after TRNG driver is implemented -FEATURES_PROVIDED := $(filter-out periph_hwrng,$(FEATURES_PROVIDED)) diff --git a/cpu/kinetis/Makefile.features b/cpu/kinetis/Makefile.features index 28c39717a7..d8b43c087c 100644 --- a/cpu/kinetis/Makefile.features +++ b/cpu/kinetis/Makefile.features @@ -1,5 +1,18 @@ FEATURES_PROVIDED += periph_cpuid -FEATURES_PROVIDED += periph_hwrng + +# HACK Do not define 'hwrng' if the board does not supports it +# A whitelist on CPU_MODEL would be better but this information/variable is not +# available yet. +# HWRNG uses the wrong hwrng register for the frdm-k64f board/cpu_model +_KINETIS_BOARDS_WITHOUT_HWRNG += frdm-k64f +# TRNG driver is not implemented for 'CPU_MODEL == mkw41z512vht4' +_KINETIS_BOARDS_WITHOUT_HWRNG += frdm-kw41z phynode-kw41z usb-kw41z +# No HWRNG in MK20D7 devices +_KINETIS_BOARDS_WITHOUT_HWRNG += teensy31 +ifneq (,$(filter-out $(_KINETIS_BOARDS_WITHOUT_HWRNG),$(BOARD))) + FEATURES_PROVIDED += periph_hwrng +endif + FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_gpio_irq ifeq (EA,$(KINETIS_SERIES))