From patchwork Thu Oct 1 18:51:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 54398 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id AF59623010 for ; Thu, 1 Oct 2015 18:52:00 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf9544121lbb.3 for ; Thu, 01 Oct 2015 11:51:59 -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=F+QcWbbNlaKeK3n0TNF/sK+2d4Q9PvnEElP+lvBoFsE=; b=VH/lnnNQu6bXcksnhC5h0Zn8vBNlOAWsucJ9kB4WkoPYI0LnokNOlKZDuE7gGhoE32 5XymigR3qa1N/6sVb/XR6UdnoG2vdvFskbKGDgW296mM9B9L30MH6Q4P+ywk5h6xIIJq u2Oq91AOGdZCy5+rVhbO1H8yXgVv12Jz38SrWny7CqSUowz+/5D+AgXGHcJv0A1H4/0M vj3pCJZJrbf4p8qLptG6/2i9LKb9OvcJk5Tr2mGu/gzYTl6muEh5j1AzBSeuQYLmzg2l GzZn90nDbI6khSEZEivisTODIesSknOb2Kq4LaRDzkA+oSDIqUlgWM2vHA/SUMmZqRSp b+3g== X-Gm-Message-State: ALoCoQnbgo/VXJ16xh85Rr3/t62CH61nBjNaIm/A6LVvMUSHX03KPIALSwIJNS6VxDH25ehvrjJB X-Received: by 10.112.151.9 with SMTP id um9mr1724252lbb.19.1443725519515; Thu, 01 Oct 2015 11:51:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.79.85 with SMTP id d82ls119924lfb.47.gmail; Thu, 01 Oct 2015 11:51:59 -0700 (PDT) X-Received: by 10.25.149.139 with SMTP id x133mr1903701lfd.53.1443725519349; Thu, 01 Oct 2015 11:51:59 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id j6si3602403lbs.87.2015.10.01.11.51.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 11:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbwr8 with SMTP id r8so14599332lbw.2 for ; Thu, 01 Oct 2015 11:51:59 -0700 (PDT) X-Received: by 10.112.139.201 with SMTP id ra9mr3635591lbb.29.1443725519125; Thu, 01 Oct 2015 11:51:59 -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 w3csp776215lbq; Thu, 1 Oct 2015 11:51:58 -0700 (PDT) X-Received: by 10.194.79.196 with SMTP id l4mr13255377wjx.93.1443725518427; Thu, 01 Oct 2015 11:51:58 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id lj5si5283399wic.115.2015.10.01.11.51.58; Thu, 01 Oct 2015 11:51:58 -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 EB8914B76F; Thu, 1 Oct 2015 20:51:56 +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 iTg5foCrL-TW; Thu, 1 Oct 2015 20:51:56 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 81AED4B729; Thu, 1 Oct 2015 20:51:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 50ECA4B664 for ; Thu, 1 Oct 2015 20:51:54 +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 Nk8NG3OYTjx9 for ; Thu, 1 Oct 2015 20:51:54 +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 180BA4A03A for ; Thu, 1 Oct 2015 20:51:50 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 8E75F6091E0 Received: by dusk.luon.net (Postfix, from userid 1000) id 71CF521B3F; Thu, 1 Oct 2015 20:51:46 +0200 (CEST) From: Sjoerd Simons To: Tom Rini , Simon Glass , Hans de Goede Date: Thu, 1 Oct 2015 20:51:46 +0200 Message-Id: <1443725506-20587-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 v2] 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.174 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 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. Changes in v2: - Also gd->malloc_ptr to 0 to not waste any potential space arch/arm/mach-rockchip/board-spl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-rockchip/board-spl.c b/arch/arm/mach-rockchip/board-spl.c index a241d96..982a1d9 100644 --- a/arch/arm/mach-rockchip/board-spl.c +++ b/arch/arm/mach-rockchip/board-spl.c @@ -217,6 +217,11 @@ 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)