From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] 85xx/fsl-sata: Use is_serdes_configured() to determine if SATA is enabled
Date: Tue, 20 Apr 2010 10:39:29 -0500 [thread overview]
Message-ID: <1271777969-15475-4-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1271777969-15475-3-git-send-email-galak@kernel.crashing.org>
On the MPC85xx platform if we have SATA its connected on SERDES.
Determing if SATA is enabled via sata_initialize should not be board
specific and thus we move it out of the MPC8536DS board code.
Additionally, now that we have is_serdes_configured() we can determine
if the given SATA port is enabled and error out if its not in the
driver.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/ppc/cpu/mpc85xx/cpu_init.c | 12 ++++++++++++
board/freescale/mpc8536ds/mpc8536ds.c | 11 -----------
drivers/block/fsl_sata.c | 12 ++++++++++++
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/arch/ppc/cpu/mpc85xx/cpu_init.c b/arch/ppc/cpu/mpc85xx/cpu_init.c
index b517e06..d06caa9 100644
--- a/arch/ppc/cpu/mpc85xx/cpu_init.c
+++ b/arch/ppc/cpu/mpc85xx/cpu_init.c
@@ -30,9 +30,11 @@
#include <watchdog.h>
#include <asm/processor.h>
#include <ioports.h>
+#include <sata.h>
#include <asm/io.h>
#include <asm/mmu.h>
#include <asm/fsl_law.h>
+#include <asm/fsl_serdes.h>
#include "mp.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -403,3 +405,13 @@ void arch_preboot_os(void)
setup_ivors();
}
+
+#if defined(CONFIG_CMD_SATA) && defined(CONFIG_FSL_SATA)
+int sata_initialize(void)
+{
+ if (is_serdes_configured(SATA1) || is_serdes_configured(SATA2))
+ return __sata_initialize();
+
+ return 1;
+}
+#endif
diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c
index c181f94..e4c1855 100644
--- a/board/freescale/mpc8536ds/mpc8536ds.c
+++ b/board/freescale/mpc8536ds/mpc8536ds.c
@@ -482,17 +482,6 @@ get_board_ddr_clk(ulong dummy)
}
#endif
-int sata_initialize(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 1;
-
- return __sata_initialize();
-}
-
int board_eth_init(bd_t *bis)
{
#ifdef CONFIG_TSEC_ENET
diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c
index 8878560..5875aa8 100644
--- a/drivers/block/fsl_sata.c
+++ b/drivers/block/fsl_sata.c
@@ -22,6 +22,7 @@
#include <command.h>
#include <asm/io.h>
#include <asm/processor.h>
+#include <asm/fsl_serdes.h>
#include <malloc.h>
#include <libata.h>
#include <fis.h>
@@ -129,6 +130,17 @@ int init_sata(int dev)
return -1;
}
+#ifdef CONFIG_MPC85xx
+ if ((dev == 0) && (!is_serdes_configured(SATA1))) {
+ printf("SATA%d [dev = %d] is not enabled\n", dev+1, dev);
+ return -1;
+ }
+ if ((dev == 1) && (!is_serdes_configured(SATA2))) {
+ printf("SATA%d [dev = %d] is not enabled\n", dev+1, dev);
+ return -1;
+ }
+#endif
+
/* Allocate SATA device driver struct */
sata = (fsl_sata_t *)malloc(sizeof(fsl_sata_t));
if (!sata) {
--
1.6.0.6
next prev parent reply other threads:[~2010-04-20 15:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 15:39 [U-Boot] [PATCH 1/4] ppc: Split MPC83xx SERDES code from MPC85xx/MPC86xx/QorIQ Kumar Gala
2010-04-20 15:39 ` [U-Boot] [PATCH 2/4] 85xx: Add is_serdes_configured() support to MPC8536 SERDES Kumar Gala
2010-04-20 15:39 ` [U-Boot] [PATCH 3/4] 85xx/mpc8536ds: Use is_serdes_configured() to determine of PCIe enabled Kumar Gala
2010-04-20 15:39 ` Kumar Gala [this message]
2010-04-22 4:16 ` [U-Boot] [PATCH 2/4] 85xx: Add is_serdes_configured() support toMPC8536 SERDES Li Yang-R58472
2010-04-28 7:55 ` [U-Boot] [PATCH 2/4] 85xx: Add is_serdes_configured() support to MPC8536 SERDES Kumar Gala
2010-04-21 15:55 ` [U-Boot] [PATCH 1/4] ppc: Split MPC83xx SERDES code from MPC85xx/MPC86xx/QorIQ Kim Phillips
2010-04-27 3:39 ` Kumar Gala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1271777969-15475-4-git-send-email-galak@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox