[U-Boot] [PATCH] SATA: do not auto-initialize during boot

Mike Frysinger vapier at gentoo.org
Thu Dec 11 11:32:29 CET 2008


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.

Along these lines, the "is_sata_supported()" hook is no longer needed, so
scrub it from the tree.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 board/freescale/mpc8536ds/mpc8536ds.c |   11 -----------
 common/cmd_sata.c                     |    7 +++++--
 include/sata.h                        |    2 --
 lib_ppc/board.c                       |   20 --------------------
 4 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c
index 2b17612..ada8020 100644
--- a/board/freescale/mpc8536ds/mpc8536ds.c
+++ b/board/freescale/mpc8536ds/mpc8536ds.c
@@ -582,17 +582,6 @@ get_board_ddr_clk(ulong dummy)
 }
 #endif
 
-int is_sata_supported(void)
-{
-	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-	uint sdrs2_io_sel =
-		(gur->pordevsr & MPC85xx_PORDEVSR_SRDS2_IO_SEL) >> 27;
-	if (sdrs2_io_sel & 0x04)
-		return 0;
-
-	return 1;
-}
-
 int board_eth_init(bd_t *bis)
 {
 #ifdef CONFIG_TSEC_ENET
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index dd6f1d9..7795f39 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)
+static int sata_initialize(void)
 {
 	int rc;
 	int i;
@@ -71,7 +71,9 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		printf("Usage:\n%s\n", cmdtp->usage);
 		return 1;
 	case 2:
-		if (strncmp(argv[1],"inf", 3) == 0) {
+		if (strcmp(argv[1], "init") == 0) {
+			return sata_initialize();
+		} else if (strncmp(argv[1],"inf", 3) == 0) {
 			int i;
 			putc('\n');
 			for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; ++i) {
@@ -186,6 +188,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"
diff --git a/include/sata.h b/include/sata.h
index 57ee9ac..d07ca5a 100644
--- a/include/sata.h
+++ b/include/sata.h
@@ -6,6 +6,4 @@ int scan_sata(int dev);
 ulong sata_read(int dev, ulong blknr, ulong blkcnt, void *buffer);
 ulong sata_write(int dev, ulong blknr, ulong blkcnt, const void *buffer);
 
-int sata_initialize(void);
-
 #endif
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 289a32a..3076824 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -38,9 +38,6 @@
 #if defined(CONFIG_CMD_IDE)
 #include <ide.h>
 #endif
-#if defined(CONFIG_CMD_SATA)
-#include <sata.h>
-#endif
 #if defined(CONFIG_CMD_SCSI)
 #include <scsi.h>
 #endif
@@ -635,16 +632,6 @@ void board_init_f (ulong bootflag)
 	/* NOTREACHED - relocate_code() does not return */
 }
 
-int __is_sata_supported(void)
-{
-	/* For some boards, when sata disabled by the switch, and the
-	 * driver still access the sata registers, the cpu will hangup.
-	 * please define platform specific is_sata_supported() if your
-	 * board have such issue.*/
-	return 1;
-}
-int is_sata_supported(void) __attribute__((weak, alias("__is_sata_supported")));
-
 /************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
@@ -1144,13 +1131,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 #endif
 
-#if defined(CONFIG_CMD_SATA)
-	if (is_sata_supported()) {
-		puts("SATA:  ");
-		sata_initialize();
-	}
-#endif
-
 #ifdef CONFIG_LAST_STAGE_INIT
 	WATCHDOG_RESET ();
 	/*
-- 
1.6.0.4



More information about the U-Boot mailing list