summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-01-27 16:12:21 -0500
committerWolfgang Denk <wd@denx.de>2009-01-27 23:42:39 +0100
commitcf7e399fb35b3aea90a27d1df72f45f5d6156204 (patch)
tree63add98351b9cef8c16b0a8f6d293ca3b3db3fdd /common
parent50970839712dda35399e2fa83fe818df9354d618 (diff)
downloadu-boot-imx-cf7e399fb35b3aea90a27d1df72f45f5d6156204.zip
u-boot-imx-cf7e399fb35b3aea90a27d1df72f45f5d6156204.tar.gz
u-boot-imx-cf7e399fb35b3aea90a27d1df72f45f5d6156204.tar.bz2
SATA: do not auto-initialize during boot
Rather than have the board code initialize SATA automatically during boot, make the user manually run "sata init". This brings the SATA subsystem in line with common U-Boot policy. Rather than having a dedicated weak function "is_sata_supported", people can override sata_initialize() to do their weird board stuff. Then they can call the actual __sata_initialize(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_sata.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index dd6f1d9..c6e0d37 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -31,7 +31,7 @@
int curr_device = -1;
block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
-int sata_initialize(void)
+int __sata_initialize(void)
{
int rc;
int i;
@@ -55,6 +55,7 @@ int sata_initialize(void)
curr_device = 0;
return rc;
}
+int sata_initialize(void) __attribute__((weak,alias("__sata_initialize")));
block_dev_desc_t *sata_get_dev(int dev)
{
@@ -65,6 +66,14 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rc = 0;
+ if (argc == 2 && strcmp(argv[1], "init") == 0)
+ return sata_initialize();
+
+ /* If the user has not yet run `sata init`, do it now */
+ if (curr_device == -1)
+ if (sata_initialize())
+ return 1;
+
switch (argc) {
case 0:
case 1:
@@ -186,6 +195,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
U_BOOT_CMD(
sata, 5, 1, do_sata,
"sata - SATA sub system\n",
+ "init - init 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"