diff mbox series

[U-Boot,v3,4/6] cmd: Remove mmc_spi command

Message ID 20190708041004.6252-5-anup.patel@wdc.com
State Superseded
Delegated to: Peng Fan
Headers show
Series SiFive SPI MMC Support | expand

Commit Message

Anup Patel July 8, 2019, 4:10 a.m. UTC
The mmc_spi command was added to manually setup MMC over SPI bus
using command. This was required by the legacy non-DM MMC_SPI driver.

With DM based MMC_SPI driver in-place, we can now use all general
storge commands and mmc command for MMC over SPI bus hence we remove
the mmc_spi command all it's references.

Suggested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 cmd/Kconfig                        |  9 ---
 cmd/Makefile                       |  1 -
 cmd/mmc_spi.c                      | 88 ------------------------------
 configs/UCP1020_SPIFLASH_defconfig |  1 -
 configs/UCP1020_defconfig          |  1 -
 include/configs/UCP1020.h          |  1 -
 include/mmc.h                      |  1 -
 7 files changed, 102 deletions(-)
 delete mode 100644 cmd/mmc_spi.c

Comments

Bin Meng July 8, 2019, 5:58 a.m. UTC | #1
On Mon, Jul 8, 2019 at 12:10 PM Anup Patel <Anup.Patel@wdc.com> wrote:
>
> The mmc_spi command was added to manually setup MMC over SPI bus
> using command. This was required by the legacy non-DM MMC_SPI driver.
>
> With DM based MMC_SPI driver in-place, we can now use all general
> storge commands and mmc command for MMC over SPI bus hence we remove
> the mmc_spi command all it's references.
>
> Suggested-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  cmd/Kconfig                        |  9 ---
>  cmd/Makefile                       |  1 -
>  cmd/mmc_spi.c                      | 88 ------------------------------
>  configs/UCP1020_SPIFLASH_defconfig |  1 -
>  configs/UCP1020_defconfig          |  1 -
>  include/configs/UCP1020.h          |  1 -
>  include/mmc.h                      |  1 -
>  7 files changed, 102 deletions(-)
>  delete mode 100644 cmd/mmc_spi.c
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Peng Fan July 15, 2019, 7:06 a.m. UTC | #2
> Subject: [PATCH v3 4/6] cmd: Remove mmc_spi command
> 
> The mmc_spi command was added to manually setup MMC over SPI bus
> using command. This was required by the legacy non-DM MMC_SPI driver.
> 
> With DM based MMC_SPI driver in-place, we can now use all general storge
> commands and mmc command for MMC over SPI bus hence we remove the
> mmc_spi command all it's references.
> 
> Suggested-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  cmd/Kconfig                        |  9 ---
>  cmd/Makefile                       |  1 -
>  cmd/mmc_spi.c                      | 88 ------------------------------
>  configs/UCP1020_SPIFLASH_defconfig |  1 -
>  configs/UCP1020_defconfig          |  1 -
>  include/configs/UCP1020.h          |  1 -
>  include/mmc.h                      |  1 -
>  7 files changed, 102 deletions(-)
>  delete mode 100644 cmd/mmc_spi.c
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 0badcb3fe0..2cdde28cbe 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -925,15 +925,6 @@ config CMD_NVME
>  	help
>  	  NVM Express device support
> 
> -config CMD_MMC_SPI
> -	bool "mmc_spi - Set up MMC SPI device"
> -	help
> -	  Provides a way to set up an MMC (Multimedia Card) SPI (Serial
> -	  Peripheral Interface) device. The device provides a means of
> -	  accessing an MMC device via SPI using a single data line, limited
> -	  to 20MHz. It is useful since it reduces the amount of protocol code
> -	  required.
> -
>  config CMD_ONENAND
>  	bool "onenand - access to onenand device"
>  	help
> diff --git a/cmd/Makefile b/cmd/Makefile index f982564ab9..9fc8df9004
> 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -92,7 +92,6 @@ obj-$(CONFIG_CMD_MII) += mdio.o  endif
>  obj-$(CONFIG_CMD_MISC) += misc.o
>  obj-$(CONFIG_CMD_MMC) += mmc.o
> -obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o
>  obj-$(CONFIG_MP) += mp.o
>  obj-$(CONFIG_CMD_MTD) += mtd.o
>  obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o diff --git a/cmd/mmc_spi.c
> b/cmd/mmc_spi.c deleted file mode 100644 index 0c44d06817..0000000000
> --- a/cmd/mmc_spi.c
> +++ /dev/null
> @@ -1,88 +0,0 @@
> -/*
> - * Command for mmc_spi setup.
> - *
> - * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> - * Licensed under the GPL-2 or later.
> - */
> -
> -#include <common.h>
> -#include <mmc.h>
> -#include <spi.h>
> -
> -#ifndef CONFIG_MMC_SPI_BUS
> -# define CONFIG_MMC_SPI_BUS 0
> -#endif
> -#ifndef CONFIG_MMC_SPI_CS
> -# define CONFIG_MMC_SPI_CS 1
> -#endif
> -/* in SPI mode, MMC speed limit is 20MHz, while SD speed limit is 25MHz */
> -#ifndef CONFIG_MMC_SPI_SPEED -# define CONFIG_MMC_SPI_SPEED
> 25000000 -#endif
> -/* MMC and SD specs only seem to care that sampling is on the
> - * rising edge ... meaning SPI modes 0 or 3.  So either SPI mode
> - * should be legit.  We'll use mode 0 since the steady state is 0,
> - * which is appropriate for hotplugging, unless the platform data
> - * specify mode 3 (if hardware is not compatible to mode 0).
> - */
> -#ifndef CONFIG_MMC_SPI_MODE
> -# define CONFIG_MMC_SPI_MODE SPI_MODE_0 -#endif
> -
> -static int do_mmc_spi(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[]) -{
> -	uint bus = CONFIG_MMC_SPI_BUS;
> -	uint cs = CONFIG_MMC_SPI_CS;
> -	uint speed = CONFIG_MMC_SPI_SPEED;
> -	uint mode = CONFIG_MMC_SPI_MODE;
> -	char *endp;
> -	struct mmc *mmc;
> -
> -	if (argc < 2)
> -		goto usage;
> -
> -	cs = simple_strtoul(argv[1], &endp, 0);
> -	if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
> -		goto usage;
> -	if (*endp == ':') {
> -		if (endp[1] == 0)
> -			goto usage;
> -		bus = cs;
> -		cs = simple_strtoul(endp + 1, &endp, 0);
> -		if (*endp != 0)
> -			goto usage;
> -	}
> -	if (argc >= 3) {
> -		speed = simple_strtoul(argv[2], &endp, 0);
> -		if (*argv[2] == 0 || *endp != 0)
> -			goto usage;
> -	}
> -	if (argc >= 4) {
> -		mode = simple_strtoul(argv[3], &endp, 16);
> -		if (*argv[3] == 0 || *endp != 0)
> -			goto usage;
> -	}
> -	if (!spi_cs_is_valid(bus, cs)) {
> -		printf("Invalid SPI bus %u cs %u\n", bus, cs);
> -		return 1;
> -	}
> -
> -	mmc = mmc_spi_init(bus, cs, speed, mode);
> -	if (!mmc) {
> -		printf("Failed to create MMC Device\n");
> -		return 1;
> -	}
> -	printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name,
> -	       mmc->block_dev.devnum, bus, cs, speed, mode);
> -	mmc_init(mmc);
> -	return 0;
> -
> -usage:
> -	return CMD_RET_USAGE;
> -}
> -
> -U_BOOT_CMD(
> -	mmc_spi,	4,	0,	do_mmc_spi,
> -	"mmc_spi setup",
> -	"[bus:]cs [hz] [mode]	- setup mmc_spi device"
> -);
> diff --git a/configs/UCP1020_SPIFLASH_defconfig
> b/configs/UCP1020_SPIFLASH_defconfig
> index a2d7e6622a..cb8ed47f5b 100644
> --- a/configs/UCP1020_SPIFLASH_defconfig
> +++ b/configs/UCP1020_SPIFLASH_defconfig
> @@ -21,7 +21,6 @@ CONFIG_CMD_GPIO=y
>  CONFIG_CMD_I2C=y
>  CONFIG_CMD_MMC=y
>  # CONFIG_CMD_NAND is not set
> -CONFIG_CMD_MMC_SPI=y
>  CONFIG_CMD_SF=y
>  CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
> diff --git a/configs/UCP1020_defconfig b/configs/UCP1020_defconfig index
> 0a676d48c9..a0ffd35c3a 100644
> --- a/configs/UCP1020_defconfig
> +++ b/configs/UCP1020_defconfig
> @@ -21,7 +21,6 @@ CONFIG_CMD_GPIO=y
>  CONFIG_CMD_I2C=y
>  CONFIG_CMD_MMC=y
>  # CONFIG_CMD_NAND is not set
> -CONFIG_CMD_MMC_SPI=y
>  CONFIG_CMD_SF=y
>  CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
> diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h index
> b518c222d4..6e0a6a11b3 100644
> --- a/include/configs/UCP1020.h
> +++ b/include/configs/UCP1020.h
> @@ -386,7 +386,6 @@
> 
>  #ifdef CONFIG_MMC
>  #define CONFIG_SYS_FSL_ESDHC_ADDR
> 	CONFIG_SYS_MPC85xx_ESDHC_ADDR
> -#define CONFIG_MMC_SPI
>  #endif
> 
>  /* Misc Extra Settings */
> diff --git a/include/mmc.h b/include/mmc.h index 1f30f71d25..b854e9f33a
> 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -828,7 +828,6 @@ void mmc_set_preinit(struct mmc *mmc, int preinit);
> #else
>  #define mmc_host_is_spi(mmc)	0
>  #endif
> -struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
> 
>  void board_mmc_power_init(void);
>  int board_mmc_init(bd_t *bis);

