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

2009-01-27 Thread Wolfgang Denk
Dear Mike Frysinger,

In message 1230009039-20117-1-git-send-email-vap...@gentoo.org you wrote:
 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 vap...@gentoo.org
 ---
 v3
   - redo how the board weak is handled to be less bloated when
 screwing over everyone else
 
 v2
   - auto run `sata init` if needed when doing other `sata ...` cmds
 
  board/freescale/mpc8536ds/mpc8536ds.c |6 +++---
  common/cmd_sata.c |   12 +++-
  include/sata.h|1 +
  lib_ppc/board.c   |   20 
  4 files changed, 15 insertions(+), 24 deletions(-)

Sorry, this doesn;t apply any more:

error: patch failed: board/freescale/mpc8536ds/mpc8536ds.c:582
error: board/freescale/mpc8536ds/mpc8536ds.c: patch does not apply
Using index info to reconstruct a base tree...
error: patch failed: board/freescale/mpc8536ds/mpc8536ds.c:582
error: board/freescale/mpc8536ds/mpc8536ds.c: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001.


Please rebase and resubmit.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A verbal contract isn't worth the paper it's printed on.
- Samuel Goldwyn
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2009-01-23 Thread Mike Frysinger
On Tuesday 23 December 2008 00:10:39 Mike Frysinger wrote:
 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().

i dont think anyone has a problem with this latest version (or at least, all 
the issues brought up before have been addressed), so can this be merged ?
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2008-12-22 Thread Mike Frysinger
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 vap...@gentoo.org
---
v3
- redo how the board weak is handled to be less bloated when
  screwing over everyone else

v2
- auto run `sata init` if needed when doing other `sata ...` cmds

 board/freescale/mpc8536ds/mpc8536ds.c |6 +++---
 common/cmd_sata.c |   12 +++-
 include/sata.h|1 +
 lib_ppc/board.c   |   20 
 4 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/board/freescale/mpc8536ds/mpc8536ds.c 
b/board/freescale/mpc8536ds/mpc8536ds.c
index 2b17612..49474d7 100644
--- a/board/freescale/mpc8536ds/mpc8536ds.c
+++ b/board/freescale/mpc8536ds/mpc8536ds.c
@@ -582,15 +582,15 @@ get_board_ddr_clk(ulong dummy)
 }
 #endif
 
-int is_sata_supported(void)
+int sata_initialize(void)
 {
volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
uint sdrs2_io_sel =
(gur-pordevsr  MPC85xx_PORDEVSR_SRDS2_IO_SEL)  27;
if (sdrs2_io_sel  0x04)
-   return 0;
+   return 1;
 
-   return 1;
+   return __sata_initialize();
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
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
diff --git a/include/sata.h b/include/sata.h
index 57ee9ac..37573cf 100644
--- a/include/sata.h
+++ b/include/sata.h
@@ -7,5 +7,6 @@ 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);
+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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot