From patchwork Thu Oct 10 14:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1174579 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46ptQS38gKz9sPW for ; Fri, 11 Oct 2019 01:15:12 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B9F68C21F27; Thu, 10 Oct 2019 14:12:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 21A09C21DE8; Thu, 10 Oct 2019 14:12:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A4D69C21DCA; Thu, 10 Oct 2019 14:11:52 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id D0380C21C2C for ; Thu, 10 Oct 2019 14:11:49 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46ptLY2zSjz1rfMD; Thu, 10 Oct 2019 16:11:49 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46ptLY1fvkz1qqkH; Thu, 10 Oct 2019 16:11:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id AIg57gji1i9M; Thu, 10 Oct 2019 16:11:47 +0200 (CEST) X-Auth-Info: 0jEfFHxpNTH1npd4kZZtZd6+L2QRS3J+jFnIEYVakYU= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 10 Oct 2019 16:11:47 +0200 (CEST) From: Lukasz Majewski To: Stefano Babic , Fabio Estevam , Simon Glass , Tom Rini , u-boot@lists.denx.de, Peng Fan Date: Thu, 10 Oct 2019 16:11:24 +0200 Message-Id: <20191010141130.29568-4-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191010141130.29568-1-lukma@denx.de> References: <20191010141130.29568-1-lukma@denx.de> MIME-Version: 1.0 Cc: Martyn Welch , Jason Liu Subject: [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The TPC70 can boot from SD card (debug/development) and eMMC (production). The board_boot_order() function provides a run time check for the device from which one wants to boot (it is selected by GPIO pins setup). Moreover, a fallback to SD card is provided if the detection is not possible or working properly. Signed-off-by: Lukasz Majewski --- Changes in v3: None board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c index e284d5ec57..e48a577f79 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c @@ -308,6 +308,26 @@ int board_mmc_init(bd_t *bd) return fsl_esdhc_initialize(bd, &usdhc_cfg[0]); } +void board_boot_order(u32 *spl_boot_list) +{ + u32 boot_device = spl_boot_device(); + u32 reg = imx6_src_get_boot_mode(); + + reg = (reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT; + + debug("%s: boot device: 0x%x (0x4 SD, 0x6 eMMC)\n", __func__, reg); + if (boot_device == BOOT_DEVICE_MMC1) + if (reg == IMX6_BMODE_MMC || reg == IMX6_BMODE_EMMC) + boot_device = BOOT_DEVICE_MMC2; + + spl_boot_list[0] = boot_device; + /* + * Below boot device is a 'fallback' - it shall always be possible to + * boot from SD card + */ + spl_boot_list[1] = BOOT_DEVICE_MMC1; +} + void board_init_f(ulong dummy) { /* setup AIPS and disable watchdog */