From patchwork Fri Dec 18 14:26:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 345465 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp2174918jai; Fri, 18 Dec 2020 06:27:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRgotazsCevq95f6nIEmgZ3S6pilu+ESGNO/wn+NXJVryPQzxi0VS6h2lPJYv3IEyM7m15 X-Received: by 2002:a17:906:8617:: with SMTP id o23mr4303368ejx.274.1608301640239; Fri, 18 Dec 2020 06:27:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608301640; cv=none; d=google.com; s=arc-20160816; b=CTuAVYWDPLU2qCwfvhiZkbe8sc9+qIIkioADBCPmcJh3nJt72260OplmrVP1R8ZpU+ UBVvP2OnS/tPQ4Cr8/+KIT3APkjT2/K8B5mNVxlQoqzuAcgTsvrINiXnZlolAJ4AwmSU Z7L4sQG5WRMHt5UPjIVzZ2ePi4CDQE6NOVyPU4XaQW/BHzr4ocs0V1zd8yhwipbEMFLl 7CHmLwLD+q2L7rT3KYeKxIuNNShiPB/gWjFK90Yy2pZ9vGg8t9jnPyf9lmceQR88QzmC lGtByemVoTNvVNGEW6SyaxQvnjL7GFcwvJYILhB3I4JjkX4i0efzSEsHSWvgfcyfI/0G 9v7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=uLKwTNYNSy/DWFf+MLtaAp8zDHG4MsQbuLFF+PlwNLA=; b=NLrPbXzgg3HBhpp/lOyhs9Czt9ofCVJQE812GL5TuFwGYMcB3ttEtuCI3wYVjRonuP UBpmXvxwwDEb81A0SUoGzZ/8eZqofiweMCnSrfZaMLbEhaooY5wgEO7yWjJv3jd2Luvm 5+RY4+wMFv7qAHv5fCaSsWRui7K3+EKNb0NMqxexpp+gdbgVXevKshvy1ITfE2JlCs8W DNPt2goOEzM64i/qF7mUIfrIdZr+lmhlwHK64cCgQAPbL2D38o0jtF2n3ovFhlqmUtn0 c0gp7B5zDMuKdB7Y1P+6xO6wB0hIspCy8KpefolDIsLt4ML9u3viJ9EvzRgJR0Vk/GBA cm8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lCWubyrU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id y24si4743019ejc.613.2020.12.18.06.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 06:27:20 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lCWubyrU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11E7B82CEC; Fri, 18 Dec 2020 15:27:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="lCWubyrU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C838E82CF4; Fri, 18 Dec 2020 15:27:17 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AF39D82CE6 for ; Fri, 18 Dec 2020 15:27:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201218142703euoutp01704684aff62fc132ae4b56c5b65dd3ae~R1c5MR8400522805228euoutp01l for ; Fri, 18 Dec 2020 14:27:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201218142703euoutp01704684aff62fc132ae4b56c5b65dd3ae~R1c5MR8400522805228euoutp01l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608301624; bh=uLKwTNYNSy/DWFf+MLtaAp8zDHG4MsQbuLFF+PlwNLA=; h=From:To:Cc:Subject:Date:References:From; b=lCWubyrU3UxKt9mImcYnjXjQMChzDUAmzWfaxDjoIXKITuobdBpAv1hjRodN1Vw3k 2/SodAAJr8/xQhcCv1z74mXJG6WhduXUqhYUyKYakQvPAY35Y1eXBQ+QC2zkfOUI7+ NZmZ4LB50eC0bprIHhikznie3jZFSDPkrX6y9h0Y= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201218142658eucas1p2f56aceb2dc1cd67d5dfc3e6ef1884c33~R1czs7xlF1395513955eucas1p26; Fri, 18 Dec 2020 14:26:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F1.D7.27958.13CBCDF5; Fri, 18 Dec 2020 14:26:57 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d~R1czTGlES0763207632eucas1p1n; Fri, 18 Dec 2020 14:26:57 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201218142657eusmtrp14a7d56c647df76b1dc99cf51e819fddb~R1czSdfEq0862208622eusmtrp1d; Fri, 18 Dec 2020 14:26:57 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-c7-5fdcbc31bdd3 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 11.B7.21957.13CBCDF5; Fri, 18 Dec 2020 14:26:57 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201218142657eusmtip1649c129643981dbd40680e6186bf8b2c~R1cy55lSY0350803508eusmtip1p; Fri, 18 Dec 2020 14:26:57 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH] board: amlogic: add MMC boot device detection for environment load Date: Fri, 18 Dec 2020 15:26:45 +0100 Message-Id: <20201218142645.5496-1-m.szyprowski@samsung.com> X-Mailer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xTYinOSDTUYi4qTgQAYjrlEmkDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDLMWRmVeSWpSXmKPExsVy+t/xu7qGe+7EG2x+omCxccZ6Vosbv9pY LdYeuctucagv2mLShF9sFm/3drI7sHm8v9HK7jG/8zuTx9k7Oxg9+rasYgxgidKzKcovLUlV yMgvLrFVija0MNIztLTQMzKx1DM0No+1MjJV0rezSUnNySxLLdK3S9DLOHzxPXvBFIGKaRcP MTcwrubtYuTkkBAwkfi5+jFbFyMXh5DAUkaJWcsfM0IkZCROTmtghbCFJf5c64Iq+sQosX3J CxaQBJuAoUTXW5AEJ4cI0KSTXZfAGpgF9jJK9O30BLGFBYIl5iw4DzSUg4NFQFWi/VYYiMkr YCNxZJoExHh5idUbDjBPYORZwMiwilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzDYth37uXkH 47xXH/UOMTJxMB5ilOBgVhLhDX1wO16INyWxsiq1KD++qDQntfgQoynQtonMUqLJ+cBwzyuJ NzQzMDU0MbM0MLU0M1YS5906d028kEB6YklqdmpqQWoRTB8TB6dUA9PM4hzVcPvWJTum/su9 U1EU7bk9fJ95UWDgevmfql4ba1c4Z2ww+H1n9eLwil2TtiZKf/i0bI3SjQfaffuOe6Zcm7Bj v+rZLkG+a/v69Zd/N/p9v2fmXuF9Su2zbzsbazgd+5vulGXr+0Yjea3v/Z1ZT9d8mx0XkbPh 2pfEkqV+N/SC1yj9CZrqVvF44ySTz7fF+G5uZ5t4sVvIRuHruce2u07ZbbHeM5Uls/9XzuNK j9ffi994On3dEFkXICNsJaeS9jTBVHf/U62SqD8PXa3uMx7j7v+7T/q52OOa5uIVv08e3vx9 35LJ7Dl7/llq83jLu+tOXm1YcOueamzy61KeMx1Rwefkmt4dZvVxWSmlxFKckWioxVxUnAgA RNOlY78CAAA= X-CMS-MailID: 20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d X-Msg-Generator: CA X-RootMTR: 20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d References: 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.3 at phobos.denx.de X-Virus-Status: Clean Detect eMMC or SD card boot on Odroid-C4/N2 and Khadas VIM3(l) boards and report proper MMC device for the environment loading code. This allows to automatically load and store environment variables on the FAT partition or RAW offset of the MMC device without the need to use different configurations on eMMC and SD card. To use this feature with environment stored on FAT partition, one has to specify an empty device part (i.e. ":1" for the first partition) in CONFIG_ENV_FAT_DEVICE_AND_PART to let the code to set the device to the value returned by mmc_get_env_dev() function. Signed-off-by: Marek Szyprowski --- board/amlogic/odroid-n2/odroid-n2.c | 8 ++++++++ board/amlogic/vim3/vim3.c | 8 ++++++++ 2 files changed, 16 insertions(+) -- 2.17.1 Reviewed-by: Jaehoon Chung diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c index caf7fd6810..12ee5d3abc 100644 --- a/board/amlogic/odroid-n2/odroid-n2.c +++ b/board/amlogic/odroid-n2/odroid-n2.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,13 @@ #define EFUSE_MAC_SIZE 12 #define MAC_ADDR_LEN 6 +int mmc_get_env_dev(void) +{ + if (meson_get_boot_device() == BOOT_DEVICE_EMMC) + return 1; + return 0; +} + int misc_init_r(void) { u8 mac_addr[MAC_ADDR_LEN]; diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index 09ef39ff30..f9049e0172 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -10,10 +10,18 @@ #include #include #include +#include #include #include #include "khadas-mcu.h" +int mmc_get_env_dev(void) +{ + if (meson_get_boot_device() == BOOT_DEVICE_EMMC) + return 2; + return 1; +} + /* * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between