public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] ARM: highbank: setup peripherals based on power domain status
Date: Tue, 21 May 2013 16:33:45 -0500	[thread overview]
Message-ID: <1369172027-3147-2-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1369172027-3147-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Accessing powered down peripherals will hang the bus, so check power
domain status before initializing SATA and fixup the FDT to disable
unused peripherals.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 board/highbank/highbank.c  | 31 +++++++++++++++++++++++++++++--
 include/configs/highbank.h |  1 +
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 09cd45d..b224aae 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -23,13 +23,21 @@
 #include <asm/sizes.h>
 #include <asm/io.h>
 
+#define HB_AHCI_BASE			0xffe08000
+
 #define HB_SREG_A9_PWR_REQ		0xfff3cf00
 #define HB_SREG_A9_BOOT_SRC_STAT	0xfff3cf04
+#define HB_SREG_A9_PWRDOM_STAT		0xfff3cf20
+
 #define HB_PWR_SUSPEND			0
 #define HB_PWR_SOFT_RESET		1
 #define HB_PWR_HARD_RESET		2
 #define HB_PWR_SHUTDOWN			3
 
+#define PWRDOM_STAT_SATA		0x80000000
+#define PWRDOM_STAT_PCI			0x40000000
+#define PWRDOM_STAT_EMMC		0x20000000
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -58,9 +66,12 @@ int misc_init_r(void)
 {
 	char envbuffer[16];
 	u32 boot_choice;
+	u32 reg = readl(HB_SREG_A9_PWRDOM_STAT);
 
-	ahci_init(0xffe08000);
-	scsi_scan(1);
+	if (reg & PWRDOM_STAT_SATA) {
+		ahci_init(HB_AHCI_BASE);
+		scsi_scan(1);
+	}
 
 	boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
 	sprintf(envbuffer, "bootcmd%d", boot_choice);
@@ -85,6 +96,22 @@ void dram_init_banksize(void)
 	gd->bd->bi_dram[0].size =  PHYS_SDRAM_1_SIZE;
 }
 
+#if defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *fdt, bd_t *bd)
+{
+	static const char disabled[] = "disabled";
+	u32 reg = readl(HB_SREG_A9_PWRDOM_STAT);
+
+	if (!(reg & PWRDOM_STAT_SATA))
+		do_fixup_by_compat(fdt, "calxeda,hb-ahci", "status",
+			disabled, sizeof(disabled), 1);
+
+	if (!(reg & PWRDOM_STAT_EMMC))
+		do_fixup_by_compat(fdt, "calxeda,hb-sdhci", "status",
+			disabled, sizeof(disabled), 1);
+}
+#endif
+
 void reset_cpu(ulong addr)
 {
 	writel(HB_PWR_HARD_RESET, HB_SREG_A9_PWR_REQ);
diff --git a/include/configs/highbank.h b/include/configs/highbank.h
index 9bf56c7..e01d4bb 100644
--- a/include/configs/highbank.h
+++ b/include/configs/highbank.h
@@ -27,6 +27,7 @@
 #define CONFIG_SYS_HZ			CFG_HZ
 
 #define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
 #define CONFIG_FIT
 #define CONFIG_SUPPORT_RAW_INITRD
 #define CONFIG_SYS_BOOTMAPSZ		(16 << 20)
-- 
1.8.1.2

  reply	other threads:[~2013-05-21 21:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 19:56 [U-Boot] [PATCH 01/10] ARM: move interrupt_init to before relocation Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 02/10] net: calxedaxgmac: enable rx cut-thru Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 03/10] ARM: highbank: update config options Rob Herring
2013-05-16 15:44   ` Tom Rini
2013-05-15 19:56 ` [U-Boot] [PATCH 04/10] ARM: highbank: fix get_tbclk value to timer rate Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 05/10] ARM: highbank: set timer prescaler to 256 Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 06/10] ARM: highbank: avoid bss write in timer_init Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 07/10] ARM: highbank: enable reset on command timeout Rob Herring
2013-05-15 19:56 ` [U-Boot] [PATCH 08/10] ARM: highbank: setup peripherals based on power domain status Rob Herring
2013-05-16 15:48   ` Tom Rini
2013-05-15 19:56 ` [U-Boot] [PATCH 09/10] ARM: highbank: fix build with CONFIG_MISC_INIT_R turned off Rob Herring
2013-05-15 20:31   ` Albert ARIBAUD
2013-05-21 21:33   ` [U-Boot] [PATCH v2] ARM: highbank: compile misc_init_r only if CONFIG_MISC_INIT_R Rob Herring
2013-05-21 21:33     ` Rob Herring [this message]
2013-05-21 21:33     ` [U-Boot] [PATCH v2] ARM: highbank: update config options Rob Herring
2013-05-21 21:33     ` [U-Boot] [PATCH v2] ARM: move interrupt_init to before relocation Rob Herring
2013-06-11  8:22     ` [U-Boot] [PATCH v2] ARM: highbank: compile misc_init_r only if CONFIG_MISC_INIT_R Albert ARIBAUD
2013-05-15 19:56 ` [U-Boot] [PATCH 10/10] highbank: enable keyed autoboot stop Rob Herring
2013-05-15 20:26 ` [U-Boot] [PATCH 01/10] ARM: move interrupt_init to before relocation Albert ARIBAUD
2013-05-15 21:29   ` Rob Herring
2013-05-16  9:44     ` Albert ARIBAUD

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=1369172027-3147-2-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --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