Applied to mmc/master after fix conflicts rebasing.

Thanks,
Peng.

> --
> 2.17.1
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0badcb3fe0..2cdde28cbe 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -925,15 +925,6 @@  config CMD_NVME
 	help
 	  NVM Express device support
 
-config CMD_MMC_SPI
-	bool "mmc_spi - Set up MMC SPI device"
-	help
-	  Provides a way to set up an MMC (Multimedia Card) SPI (Serial
-	  Peripheral Interface) device. The device provides a means of
-	  accessing an MMC device via SPI using a single data line, limited
-	  to 20MHz. It is useful since it reduces the amount of protocol code
-	  required.
-
 config CMD_ONENAND
 	bool "onenand - access to onenand device"
 	help
diff --git a/cmd/Makefile b/cmd/Makefile
index f982564ab9..9fc8df9004 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -92,7 +92,6 @@  obj-$(CONFIG_CMD_MII) += mdio.o
 endif
 obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MMC) += mmc.o
-obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o
 obj-$(CONFIG_MP) += mp.o
 obj-$(CONFIG_CMD_MTD) += mtd.o
 obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o
diff --git a/cmd/mmc_spi.c b/cmd/mmc_spi.c
deleted file mode 100644
index 0c44d06817..0000000000
--- a/cmd/mmc_spi.c
+++ /dev/null
@@ -1,88 +0,0 @@ 
-/*
- * Command for mmc_spi setup.
- *
- * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <mmc.h>
-#include <spi.h>
-
-#ifndef CONFIG_MMC_SPI_BUS
-# define CONFIG_MMC_SPI_BUS 0
-#endif
-#ifndef CONFIG_MMC_SPI_CS
-# define CONFIG_MMC_SPI_CS 1
-#endif
-/* in SPI mode, MMC speed limit is 20MHz, while SD speed limit is 25MHz */
-#ifndef CONFIG_MMC_SPI_SPEED
-# define CONFIG_MMC_SPI_SPEED 25000000
-#endif
-/* MMC and SD specs only seem to care that sampling is on the
- * rising edge ... meaning SPI modes 0 or 3.  So either SPI mode
- * should be legit.  We'll use mode 0 since the steady state is 0,
- * which is appropriate for hotplugging, unless the platform data
- * specify mode 3 (if hardware is not compatible to mode 0).
- */
-#ifndef CONFIG_MMC_SPI_MODE
-# define CONFIG_MMC_SPI_MODE SPI_MODE_0
-#endif
-
-static int do_mmc_spi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	uint bus = CONFIG_MMC_SPI_BUS;
-	uint cs = CONFIG_MMC_SPI_CS;
-	uint speed = CONFIG_MMC_SPI_SPEED;
-	uint mode = CONFIG_MMC_SPI_MODE;
-	char *endp;
-	struct mmc *mmc;
-
-	if (argc < 2)
-		goto usage;
-
-	cs = simple_strtoul(argv[1], &endp, 0);
-	if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
-		goto usage;
-	if (*endp == ':') {
-		if (endp[1] == 0)
-			goto usage;
-		bus = cs;
-		cs = simple_strtoul(endp + 1, &endp, 0);
-		if (*endp != 0)
-			goto usage;
-	}
-	if (argc >= 3) {
-		speed = simple_strtoul(argv[2], &endp, 0);
-		if (*argv[2] == 0 || *endp != 0)
-			goto usage;
-	}
-	if (argc >= 4) {
-		mode = simple_strtoul(argv[3], &endp, 16);
-		if (*argv[3] == 0 || *endp != 0)
-			goto usage;
-	}
-	if (!spi_cs_is_valid(bus, cs)) {
-		printf("Invalid SPI bus %u cs %u\n", bus, cs);
-		return 1;
-	}
-
-	mmc = mmc_spi_init(bus, cs, speed, mode);
-	if (!mmc) {
-		printf("Failed to create MMC Device\n");
-		return 1;
-	}
-	printf("%s: %d at %u:%u hz %u mode %u\n", mmc->cfg->name,
-	       mmc->block_dev.devnum, bus, cs, speed, mode);
-	mmc_init(mmc);
-	return 0;
-
-usage:
-	return CMD_RET_USAGE;
-}
-
-U_BOOT_CMD(
-	mmc_spi,	4,	0,	do_mmc_spi,
-	"mmc_spi setup",
-	"[bus:]cs [hz] [mode]	- setup mmc_spi device"
-);
diff --git a/configs/UCP1020_SPIFLASH_defconfig b/configs/UCP1020_SPIFLASH_defconfig
index a2d7e6622a..cb8ed47f5b 100644
--- a/configs/UCP1020_SPIFLASH_defconfig
+++ b/configs/UCP1020_SPIFLASH_defconfig
@@ -21,7 +21,6 @@  CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_NAND is not set
-CONFIG_CMD_MMC_SPI=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
diff --git a/configs/UCP1020_defconfig b/configs/UCP1020_defconfig
index 0a676d48c9..a0ffd35c3a 100644
--- a/configs/UCP1020_defconfig
+++ b/configs/UCP1020_defconfig
@@ -21,7 +21,6 @@  CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_NAND is not set
-CONFIG_CMD_MMC_SPI=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h
index b518c222d4..6e0a6a11b3 100644
--- a/include/configs/UCP1020.h
+++ b/include/configs/UCP1020.h
@@ -386,7 +386,6 @@ 
 
 #ifdef CONFIG_MMC
 #define CONFIG_SYS_FSL_ESDHC_ADDR	CONFIG_SYS_MPC85xx_ESDHC_ADDR
-#define CONFIG_MMC_SPI
 #endif
 
 /* Misc Extra Settings */
diff --git a/include/mmc.h b/include/mmc.h
index 1f30f71d25..b854e9f33a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -828,7 +828,6 @@  void mmc_set_preinit(struct mmc *mmc, int preinit);
 #else
 #define mmc_host_is_spi(mmc)	0
 #endif
-struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
 
 void board_mmc_power_init(void);
 int board_mmc_init(bd_t *bis);