From f4c23e8393ebaae255eba20ef9c5538cc3a077c2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Wed, 20 Sep 2023 12:59:19 +0200 Subject: [PATCH] boards: complete SD Card MTD definition --- boards/common/esp32x/include/board_common.h | 12 ++++++++---- boards/seeedstudio-gd32/include/board.h | 19 +++++++++++++++++++ boards/sipeed-longan-nano/include/board.h | 15 +++++++++++++-- .../include/board.h | 9 +++++++++ 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/boards/common/esp32x/include/board_common.h b/boards/common/esp32x/include/board_common.h index ca5a074d1ec88..684f13a6638a6 100644 --- a/boards/common/esp32x/include/board_common.h +++ b/boards/common/esp32x/include/board_common.h @@ -103,11 +103,15 @@ extern "C" { #define SPI_FLASH_DRIVE_START 0 #endif -/** Default MTD drive definition */ -#define MTD_0 mtd0 +#define MTD_0 mtd0 /**< Flash MTD device */ +extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */ -/** Pointer to the default MTD drive structure */ -extern mtd_dev_t *mtd0; +#if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN + +#define MTD_1 mtd1 /**< SD Card MTD device */ +extern mtd_dev_t *mtd1; /**< SD Card MTD device pointer */ + +#endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */ /** * @brief MTD offset for SD Card interfaces diff --git a/boards/seeedstudio-gd32/include/board.h b/boards/seeedstudio-gd32/include/board.h index c48afec589da2..e8e30c4b74cb6 100644 --- a/boards/seeedstudio-gd32/include/board.h +++ b/boards/seeedstudio-gd32/include/board.h @@ -67,6 +67,25 @@ extern "C" { #define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */ /** @} */ +/** + * @name MTD configuration + * @{ + */ +#define MTD_0 mtd0 /**< MTD device for SD Card */ +extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +/** @} */ + +/** + * @name SD-Card interface configuration + * @{ + */ +#define SDCARD_SPI_PARAM_SPI SPI_DEV(0) +#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12) +#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13) +#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14) +#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15) +/** @} */ + #ifdef __cplusplus } #endif diff --git a/boards/sipeed-longan-nano/include/board.h b/boards/sipeed-longan-nano/include/board.h index 10e099ea397c7..e01e573c139c1 100644 --- a/boards/sipeed-longan-nano/include/board.h +++ b/boards/sipeed-longan-nano/include/board.h @@ -62,13 +62,24 @@ extern "C" { #define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */ /** @} */ -#if defined(MODULE_SDCARD_SPI) +/** + * @name MTD configuration + * @{ + */ +#define MTD_0 mtd0 /**< MTD device for SD Card */ +extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +/** @} */ + +/** + * @name SD-Card interface configuration + * @{ + */ #define SDCARD_SPI_PARAM_SPI SPI_DEV(0) #define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12) #define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13) #define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14) #define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15) -#endif +/** @} */ #if defined(MODULE_ST7735) && defined(BOARD_SIPEED_LONGAN_NANO_TFT) #define ST7735_PARAM_SPI SPI_DEV(1) /**< SPI device */ diff --git a/boards/waveshare-nrf52840-eval-kit/include/board.h b/boards/waveshare-nrf52840-eval-kit/include/board.h index 7b75988315875..8f55b3aa95a84 100644 --- a/boards/waveshare-nrf52840-eval-kit/include/board.h +++ b/boards/waveshare-nrf52840-eval-kit/include/board.h @@ -20,6 +20,7 @@ #define BOARD_H #include "board_common.h" +#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -82,6 +83,14 @@ extern "C" { #define SDCARD_SPI_PARAM_MISO GPIO_PIN(0, 20) /** @} */ +/** + * @name MTD configuration + * @{ + */ +#define MTD_0 mtd0 /**< MTD device for SD Card */ +extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +/** @} */ + #ifdef __cplusplus } #endif