From efbeac79e8d904f27e8cf24d9066c972400e4069 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Oct 2018 17:41:41 -0600 Subject: [PATCH] configs/imxrt1050-evk/src: Previous committed implemented atypical SPI-based MMC/SD card support conditioned on CONFIG_MMCSD. This is, of course, incorrect and interferes with the implementation of correct MMC/SD card support using the correct SDIO-based peripheral. This commit renames that atypical support to *mmcsd_spi* and conditions using that atypical support on CONFIG_MMCSD_SPI with should then not interfere with the correct MMC/SD suppor that can be conditioned on CONFIG_MMCSD_SDIO. --- configs/imxrt1050-evk/src/Makefile | 4 +- configs/imxrt1050-evk/src/imxrt1050-evk.h | 45 +++++++++---------- configs/imxrt1050-evk/src/imxrt_bringup.c | 6 ++- .../src/{imxrt_mmcsd.c => imxrt_mmcsd_spi.c} | 11 +++-- 4 files changed, 36 insertions(+), 30 deletions(-) rename configs/imxrt1050-evk/src/{imxrt_mmcsd.c => imxrt_mmcsd_spi.c} (96%) diff --git a/configs/imxrt1050-evk/src/Makefile b/configs/imxrt1050-evk/src/Makefile index ec30672089..d21e384af1 100644 --- a/configs/imxrt1050-evk/src/Makefile +++ b/configs/imxrt1050-evk/src/Makefile @@ -66,8 +66,8 @@ ifeq ($(CONFIG_IMXRT_LPSPI),y) CSRCS += imxrt_spi.c endif -ifeq ($(CONFIG_MMCSD),y) -CSRCS += imxrt_mmcsd.c +ifeq ($(CONFIG_MMCSD_SPI),y) +CSRCS += imxrt_mmcsd_spi.c endif include $(TOPDIR)/configs/Board.mk diff --git a/configs/imxrt1050-evk/src/imxrt1050-evk.h b/configs/imxrt1050-evk/src/imxrt1050-evk.h index 4819a872ef..ab047ba046 100644 --- a/configs/imxrt1050-evk/src/imxrt1050-evk.h +++ b/configs/imxrt1050-evk/src/imxrt1050-evk.h @@ -157,17 +157,6 @@ * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: imxrt_spidev_initialize - * - * Description: - * Called to configure SPI chip select GPIO pins for the imxrt1050-evk - * board. - * - ****************************************************************************/ - -void weak_function imxrt_spidev_initialize(void); - /**************************************************************************** * Name: imxrt_bringup * @@ -180,6 +169,28 @@ void weak_function imxrt_spidev_initialize(void); int imxrt_bringup(void); #endif +/**************************************************************************** + * Name: imxrt_spidev_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the i.MXRT1050 EVK. + * + ****************************************************************************/ + +void imxrt_spidev_initialize(void); + +/***************************************************************************** + * Name: imxrt_mmcsd_spi_initialize + * + * Description: + * Initialize SPI-based SD card and card detect thread. + * + ****************************************************************************/ + +#ifdef CONFIG_MMCSD_SPI +int imxrt_mmcsd_spi_initialize(int minor) +#endif + /**************************************************************************** * Name: imxrt_autoled_initialize * @@ -198,17 +209,5 @@ int imxrt_bringup(void); void imxrt_autoled_initialize(void); #endif -/**************************************************************************** - * Name: imxrt_spidev_initialize - * - * Description: - * Called to configure SPI chip select GPIO pins for the i.MXRT1050 EVK. - * - ****************************************************************************/ - -#ifdef CONFIG_IMXRT_HAVE_SPI -void imxrt_spidev_initialize(void); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_IMXRT1050_EVK_SRC_IMXRT1050_EVK_H */ diff --git a/configs/imxrt1050-evk/src/imxrt_bringup.c b/configs/imxrt1050-evk/src/imxrt_bringup.c index 5ddc59fbf7..4990ba728d 100644 --- a/configs/imxrt1050-evk/src/imxrt_bringup.c +++ b/configs/imxrt1050-evk/src/imxrt_bringup.c @@ -126,10 +126,12 @@ int imxrt_bringup(void) imxrt_i2c_register(1); #endif -#ifdef CONFIG_MMCSD +#ifdef CONFIG_MMCSD_SPI + /* Initialize SPI-based MMC/SD card support */ + imxrt_spidev_initialize(); - ret = imxrt_mmcsd_initialize(MMCSD_MINOR); + ret = imxrt_mmcsd_spi_initialize(MMCSD_MINOR); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to initialize SD slot %d: %d\n", ret); diff --git a/configs/imxrt1050-evk/src/imxrt_mmcsd.c b/configs/imxrt1050-evk/src/imxrt_mmcsd_spi.c similarity index 96% rename from configs/imxrt1050-evk/src/imxrt_mmcsd.c rename to configs/imxrt1050-evk/src/imxrt_mmcsd_spi.c index 5363f62ef7..fe85077e5e 100644 --- a/configs/imxrt1050-evk/src/imxrt_mmcsd.c +++ b/configs/imxrt1050-evk/src/imxrt_mmcsd_spi.c @@ -1,5 +1,5 @@ /***************************************************************************** - * configs/imxrt/src/imxrt_mmcsd.c + * configs/imxrt/src/imxrt_mmcsd_spi.c * * Copyright (C) 2018 Greg Nutt. All rights reserved. * Author: ivan Ucherdzhiev @@ -49,6 +49,8 @@ #include "chip.h" #include "imxrt_lpspi.h" +#ifdef CONFIG_MMCSD_SPI + /***************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -97,13 +99,14 @@ int imxrt_lpspi1register(struct spi_dev_s *dev, spi_mediachange_t callback, #endif /***************************************************************************** - * Name: imxrt_mmcsd_initialize + * Name: imxrt_mmcsd_spi_initialize * * Description: * Initialize SPI-based SD card and card detect thread. + * ****************************************************************************/ -int imxrt_mmcsd_initialize(int minor) +int imxrt_mmcsd_spi_initialize(int minor) { struct spi_dev_s *spi; int rv; @@ -128,3 +131,5 @@ int imxrt_mmcsd_initialize(int minor) spiinfo("INFO: mmcsd card has been initialized successfully\n"); return OK; } + +#endif /* CONFIG_MMCSD_SPI */ \ No newline at end of file