1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd: fix Kconfig dependencies

Currently implementations of the MTD api are selecting the module,
this makes it easy for default backends to be selected. But the
correct modeling is simply selecting the MTD api and then selecting
a backend. BOARDs providing one of the backends can expose this and
then that backend can be selected by default.

There is also currently nothing preventing from using the MTD api
with no backend since a mock backend can easily be provided as is
done in all mtd tests.
This commit is contained in:
Francisco Molina 2021-09-22 09:22:51 +02:00
parent af746208dc
commit 14ef09b8b4
13 changed files with 89 additions and 95 deletions

View File

@ -21,6 +21,7 @@ config CPU_ARCH_NATIVE
select HAS_PERIPH_PWM
select HAS_PERIPH_TIMER_PERIODIC
select HAS_SSP
select HAVE_MTD_NATIVE
# needed modules
select MODULE_PERIPH if TEST_KCONFIG
@ -88,5 +89,4 @@ rsource "backtrace/Kconfig"
endmenu # Native modules
rsource "mtd/Kconfig"
rsource "periph/Kconfig"

View File

@ -1,12 +0,0 @@
# Copyright (c) 2021 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_NATIVE
bool
default y if MODULE_MTD
depends on NATIVE_OS_LINUX
depends on TEST_KCONFIG

View File

@ -144,11 +144,8 @@ menu "Storage Device Drivers"
rsource "at24cxxx/Kconfig"
rsource "at25xxx/Kconfig"
rsource "mtd/Kconfig"
rsource "mtd_flashpage/Kconfig"
rsource "mtd_mapper/Kconfig"
rsource "mtd_mci/Kconfig"
rsource "mtd_sdcard/Kconfig"
rsource "mtd_spi_nor/Kconfig"
rsource "nvram/Kconfig"
rsource "nvram_spi/Kconfig"
rsource "sdcard_spi/Kconfig"

View File

@ -63,7 +63,6 @@ config MODULE_AT24CXXX
bool
depends on HAS_PERIPH_I2C
depends on TEST_KCONFIG
select HAVE_MTD_AT24CXXX
select MODULE_PERIPH_I2C
select MODULE_XTIMER
rsource "mtd/Kconfig"

View File

@ -1,13 +0,0 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_AT24CXXX
bool "MTD implementation for AT24CXXX"
default y
depends on MODULE_AT24CXXX
depends on MODULE_MTD
depends on TEST_KCONFIG

View File

@ -9,10 +9,9 @@ config MODULE_AT25XXX
bool "AT25xxx SPI-EEPROMs"
depends on HAS_PERIPH_SPI
depends on TEST_KCONFIG
select HAVE_MTD_AT25XXX
select MODULE_PERIPH_SPI
select MODULE_XTIMER
help
This driver also supports M95xxx, 25AAxxx, 25LCxxx, CAT25xxx & BR25Sxxx
families.
rsource "mtd/Kconfig"

View File

@ -1,12 +0,0 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_AT25XXX
bool "MTD implementation for AT25XXX"
depends on MODULE_AT25XXX
depends on MODULE_MTD
depends on TEST_KCONFIG

View File

@ -5,6 +5,90 @@
# directory for more details.
#
config MODULE_MTD
config HAVE_MTD_AT24CXXX
bool
depends on MODULE_AT24CXXX
select MODULE_MTD_AT24CXXX if MODULE_MTD
help
Indicates that a at24cxxx EEPROM MTD is present
config HAVE_MTD_AT25XXX
bool
depends on MODULE_AT25XXX
select MODULE_MTD_AT25XXX if MODULE_MTD
help
Indicates that a at25xxx SPI-EEPROM MTD is present
config HAVE_MTD_NATIVE
bool
select MODULE_MTD_NATIVE if MODULE_MTD
help
Indicates that a native MTD is present.
config HAVE_MTD_SD_SCARD
bool
select MODULE_MTD_SD_CARD if MODULE_MTD
help
Indicates that a sdcard MTD is present
config HAVE_MTD_SPI_NOR
bool
select MODULE_MTD_SPI_NOR if MODULE_MTD
help
Indicates that a spi-nor MTD is present
config HAVE_MTD_SPI_MCI
bool
select MODULE_MTD_MCI if MODULE_MTD
help
Indicates that a Multimedia Card Interface (MCI) MTD is present
menuconfig MODULE_MTD
bool "Memory Technology Device interface (MTD)"
depends on TEST_KCONFIG
if MODULE_MTD
menu "MTD Interefaces"
config MODULE_MTD_SPI_NOR
bool "MTD interface for SPI NOR Flash"
depends on HAS_PERIPH_SPI
select MODULE_PERIPH_SPI
config MODULE_MTD_FLASHPAGE
bool "MTD interface for Flashpage"
depends on HAS_PERIPH_FLASHPAGE
depends on HAS_PERIPH_FLASHPAGE_PAGEWISE
select MODULE_PERIPH_FLASHPAGE
select MODULE_PERIPH_FLASHPAGE_PAGEWISE
help
Driver for internal flash devices implementing flashpage interface.
config MODULE_MTD_NATIVE
bool "MTD native driver"
depends on NATIVE_OS_LINUX
config MODULE_MTD_AT24CXXX
bool "MTD implementation for AT24CXXX"
depends on MODULE_AT24CXXX
config MODULE_MTD_AT25XXX
bool "MTD implementation for AT25XXX"
depends on MODULE_AT25XXX
config MODULE_MTD_MCI
bool "MTD interface for LPC23XX MCI"
depends on CPU_FAM_LPC23XX
select MODULE_MCI
config MODULE_MTD_SDCARD
bool "MTD interface for SPI SD-Card"
depends on MODULE_SDCARD_SPI
endmenu # MTD Interfacs
config MODULE_MTD_WRITE_PAGE
bool "MTD write page API"
endif

View File

@ -1,17 +0,0 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_FLASHPAGE
bool "MTD interface for Flashpage"
depends on HAS_PERIPH_FLASHPAGE
depends on HAS_PERIPH_FLASHPAGE_PAGEWISE
depends on TEST_KCONFIG
select MODULE_PERIPH_FLASHPAGE
select MODULE_PERIPH_FLASHPAGE_PAGEWISE
select MODULE_MTD
help
Driver for internal flash devices implementing flashpage interface.

View File

@ -1,12 +0,0 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_MCI
bool "MTD interface for LPC23XX MCI"
depends on TEST_KCONFIG
depends on MODULE_MCI
select MODULE_MTD

View File

@ -5,13 +5,6 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_SDCARD
bool "MTD interface for SPI SD-Card"
depends on MODULE_SDCARD_SPI
depends on TEST_KCONFIG
select MODULE_MTD
menuconfig KCONFIG_USEMODULE_MTD_SDCARD
bool "Configure MTD_SDCARD driver"
depends on USEMODULE_MTD_SDCARD

View File

@ -1,13 +0,0 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_MTD_SPI_NOR
bool "MTD interface for SPI NOR Flash"
depends on HAS_PERIPH_SPI
depends on TEST_KCONFIG
select MODULE_PERIPH_SPI
select MODULE_MTD

View File

@ -1,4 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_MTD=y
CONFIG_MODULE_MTD_FLASHPAGE=y
CONFIG_MODULE_EMBUNIT=y