From patchwork Fri Feb 17 07:57:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie Cai X-Patchwork-Id: 729049 X-Patchwork-Delegate: sjg@chromium.org 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 3vPlkV6Qxzz9s80 for ; Fri, 17 Feb 2017 18:57:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nDtpsV8b"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6853D4AAD2; Fri, 17 Feb 2017 08:57:50 +0100 (CET) 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 03F94lIKy1RR; Fri, 17 Feb 2017 08:57:50 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C945C4A997; Fri, 17 Feb 2017 08:57:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C72C34A997 for ; Fri, 17 Feb 2017 08:57:46 +0100 (CET) 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 I2Q43yT54_sA for ; Fri, 17 Feb 2017 08:57:46 +0100 (CET) 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 mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by theia.denx.de (Postfix) with ESMTPS id 24E804A08A for ; Fri, 17 Feb 2017 08:57:42 +0100 (CET) Received: by mail-pg0-f68.google.com with SMTP id v184so4309277pgv.1 for ; Thu, 16 Feb 2017 23:57:42 -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; bh=Vvpg/MsPIDv4oxbfgL+tqF9oOLdzQG4lPYMtSB7/wDY=; b=nDtpsV8bh7HN5ONc4d+sNKjPh9nrj/I9GR4M49WFHq8bRjmV7XJaxAvQcaIPWUmqd0 GFYs7eJd9XM9Q09fLNbk49qZ4WEOgmqZ2FEhR2M/b6qYFnMKpvWdZCkjjaY29XXvYJGI /Wk+XKCV5FB6o/iIakKHYBSqfai1vVeVAk8dSmGi/3faaOvhkqUfqSh3A1vd16TIdCIX zj0FeXfXIc+wM+UjIxskSVS0zh2sSegl80aQjmr5mNU2frWV+KTA7IMf9U846oX6GvnK 3SSZZ6hMMd7iY45BwHLupdJbXAGouKt0xb+p0KvEJABhM8fd7sWlYWdFqm3armRmwB9U DkIw== 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; bh=Vvpg/MsPIDv4oxbfgL+tqF9oOLdzQG4lPYMtSB7/wDY=; b=ZM4+lTIjhvMx7MFamnIDYqTa3nqntT37/kME3xpTIpRlzCOpM/3FtBxkeA2FVuGn6k voa9GEkmWyTqIc70MlkAKDMbxoxZO8vPzs5Rk5n6MwFZwjf8NJKgX12VxT2x//N+x5qi SuV7hvkr1wY+VSG3Bh0KQQyUHztd80aw775cO0rxgVaXcjnBU6DFlcYKRdVsNuLrb+1O qIkEPP11wolHp8IhFGvkKZPIENLkMe316+WCB274NRxTKHVaRXQcH9XVF4yKhKzBPlKG TdDMl4hVFxC2utfaZYu7SpeSfsJa40wn3LdlKFYpDgHcuYX8903w96q4r0mO2JhSWWXf feQA== X-Gm-Message-State: AMke39l7zxa1Jh8NUxkIJA4RWc+QRG0fS2ExF2zLq78a0+2cGzdaQQlc7S7T1J4PPba3Ng== X-Received: by 10.99.66.193 with SMTP id p184mr8284015pga.213.1487318260669; Thu, 16 Feb 2017 23:57:40 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id y6sm17874849pgc.1.2017.02.16.23.57.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 23:57:39 -0800 (PST) From: Eddie Cai To: sjg@chromium.org Date: Fri, 17 Feb 2017 15:57:02 +0800 Message-Id: <1487318222-1282-1-git-send-email-eddie.cai.linux@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC 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" Auto write GPT table if fail to get GPT table when scan_dev_for_boot_part Signed-off-by: Eddie Cai --- arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++- arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++- arch/arm/mach-rockchip/rk3399-board.c | 46 +++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3399-board.c diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c index bf2b268..e9aeaff 100644 --- a/arch/arm/mach-rockchip/rk3036-board.c +++ b/arch/arm/mach-rockchip/rk3036-board.c @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void) int board_late_init(void) { setup_boot_mode(); - + setenv("scan_dev_for_boot_part", + "part list ${devtype} ${devnum} -bootable test; " + "if env exists test; then " + "echo Found valid partition table; " + "else " + "echo No valid partition table, write the original partition table; " + "gpt write ${devtype} ${devnum} ${partitions}; " + "mmc rescan;" + "fi;" + "part list ${devtype} ${devnum} -bootable devplist; " + "env exists devplist || setenv devplist 1; " + "for distro_bootpart in ${devplist}; do " + "if fstype ${devtype} " + "${devnum}:${distro_bootpart} " + "bootfstype; then " + "run scan_dev_for_boot; " + "fi; " + "done\0" + ); return rk_board_late_init(); } diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c index 9894a25..386b155 100644 --- a/arch/arm/mach-rockchip/rk3288-board.c +++ b/arch/arm/mach-rockchip/rk3288-board.c @@ -74,7 +74,25 @@ int board_late_init(void) { setup_boot_mode(); rk3288_qos_init(); - + setenv("scan_dev_for_boot_part", + "part list ${devtype} ${devnum} -bootable test; " + "if env exists test; then " + "echo Found valid partition table; " + "else " + "echo No valid partition table, write the original partition table; " + "gpt write ${devtype} ${devnum} ${partitions}; " + "mmc rescan;" + "fi;" + "part list ${devtype} ${devnum} -bootable devplist; " + "env exists devplist || setenv devplist 1; " + "for distro_bootpart in ${devplist}; do " + "if fstype ${devtype} " + "${devnum}:${distro_bootpart} " + "bootfstype; then " + "run scan_dev_for_boot; " + "fi; " + "done\0" + ); return rk_board_late_init(); } diff --git a/arch/arm/mach-rockchip/rk3399-board.c b/arch/arm/mach-rockchip/rk3399-board.c new file mode 100644 index 0000000..3777643 --- /dev/null +++ b/arch/arm/mach-rockchip/rk3399-board.c @@ -0,0 +1,46 @@ +/* + * (C) Copyright 2017 ockchip Electronics Co., Ltd + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +__weak int rk_board_late_init(void) +{ + return 0; +} + +int board_late_init(void) +{ + setenv("scan_dev_for_boot_part", + "part list ${devtype} ${devnum} -bootable test; " + "if env exists test; then " + "echo Found valid partition table; " + "else " + "echo No valid partition table, write the original partition table; " + "gpt write ${devtype} ${devnum} ${partitions}; " + "mmc rescan;" + "fi;" + "part list ${devtype} ${devnum} -bootable devplist; " + "env exists devplist || setenv devplist 1; " + "for distro_bootpart in ${devplist}; do " + "if fstype ${devtype} " + "${devnum}:${distro_bootpart} " + "bootfstype; then " + "run scan_dev_for_boot; " + "fi; " + "done\0" + ); + return rk_board_late_init(); +} +