1 /* 2 * Copyright 2020-2022 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef _SDMMC_CONFIG_H_ 9 #define _SDMMC_CONFIG_H_ 10 11 #ifdef SD_ENABLED 12 #include "fsl_sd.h" 13 #endif 14 #ifdef MMC_ENABLED 15 #include "fsl_mmc.h" 16 #endif 17 #ifdef SDIO_ENABLED 18 #include "fsl_sdio.h" 19 #endif 20 #include "clock_config.h" 21 #include "fsl_adapter_gpio.h" 22 #include "fsl_sdmmc_host.h" 23 #include "fsl_sdmmc_common.h" 24 25 /******************************************************************************* 26 * Definitions 27 ******************************************************************************/ 28 /* @brief host basic configuration */ 29 #define BOARD_SDMMC_SD_HOST_BASEADDR USDHC0 30 #define BOARD_SDMMC_SD_HOST_IRQ USDHC0_IRQn 31 #define BOARD_SDMMC_MMC_HOST_BASEADDR USDHC0 32 #define BOARD_SDMMC_MMC_HOST_IRQ USDHC0_IRQn 33 #define BOARD_SDMMC_SDIO_HOST_BASEADDR USDHC0 34 #define BOARD_SDMMC_SDIO_HOST_IRQ USDHC0_IRQn 35 /* @brief card detect type 36 * 37 * Note: if you want to use DAT3 as card detect pin, please make sure the DAT3 is pulled down with 100K resistor on 38 * board, it is not suggest to use the internal pull down function, from our test result, internal pull down is too 39 * strong to cover all the card. And please pay attention, DAT3 card detection cannot works during the card access, 40 * since the DAT3 will be used for data transfer, thus the functionality of card detect will be disabled. Using card 41 * detect pin for card detection is recommended. 42 */ 43 #define BOARD_SDMMC_SD_CD_TYPE kSD_DetectCardByHostCD 44 #define BOARD_SDMMC_SD_CARD_DETECT_DEBOUNCE_DELAY_MS (100U) 45 /*! @brief SD power reset */ 46 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_CLOCK_NAME kCLOCK_HsGpio4 47 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_RESET_SOURCE kHSGPIO4_RST_SHIFT_RSTn 48 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_BASE GPIO 49 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_PORT 4 50 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_PIN 0U 51 52 /* the EVK board require mannual tuning for sd, since there is a EMI filter between 595 and card socket which will 53 * affect the standard tuning*/ 54 #define BOARD_SDMMC_SD_TUNING_TYPE 1 55 #define BOARD_SDMMC_SD_IO_VOLTAGE_CONTROL_TYPE kSD_IOVoltageCtrlByGpio 56 57 /* @brief mmc configuration */ 58 #define BOARD_SDMMC_MMC_VCC_SUPPLY kMMC_VoltageWindows270to360 59 #define BOARD_SDMMC_MMC_VCCQ_SUPPLY kMMC_VoltageWindow170to195 60 #define BOARD_SDMMC_MMC_SUPPORT_8_BIT_DATA_WIDTH 1U 61 #define BOARD_SDMMC_MMC_TUNING_TYPE 0 62 #define BOARD_SDMMC_DATA_BUFFER_ALIGN_SIZE (4U) 63 64 /*!@ brief host interrupt priority*/ 65 #define BOARD_SDMMC_SD_HOST_IRQ_PRIORITY (5U) 66 #define BOARD_SDMMC_MMC_HOST_IRQ_PRIORITY (5U) 67 #define BOARD_SDMMC_SDIO_HOST_IRQ_PRIORITY (5U) 68 /*!@brief dma descriptor buffer size */ 69 #define BOARD_SDMMC_HOST_DMA_DESCRIPTOR_BUFFER_SIZE (32U) 70 71 #if defined(__cplusplus) 72 extern "C" { 73 #endif /* __cplusplus */ 74 75 /******************************************************************************* 76 * API 77 ******************************************************************************/ 78 /*! 79 * @brief BOARD SD configurations. 80 * @param card card descriptor 81 * @param cd card detect callback 82 * @param userData user data for callback 83 */ 84 #ifdef SD_ENABLED 85 void BOARD_SD_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, void *userData); 86 #endif 87 88 /*! 89 * @brief BOARD SDIO configurations. 90 * @param card card descriptor 91 * @param cd card detect callback 92 * @param cardInt card interrupt 93 */ 94 #ifdef SDIO_ENABLED 95 void BOARD_SDIO_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, sdio_int_t cardInt); 96 #endif 97 98 /*! 99 * @brief BOARD MMC configurations. 100 * @param card card descriptor 101 * @param cd card detect callback 102 * @param userData user data for callback 103 */ 104 #ifdef MMC_ENABLED 105 void BOARD_MMC_Config(void *card, uint32_t hostIRQPriority); 106 107 #endif 108 109 #if defined(__cplusplus) 110 } 111 #endif /* __cplusplus */ 112 113 #endif /* _BOARD_H_ */ 114