From patchwork Fri Jan 24 15:53:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 1228884 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=euypVyxT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4843dt1HQjz9sRW for ; Sat, 25 Jan 2020 02:56:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23EC681974; Fri, 24 Jan 2020 16:54:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="euypVyxT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C1BED817C0; Fri, 24 Jan 2020 16:54:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9114681819 for ; Fri, 24 Jan 2020 16:54:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joe.skb7@gmail.com Received: by mail-lj1-x242.google.com with SMTP id j26so2976291ljc.12 for ; Fri, 24 Jan 2020 07:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9jgwWuWIjXjqVQ/c4UjeVMi6HqrBn2Yv69RJ4jmXaTI=; b=euypVyxT0GqOb+a9lqFiCEjRdSSTwXOjRysdS8aXeaFwSic0FSu1pIs+euabbiCVkn 0JymyPV8sonyW+YIlS4N/A4atlNMPh4PKcJ/DLioh0Az7KdZ3m23XFbrGkQYYgUo3GNx FU4biwD5SvDzUaR3omHwxAlVxte/ev9K9tuEGPojIvRYNae0ybCd+I2m8fcIdrIEAHpl DaVCJScy08aU0SON5AYt53sTHGgxHpUAdRfafegtbRuqzAo/5Uo8xI6mXWY6XyCUYPDK AYh81ix3ySIztXnBxh+S3/hUJPcnrQpjVGVKaEA4rkGyICLRTOoubjKk4pw1A+EqBViP IPAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9jgwWuWIjXjqVQ/c4UjeVMi6HqrBn2Yv69RJ4jmXaTI=; b=jS0mvmZBGgdD//+O+womSbE5l80B7OQe/zXGx6BZ3YvA6J//AVmy8o0mndNJYcS/Hj 3zmwl7zskpz1q2Z7/71O0JURb1cn+9YAIre+dfnVD0hiTHxOi6BPtFdFaDG1xUEFPbEN eyQbNC+fk3iZQBSb3oqPVtL/rcHD4+JuIGdLoAow2botWh+OG0ZhA8zbFAMzOD9rhnxd m0tVnLEJw3b/fO09xn/WgxIWrdEO4ursNIwGykob3Lvivtr8GAhEpp++sFgGrcTMLpSL qliywUeSpUEbjorMe55Vwv+tBpx9U+WD/11P0ZZMpSglhhjnl1g3i9/tyeIZHgXQ3WpG MUzw== X-Gm-Message-State: APjAAAVF7rYQNVz9CU4wrB85IW0mQo5O6irvVRPgtpz7A9inJlH1tsLj SxtdzyFO0U4PBbMfLb4GhJlCyDfHhQk= X-Google-Smtp-Source: APXvYqxIr3VEn+KcevdDxLvfMv7vxy8m/hvA1gkT1SebFCP4A34Og6lJV69bbJikJcwaBryvrcIEPA== X-Received: by 2002:a2e:884f:: with SMTP id z15mr2727501ljj.46.1579881245540; Fri, 24 Jan 2020 07:54:05 -0800 (PST) Received: from localhost ([2001:67c:2e5c:2011:2e0:4cff:fe68:2882]) by smtp.gmail.com with ESMTPSA id i4sm3809942lji.0.2020.01.24.07.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 07:54:05 -0800 (PST) From: Sam Protsenko To: u-boot@lists.denx.de Subject: [PATCH v4 10/10] arm: ti: boot: Use correct dtb and dtbo on Android boot Date: Fri, 24 Jan 2020 17:53:49 +0200 Message-Id: <20200124155349.12927-11-joe.skb7@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200124155349.12927-1-joe.skb7@gmail.com> References: <20200124155349.12927-1-joe.skb7@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Rini , Roman Stratiienko , Eugeniu Rosca , Praneeth Bajjuri , Heinrich Schuchardt , Alistair Strachan Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Read correct dtb blob from boot.img/recovery.img and apply correct dtbo blobs from dtbo partition. Signed-off-by: Sam Protsenko --- include/configs/ti_armv7_common.h | 7 +++++ include/environment/ti/boot.h | 43 ++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index a1a053e675..a612bb5b4a 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -37,11 +37,18 @@ * seen large trees). We say all of this must be within the first 256MB * as that will normally be within the kernel lowmem and thus visible via * bootm_size and we only run on platforms with 256MB or more of memory. + * + * As a temporary storage for DTBO blobs (which should be applied into DTB + * blob), we use the location 15.5 MB above the ramdisk. If someone wants to + * use ramdisk bigger than 15.5 MB, then DTBO can be loaded and applied to DTB + * blob before loading the ramdisk, as DTBO location is only used as a temporary + * storage, and can be re-used after 'fdt apply' command is done. */ #define DEFAULT_LINUX_BOOT_ENV \ "loadaddr=0x82000000\0" \ "kernel_addr_r=0x82000000\0" \ "fdtaddr=0x88000000\0" \ + "dtboaddr=0x89000000\0" \ "fdt_addr_r=0x88000000\0" \ "rdaddr=0x88080000\0" \ "ramdisk_addr_r=0x88080000\0" \ diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index 5a0fc1dc5d..523c8fc4fe 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -81,6 +81,45 @@ #define AB_SELECT_ARGS "" #endif +/* + * Prepares complete device tree blob for current board (for Android boot). + * + * Boot image or recovery image should be loaded into $loadaddr prior to running + * these commands. The logic of these commnads is next: + * + * 1. Read correct DTB for current SoC/board from boot image in $loadaddr + * to $fdtaddr + * 2. Merge all needed DTBO for current board from 'dtbo' partition into read + * DTB + * 3. User should provide $fdtaddr as 3rd argument to 'bootm' + */ +#define PREPARE_FDT \ + "echo Preparing FDT...; " \ + "if test $board_name = am57xx_evm_reva3; then " \ + "echo \" Reading DTBO partition...\"; " \ + "part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \ + "part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \ + "mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \ + "echo \" Reading DTB for AM57x EVM RevA3...\"; " \ + "abootimg get dtb --index=0 dtb_start dtb_size; " \ + "cp.b $dtb_start $fdtaddr $dtb_size; " \ + "fdt addr $fdtaddr; " \ + "echo \" Applying DTBOs for AM57x EVM RevA3...\"; " \ + "adtimg addr $dtboaddr; " \ + "adtimg get dt --index=0 dtbo0_addr; " \ + "fdt apply $dtbo0_addr; " \ + "adtimg get dt --index=1 dtbo1_addr; " \ + "fdt apply $dtbo1_addr; " \ + "elif test $board_name = beagle_x15_revc; then " \ + "echo \" Reading DTB for Beagle X15 RevC...\"; " \ + "abootimg get dtb --index=0 dtb_start dtb_size; " \ + "cp.b $dtb_start $fdtaddr $dtb_size; " \ + "fdt addr $fdtaddr; " \ + "else " \ + "echo Error: Android boot is not supported for $board_name; " \ + "exit; " \ + "fi; " \ + #define FASTBOOT_CMD \ "echo Booting into fastboot ...; " \ "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " @@ -137,9 +176,7 @@ "if part start mmc $mmcdev $apart boot_start; then " \ "part size mmc $mmcdev $apart boot_size; " \ "mmc read $loadaddr $boot_start $boot_size; " \ - "abootimg get dtb --index=0 dtb_start dtb_size; " \ - "cp.b $dtb_start $fdtaddr $dtb_size; " \ - "fdt addr $fdtaddr; " \ + PREPARE_FDT \ "bootm $loadaddr $ardaddr $fdtaddr; " \ "else " \ "echo $apart partition not found; " \