summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-11-24 12:02:12 -0500
committerTom Rini <trini@ti.com>2014-11-24 12:02:12 -0500
commitdee332ffb735f65ab922118791a583c17bb0b795 (patch)
treed07bc0821792831aa4baeb27868252c2d32c7738 /common
parent1739564e753bc3a8097f8937a3cbe738bdaaed5d (diff)
parente7eb277dced570f177d75d56f40219d9dc599ed1 (diff)
downloadu-boot-imx-dee332ffb735f65ab922118791a583c17bb0b795.zip
u-boot-imx-dee332ffb735f65ab922118791a583c17bb0b795.tar.gz
u-boot-imx-dee332ffb735f65ab922118791a583c17bb0b795.tar.bz2
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
Diffstat (limited to 'common')
-rw-r--r--common/cmd_sata.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index fc92131..51f6703 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -48,6 +48,20 @@ int __sata_initialize(void)
}
int sata_initialize(void) __attribute__((weak,alias("__sata_initialize")));
+__weak int __sata_stop(void)
+{
+ int i, err = 0;
+
+ for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++)
+ err |= reset_sata(i);
+
+ if (err)
+ printf("Could not reset some SATA devices\n");
+
+ return err;
+}
+int sata_stop(void) __attribute__((weak, alias("__sata_stop")));
+
#ifdef CONFIG_PARTITIONS
block_dev_desc_t *sata_get_dev(int dev)
{
@@ -59,8 +73,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int rc = 0;
- if (argc == 2 && strcmp(argv[1], "init") == 0)
+ if (argc == 2 && strcmp(argv[1], "stop") == 0)
+ return sata_stop();
+
+ if (argc == 2 && strcmp(argv[1], "init") == 0) {
+ if (sata_curr_device != -1)
+ sata_stop();
+
return sata_initialize();
+ }
/* If the user has not yet run `sata init`, do it now */
if (sata_curr_device == -1)
@@ -185,6 +206,7 @@ U_BOOT_CMD(
sata, 5, 1, do_sata,
"SATA sub system",
"init - init SATA sub system\n"
+ "sata stop - disable SATA sub system\n"
"sata info - show available SATA devices\n"
"sata device [dev] - show or set current device\n"
"sata part [dev] - print partition table\n"