From patchwork Sat Oct 3 11:25:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 54478 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id A7FF8218EF for ; Sat, 3 Oct 2015 11:25:17 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf23641009lbc.1 for ; Sat, 03 Oct 2015 04:25:16 -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=maqsH4Mp67AJBMFhV6lo1Bg53N/b/8YIPKQ60y83jnI=; b=e6VDTnRnksWrEjQeJJkK1t4OGEWARAWxsqA0pT+mwvFkXEk6cuaOafrvEPiIjRd8OS DzC0+ASBaxVPlvdRWiUjn+icT2YDG88y/+7UrMHPWIj49SxchRCd6KPLXZUwc6OgVsps 7+R2ZLETStWVXHK6z66MvCVaDf1jFLNmDthEbg/6I3BvfTFGijEVFfGeiUdeznJIGIbm qwxCNu5c43bMaf5PL6CtEfx0SBLRyUsIgcy1lmZ+g1ycdBl+BIlN4J1OJJkSN8PqcB9Z RseekwOb/isvnmc8+6nYhcGaq8gVWEXJcwsNDCLbAoN0XfmbiwnRV9Bb/0y9Moqn1dto Xr2w== X-Gm-Message-State: ALoCoQmSJxfmKyjlXgHdmGc3gY8L6i83IQ5Gc0W+D9pzYYU+TLRWqCq/Y68dnMZfqVX0RfB2iA16 X-Received: by 10.112.63.165 with SMTP id h5mr3597123lbs.18.1443871515896; Sat, 03 Oct 2015 04:25:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.32.207 with SMTP id g198ls267542lfg.18.gmail; Sat, 03 Oct 2015 04:25:15 -0700 (PDT) X-Received: by 10.25.209.146 with SMTP id i140mr4969821lfg.69.1443871515535; Sat, 03 Oct 2015 04:25:15 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id g5si9338732lbs.7.2015.10.03.04.25.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Oct 2015 04:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labzv5 with SMTP id zv5so104718171lab.1 for ; Sat, 03 Oct 2015 04:25:15 -0700 (PDT) X-Received: by 10.25.207.82 with SMTP id f79mr5123887lfg.73.1443871515348; Sat, 03 Oct 2015 04:25:15 -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 w3csp241992lbq; Sat, 3 Oct 2015 04:25:12 -0700 (PDT) X-Received: by 10.194.174.201 with SMTP id bu9mr24737040wjc.73.1443871512672; Sat, 03 Oct 2015 04:25:12 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id ud4si18622001wjc.89.2015.10.03.04.25.12; Sat, 03 Oct 2015 04:25:12 -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 281E24B853; Sat, 3 Oct 2015 13:25:11 +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 jUNNxr16BE7P; Sat, 3 Oct 2015 13:25:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 56B574B844; Sat, 3 Oct 2015 13:25:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 39E594B844 for ; Sat, 3 Oct 2015 13:25:08 +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 U1ptokhKpvnN for ; Sat, 3 Oct 2015 13:25:08 +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 09E5C4B842 for ; Sat, 3 Oct 2015 13:25:05 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id A529D6091F1 Received: by dusk.luon.net (Postfix, from userid 1000) id 92C6E2134E; Sat, 3 Oct 2015 13:25:01 +0200 (CEST) From: Sjoerd Simons To: Tom Rini , Simon Glass , Hans de Goede Date: Sat, 3 Oct 2015 13:25:01 +0200 Message-Id: <1443871501-20964-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 v3] 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.215.51 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 Reviewed-by: Hans de Goede Acked-by: Simon Glass --- A 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 (for which Hans de Goede already posted some patches). 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. Changes in v3: - Fixing coding style for the comment block Changes in v2: - Also gd->malloc_ptr to 0 to not waste any potential space arch/arm/mach-rockchip/board-spl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-rockchip/board-spl.c b/arch/arm/mach-rockchip/board-spl.c index a241d96..28c3949 100644 --- a/arch/arm/mach-rockchip/board-spl.c +++ b/arch/arm/mach-rockchip/board-spl.c @@ -217,6 +217,13 @@ 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; + gd->malloc_ptr = 0; } static int setup_led(void)