From: Marek Szyprowski <m.szyprowski@samsung.com> To: u-boot@lists.denx.de Subject: [PATCH] board: amlogic: add MMC boot device detection for environment load Date: Fri, 18 Dec 2020 15:26:45 +0100 [thread overview] Message-ID: <20201218142645.5496-1-m.szyprowski@samsung.com> (raw) In-Reply-To: CGME20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d@eucas1p1.samsung.com 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 <m.szyprowski@samsung.com> --- board/amlogic/odroid-n2/odroid-n2.c | 8 ++++++++ board/amlogic/vim3/vim3.c | 8 ++++++++ 2 files changed, 16 insertions(+) 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 <init.h> #include <net.h> #include <asm/io.h> +#include <asm/arch/boot.h> #include <asm/arch/sm.h> #include <asm/arch/eth.h> @@ -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 <init.h> #include <net.h> #include <asm/io.h> +#include <asm/arch/boot.h> #include <asm/arch/eth.h> #include <i2c.h> #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 -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com> To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski <m.szyprowski@samsung.com>, Neil Armstrong <narmstrong@baylibre.com>, Jaehoon Chung <jh80.chung@samsung.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Subject: [PATCH] board: amlogic: add MMC boot device detection for environment load Date: Fri, 18 Dec 2020 15:26:45 +0100 [thread overview] Message-ID: <20201218142645.5496-1-m.szyprowski@samsung.com> (raw) In-Reply-To: CGME20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d@eucas1p1.samsung.com 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 <m.szyprowski@samsung.com> --- board/amlogic/odroid-n2/odroid-n2.c | 8 ++++++++ board/amlogic/vim3/vim3.c | 8 ++++++++ 2 files changed, 16 insertions(+) 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 <init.h> #include <net.h> #include <asm/io.h> +#include <asm/arch/boot.h> #include <asm/arch/sm.h> #include <asm/arch/eth.h> @@ -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 <init.h> #include <net.h> #include <asm/io.h> +#include <asm/arch/boot.h> #include <asm/arch/eth.h> #include <i2c.h> #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 -- 2.17.1
next parent reply other threads:[~2020-12-18 14:26 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d@eucas1p1.samsung.com> 2020-12-18 14:26 ` Marek Szyprowski [this message] 2020-12-18 14:26 ` [PATCH] board: amlogic: add MMC boot device detection for environment load Marek Szyprowski 2020-12-20 22:18 ` Jaehoon Chung 2020-12-20 22:18 ` Jaehoon Chung 2020-12-29 8:25 ` Neil Armstrong 2020-12-29 8:25 ` Neil Armstrong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201218142645.5496-1-m.szyprowski@samsung.com \ --to=m.szyprowski@samsung.com \ --cc=u-boot@lists.denx.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.