Kconfig: Add CONFIG_SATA to enable SATA

At present CONFIG_CMD_SATA enables the 'sata' command which also brings
in SATA support. Some boards may wish to enable SATA without the command.
Add a separate CONFIG to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/api/api_storage.c b/api/api_storage.c
index 8bed2f3..6fc6f44 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -63,7 +63,7 @@
 	specs[ENUM_MMC].type = DEV_TYP_STOR | DT_STOR_MMC;
 	specs[ENUM_MMC].name = "mmc";
 #endif
-#if defined(CONFIG_CMD_SATA)
+#if defined(CONFIG_SATA)
 	specs[ENUM_SATA].max_dev = CONFIG_SYS_SATA_MAX_DEVICE;
 	specs[ENUM_SATA].enum_started = 0;
 	specs[ENUM_SATA].enum_ended = 0;
diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index 84bc213..1f2739e 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -1042,7 +1042,7 @@
 	return mxc_get_clock(MXC_IPG_CLK);
 }
 
-#if defined(CONFIG_CMD_SATA) || defined(CONFIG_PCIE_IMX)
+#if defined(CONFIG_SATA) || defined(CONFIG_PCIE_IMX)
 static int enable_enet_pll(uint32_t en)
 {
 	struct mxc_ccm_reg *const imx_ccm
@@ -1069,7 +1069,7 @@
 }
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 static void ungate_sata_clock(void)
 {
 	struct mxc_ccm_reg *const imx_ccm =
@@ -1143,7 +1143,7 @@
 	clrbits_le32(&ccm_regs->cbcmr, MXC_CCM_CBCMR_PCIE_AXI_CLK_SEL);
 
 	/* Party time! Ungate the clock to the PCIe. */
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	ungate_sata_clock();
 #endif
 	ungate_pcie_clock();
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index b7cb434..fc69172 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -25,7 +25,7 @@
 endif
 ifeq ($(SOC),$(filter $(SOC),mx6 mx7))
 obj-y 	+= cache.o init.o
-obj-$(CONFIG_CMD_SATA) += sata.o
+obj-$(CONFIG_SATA) += sata.o
 obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
 obj-$(CONFIG_IMX_RDC) += rdc-sema.o
 obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 74bdd24..9e83b42 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -278,7 +278,7 @@
 #if defined(CONFIG_PCIE_IMX)
 	imx_pcie_remove();
 #endif
-#if defined(CONFIG_CMD_SATA)
+#if defined(CONFIG_SATA)
 	sata_stop();
 #if defined(CONFIG_MX6)
 	disable_sata_clock();
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index f5bf67c..388fe2b 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -1024,7 +1024,7 @@
 	mtmsr(msr);
 }
 
-#if defined(CONFIG_CMD_SATA) && defined(CONFIG_FSL_SATA)
+#if defined(CONFIG_SATA) && defined(CONFIG_FSL_SATA)
 int sata_initialize(void)
 {
 	if (is_serdes_configured(SATA1) || is_serdes_configured(SATA2))
diff --git a/board/advantech/dms-ba16/dms-ba16.c b/board/advantech/dms-ba16/dms-ba16.c
index 91e96ab..2dab906 100644
--- a/board/advantech/dms-ba16/dms-ba16.c
+++ b/board/advantech/dms-ba16/dms-ba16.c
@@ -609,7 +609,7 @@
 	pwm_enable(0);
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_ba16_sata();
 #endif
 
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index c0a8b64..74f652e 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -338,7 +338,7 @@
 
 	leds_on();
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index ab8b2be..1145af5 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -903,7 +903,7 @@
 	setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
 	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 24956a8..fe7db91 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -702,7 +702,7 @@
 	else
 		setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info1);
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 6b950ee..40ee1b6 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -633,7 +633,7 @@
 #endif
 	setup_ventana_i2c();
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 	/* read Gateworks EEPROM into global struct (used later) */
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index f6972c2..17c2b13 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -167,7 +167,7 @@
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 7c49ddf..166b93f 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -784,7 +784,7 @@
 	(void) pmic_init();
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index 69467ca..87e2447 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -657,7 +657,7 @@
 	(void) pmic_init();
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index eb7ab65..d2cbbaa 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -244,7 +244,7 @@
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	if (is_cpu_type(MXC_CPU_MX6Q))
 		setup_sata();
 #endif
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 2c9dc8b..438bc0e 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -379,7 +379,7 @@
 #if defined(CONFIG_VIDEO_IPUV3)
 	setup_display();
 #endif
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	/* Only mx6q wandboard has SATA */
 	if (is_cpu_type(MXC_CPU_MX6Q))
 		setup_sata();
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 90d9337..c80ac36 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -736,6 +736,7 @@
 
 config CMD_SATA
 	bool "sata - Access SATA subsystem"
+	select SATA
 	help
 	  SATA (Serial Advanced Technology Attachment) is a serial bus
 	  standard for connecting to hard drives and other storage devices.
diff --git a/common/Makefile b/common/Makefile
index 8540fbc..fdf5c31 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -79,7 +79,7 @@
 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
 obj-$(CONFIG_MENU) += menu.o
-obj-$(CONFIG_CMD_SATA) += sata.o
+obj-$(CONFIG_SATA) += sata.o
 obj-$(CONFIG_SCSI) += scsi.o
 obj-$(CONFIG_UPDATE_TFTP) += update.o
 obj-$(CONFIG_DFU_TFTP) += update.o
diff --git a/common/splash_source.c b/common/splash_source.c
index d1647c8..ee055dd 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -162,7 +162,7 @@
 }
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 static int splash_init_sata(void)
 {
 	return sata_initialize();
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 4c2aaa0..ed7fa88 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -19,6 +19,19 @@
 	  operations at present. The block device interface has not been converted
 	  to driver model.
 
+config SATA
+	bool "Support SATA controllers"
+	help
+	  This enables support for SATA (Serial Advanced Technology
+	  Attachment), a serial bus standard for connecting to hard drives and
+	  other storage devices.
+
+	  SATA replaces PATA (originally just ATA), which stands for Parallel AT
+	  Attachment, where AT refers to an IBM AT (Advanced Technology)
+	  computer released in 1984.
+
+	  See also CMD_SATA which provides command-line support.
+
 config SCSI
 	bool "Support SCSI controllers"
 	help
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index a71bad1..9ad18f9 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -1251,7 +1251,7 @@
 	}
 
 #if defined(CONFIG_IDE) || \
-    defined(CONFIG_CMD_SATA) || \
+    defined(CONFIG_SATA) || \
     defined(CONFIG_SCSI) || \
     defined(CONFIG_CMD_USB) || \
     defined(CONFIG_MMC)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 4b2c493..d8dab8e 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -149,16 +149,16 @@
 #define SCAN_DEV_FOR_EFI
 #endif
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV_NAME_SATA	BOOTENV_DEV_NAME_BLKDEV
 #else
 #define BOOTENV_SHARED_SATA
 #define BOOTENV_DEV_SATA \
-	BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
+	BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
 #define BOOTENV_DEV_NAME_SATA \
-	BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
+	BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
 #endif
 
 #ifdef CONFIG_SCSI
diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index 2656c75..d1411f0 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -48,7 +48,7 @@
 
 /* Rather than repeat this expression each time, add a define for it */
 #if defined(CONFIG_IDE) || \
-	defined(CONFIG_CMD_SATA) || \
+	defined(CONFIG_SATA) || \
 	defined(CONFIG_SCSI) || \
 	defined(CONFIG_CMD_USB) || \
 	defined(CONFIG_CMD_PART) || \