From patchwork Thu Oct 1 09:10:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 54347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 7E579205D0 for ; Thu, 1 Oct 2015 09:10:54 +0000 (UTC) Received: by labjk1 with SMTP id jk1sf34208075lab.0 for ; Thu, 01 Oct 2015 02:10:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=WbwaGmq/FpCBQD5Cp1aQuwniDyljDoaiwbU182bP6Ck=; b=OCLanvjyB+4/h3lXODlfwopyk/knmPo3eXiATyy4ZCWlI1eLul8UOTWUweG1edC7tq 7T8Ns5YCTYOXU/kGLRzwOn+MHMo/9vJt2/o0NZefl/kmOKPvTSy7CZrtzMphuwlwljah LSCjQR301FW7Wli2p9+WRwkm330dR2u/GLs04veBH5IVGP8+x6slV2WvfThIwM8sC6nk 68oVuBa1NiwlXOCJ2lVCKO3nuenzw6DORIldb/9QgHQWKN8nON50le/O313GZfw2pX6m Iez1l0m06/7HShvpb8QhM0n9pXdkZX/3lXEtVIMFUEz8O+Pq4q8HP9js5k+iBavjfoK4 paRQ== X-Gm-Message-State: ALoCoQkrZHhS7BDBHmy1wJy/6BHc7DasWbCrQoohpXMuKTCTQlPaOTqK40yBB1/SUcCMeex1xiiq X-Received: by 10.112.202.165 with SMTP id kj5mr1217058lbc.5.1443690653467; Thu, 01 Oct 2015 02:10:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.3 with SMTP id p3ls103402lag.21.gmail; Thu, 01 Oct 2015 02:10:53 -0700 (PDT) X-Received: by 10.152.27.102 with SMTP id s6mr1515300lag.80.1443690653325; Thu, 01 Oct 2015 02:10:53 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id rd3si2287565lac.23.2015.10.01.02.10.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 02:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbmp1 with SMTP id mp1so5432635lbb.1 for ; Thu, 01 Oct 2015 02:10:53 -0700 (PDT) X-Received: by 10.152.228.171 with SMTP id sj11mr70813lac.88.1443690652831; Thu, 01 Oct 2015 02:10:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp459430lbq; Thu, 1 Oct 2015 02:10:52 -0700 (PDT) X-Received: by 10.194.113.33 with SMTP id iv1mr8824898wjb.65.1443690652218; Thu, 01 Oct 2015 02:10:52 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id yv9si6135528wjc.67.2015.10.01.02.10.51; Thu, 01 Oct 2015 02:10:52 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 098FC4B8FA; Thu, 1 Oct 2015 11:10:51 +0200 (CEST) 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 Yr1u8pE6ByBZ; Thu, 1 Oct 2015 11:10:50 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 680494B8F5; Thu, 1 Oct 2015 11:10:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4816C4B8F5 for ; Thu, 1 Oct 2015 11:10:47 +0200 (CEST) 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 G5bBkNjhIycD for ; Thu, 1 Oct 2015 11:10:47 +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 bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by theia.denx.de (Postfix) with ESMTPS id 137204B8ED for ; Thu, 1 Oct 2015 11:10:43 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id A89C511A8498 Received: by dusk.luon.net (Postfix, from userid 1000) id 1102F21679; Thu, 1 Oct 2015 11:10:40 +0200 (CEST) From: Sjoerd Simons To: Tom Rini , Simon Glass Date: Thu, 1 Oct 2015 11:10:39 +0200 Message-Id: <1443690640-7568-1-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.5.3 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] rockchip: Reconfigure the malloc based to point to system memory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sjoerd.simons@collabora.co.uk X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 When malloc_base initially gets setup in the SPL it is based on the current (early) stack pointer, which for rockchip is pointing into SRAM. This means simple memory allocations happen in SRAM space, which is somewhat unfortunate. Specifically a bounce buffer for the mmc allocated in SRAM space seems to cause the mmc engine to stall/fail causing timeouts and a failure to load the main u-boot image. To resolve this, reconfigure the malloc_base to start at the relocated stack pointer after DRAM has been setup. For reference, things did work fine on rockchip before 596380db was merged to fix memalign_simple due to a combination of rockchip SDRAM starting at address 0 and the dw_mmc driver not checking errors from bounce_buffer_start. As a result, when a bounce buffer needed to be allocated mem_align simple would fail and return NULL. The mmc driver ignored the error and happily continued with the bounce buffer address being set to 0, which just happened to work fine.. Signed-off-by: Sjoerd Simons --- A potentially better fix for this issue would be to reconfigure the malloc_base in spl_relocate_stack_gd following the same steps as is done for the initial setup. However at this point in the release cycle i preferred to do a minimal rockchip only fix (so those boards become bootable again) for this issue to minimize the potential impact on other boards. arch/arm/mach-rockchip/board-spl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-rockchip/board-spl.c b/arch/arm/mach-rockchip/board-spl.c index a241d96..5daced7 100644 --- a/arch/arm/mach-rockchip/board-spl.c +++ b/arch/arm/mach-rockchip/board-spl.c @@ -217,6 +217,10 @@ void board_init_f(ulong dummy) debug("DRAM init failed: %d\n", ret); return; } + + /* Now that DRAM is initialized setup base pointer for simple malloc + * into RAM */ + gd->malloc_base = CONFIG_SPL_STACK_R_ADDR; } static int setup_led(void)