From patchwork Thu Jun 13 03:24:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 250969 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3E2052C00A6 for ; Thu, 13 Jun 2013 13:28:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F1EC4A0C1; Thu, 13 Jun 2013 05:27:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1yDnfiXpKuBu; Thu, 13 Jun 2013 05:27:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 78E694A0C2; Thu, 13 Jun 2013 05:25:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C2554A051 for ; Thu, 13 Jun 2013 05:25:56 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fCpReyK2OtmW for ; Thu, 13 Jun 2013 05:25:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-oa0-f43.google.com (mail-oa0-f43.google.com [209.85.219.43]) by theia.denx.de (Postfix) with ESMTPS id 627E14A02A for ; Thu, 13 Jun 2013 05:25:16 +0200 (CEST) Received: by mail-oa0-f43.google.com with SMTP id i7so8703449oag.30 for ; Wed, 12 Jun 2013 20:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=B/InVp82Mr4HJLJPavRRnDAY0oeoFAgJss/h0Cbxbkc=; b=1C9Z35+JEsj8i0TauwvWmj5DKiJ0o8HWwZmKWuJRceVnSKf1Q0u1J9GWlZNDgbs3x5 NNI/jtPx7bGoT20OMrAhBDmPdAJo5k4+L/t/f3IPblNoJqNpCkREvEpAM6exa1dCRENr G+0ZqOGqR67XQtKs+B4jbJyrPvwa0BKu8AsWvv8WwJ5LFDQ1vOsKBnyG4LuhGlwoJnhV Q5rJ5qWb0PdmkZaMsrhs21+vqBvF5xdmKmmQQJf3Cwo32HQ9pgvk1f8drCraSDvKPzZU rM8BRATEgvus3ORkMKwRzXSvxjginVfIEaD705XJD4CuzVyEnh3Oh1+3YbK7+5V5Ssge ZfLw== X-Received: by 10.60.162.98 with SMTP id xz2mr17317472oeb.7.1371093913481; Wed, 12 Jun 2013 20:25:13 -0700 (PDT) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPSA id oe10sm37501996oeb.6.2013.06.12.20.25.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 20:25:12 -0700 (PDT) From: Rob Herring To: u-boot@lists.denx.de, albert.u.boot@aribaud.net, trini@ti.com Date: Wed, 12 Jun 2013 22:24:52 -0500 Message-Id: <1371093894-16424-8-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1371093894-16424-1-git-send-email-robherring2@gmail.com> References: <1371093894-16424-1-git-send-email-robherring2@gmail.com> Cc: Rob Herring Subject: [U-Boot] [PATCH v2 08/10] ARM: highbank: setup peripherals based on power domain status X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Rob Herring 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 --- v2: - Add proper defines for register addresses. 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 #include +#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)