From patchwork Mon May 31 07:51:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1485581 X-Patchwork-Delegate: monstr@monstr.eu 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=bNN/Tm3v; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FtnZG0tfHz9sSn for ; Mon, 31 May 2021 17:52:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ED7E682B1C; Mon, 31 May 2021 09:52:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.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=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="bNN/Tm3v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA7D382B1C; Mon, 31 May 2021 09:52:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 92A9F81019 for ; Mon, 31 May 2021 09:52:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x630.google.com with SMTP id h24so11388456ejy.2 for ; Mon, 31 May 2021 00:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=iKsSYIs14gvLVtz4EeGvvwapHwoPPOj9Ob4XntoCaOQ=; b=bNN/Tm3v7awZ7sISeXT6pa6KFI238hMGHefomLOKFHbqcJ2iCZqFx01MsslhVa89OL HVnOAyIyUnE1ZQsmjkV4tswmhg3eAPQGZWFaQGdGOq56YdlcUBSsiahAGEOpIIEzOvhA Cr2TxpSM/Q8vJtb1t54x1sXEsrs/zbElOBgjwEkRJOTxZQOaklt4mHAE8N6RYOk01Ixc Bkmpoqf0Vr8FxZKA2c6tqDKUYOhDhmgen/OOMOnR/oRKhWtesEiVtlX46UJN5oq+7MC5 x3O9A0TaJhMw3y1cPMX4t9D3qVB2z4JYh85DuMB8rc7qq1dCO7yZi92JTZ/FWk80ue16 GHbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version:content-transfer-encoding; bh=iKsSYIs14gvLVtz4EeGvvwapHwoPPOj9Ob4XntoCaOQ=; b=j3cA9kb6WYzZTiXqHKmF/dEnvASun+btFUYOgzSt60SgXufSDfIoaZ4c7K6/ac9yU/ w7N/Mi/N+4n8xGMgcPdO9Hz6g2T2pk4UDOBsqTQML1piG0QFsmW0NGWfjq0plLfiaDga mB70XjPfp+rEvefjS1qufZP8ptpvhmMrpJXmUzRs6I0+lVOQ8o9l8Y3StPxOHWhLL9n8 thiLI0FQ0svsOtyfijAuI7kM0pj6FPOymYF018wE0thKjckwutgm8NhGENv85V3ScM58 SYDafvQBmKcBb4IFL3+waJITxvtZ2x8I1poN8rfMOtxf7BJSztp1lSkxr3h3sz8K+civ Pf6Q== X-Gm-Message-State: AOAM533Cx4JyXtFP8v80+sz6zdAeBZBawy5CoyyKq3K83N1+DLVtmK4y aqoBfmEzPH91CpCT9++6ZvI3Xyez9aQlL6Ci X-Google-Smtp-Source: ABdhPJzXtp8AZa2XXGMbeIdog9lhHbqJYv2BM/Kxs8Uz2VJDZNVxGUm2eMfQvBFRFoo+ZT+cKTHaBg== X-Received: by 2002:a17:906:1689:: with SMTP id s9mr12822948ejd.252.1622447525076; Mon, 31 May 2021 00:52:05 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::e05]) by smtp.gmail.com with ESMTPSA id f7sm5621466ejz.95.2021.05.31.00.52.04 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 May 2021 00:52:04 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH] arm64: zynqmp: Handle MMC seq number based on boot device Date: Mon, 31 May 2021 09:51:59 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean K26 has EMMC and SD and default 0 is not working when system is booting out of SD which is controller 1. Add controller autodetection via mmc_get_env_dev(). The same code is used for distro_boot selection done in board_late_init(). bootseq variable can't be reused because this is called so late. Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 35 ++++++++++++++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 1 + 2 files changed, 36 insertions(+) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 6e353e3b0a57..46dee80470fa 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -709,6 +709,41 @@ int checkboard(void) return 0; } +int mmc_get_env_dev(void) +{ + struct udevice *dev; + int bootseq = 0; + + switch (zynqmp_get_bootmode()) { + case EMMC_MODE: + case SD_MODE: + if (uclass_get_device_by_name(UCLASS_MMC, + "mmc@ff160000", &dev) && + uclass_get_device_by_name(UCLASS_MMC, + "sdhci@ff160000", &dev)) { + return -1; + } + bootseq = dev_seq(dev); + break; + case SD1_LSHFT_MODE: + case SD_MODE1: + if (uclass_get_device_by_name(UCLASS_MMC, + "mmc@ff170000", &dev) && + uclass_get_device_by_name(UCLASS_MMC, + "sdhci@ff170000", &dev)) { + return -1; + } + bootseq = dev_seq(dev); + break; + default: + break; + } + + debug("bootseq %d\n", bootseq); + + return bootseq; +} + enum env_location env_get_location(enum env_operation op, int prio) { u32 bootmode = zynqmp_get_bootmode(); diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index ece527e07468..1df0ef66c22c 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -76,6 +76,7 @@ CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y +CONFIG_ENV_FAT_DEVICE_AND_PART=":auto" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y