From patchwork Fri Apr 24 18:39:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 464368 X-Patchwork-Delegate: hdegoede@redhat.com 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 1DD99140134 for ; Sat, 25 Apr 2015 04:40:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6F2874BE51; Fri, 24 Apr 2015 20:40:02 +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 xqa7fTPQktfp; Fri, 24 Apr 2015 20:40:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EA0204BE43; Fri, 24 Apr 2015 20:40:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BAD744BE43 for ; Fri, 24 Apr 2015 20:39:58 +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 B_OwublnCSVV for ; Fri, 24 Apr 2015 20:39:58 +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 mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id 40E3B4BD3A for ; Fri, 24 Apr 2015 20:39:54 +0200 (CEST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3OIdkIQ031118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 Apr 2015 14:39:47 -0400 Received: from shalem.localdomain.com (vpn1-7-202.ams2.redhat.com [10.36.7.202]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3OIdjk3018311; Fri, 24 Apr 2015 14:39:45 -0400 From: Hans de Goede To: Ian Campbell Date: Fri, 24 Apr 2015 20:39:43 +0200 Message-Id: <1429900783-15152-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] sunxi: display: Align end of memory to work around a linux-4.0 bug X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion 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" Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled: "Memory size unaligned to section boundary" http://www.spinics.net/lists/arm-kernel/msg413811.html This is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out. Cc: Stefan Agner Signed-off-by: Hans de Goede --- drivers/video/sunxi_display.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c index 95cfe94..4607269 100644 --- a/drivers/video/sunxi_display.c +++ b/drivers/video/sunxi_display.c @@ -1278,6 +1278,19 @@ int sunxi_simplefb_setup(void *blob) */ start = gd->bd->bi_dram[0].start; size = gd->bd->bi_dram[0].size - sunxi_display.fb_size; + + /* + * Linux-4.0 as shipped has a bug causing it not boot if the end + * of memory is not aligned to a multiple of 2 MiB. For details + * see the linux-arm mailing list post titled: + * "Memory size unaligned to section boundary" + * http://www.spinics.net/lists/arm-kernel/msg413811.html + * + * This workaround should be removed once the bug has been fixed + * and we no longer care about the Linux versions with the bug. + */ + size &= ~(2 * 1024 * 1024 - 1); + ret = fdt_fixup_memory_banks(blob, &start, &size, 1); if (ret) { eprintf("Cannot setup simplefb: Error reserving memory\n");