All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: amlogic: add MMC boot device detection for environment load
       [not found] <CGME20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d@eucas1p1.samsung.com>
@ 2020-12-18 14:26   ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2020-12-18 14:26 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] board: amlogic: add MMC boot device detection for environment load
@ 2020-12-18 14:26   ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2020-12-18 14:26 UTC (permalink / raw)
  To: u-boot, u-boot-amlogic
  Cc: Marek Szyprowski, Neil Armstrong, Jaehoon Chung,
	Bartlomiej Zolnierkiewicz

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] board: amlogic: add MMC boot device detection for environment load
  2020-12-18 14:26   ` Marek Szyprowski
@ 2020-12-20 22:18     ` Jaehoon Chung
  -1 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2020-12-20 22:18 UTC (permalink / raw)
  To: u-boot

On 12/18/20 11:26 PM, Marek Szyprowski wrote:
> 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>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] board: amlogic: add MMC boot device detection for environment load
@ 2020-12-20 22:18     ` Jaehoon Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2020-12-20 22:18 UTC (permalink / raw)
  To: Marek Szyprowski, u-boot, u-boot-amlogic
  Cc: Neil Armstrong, Bartlomiej Zolnierkiewicz

On 12/18/20 11:26 PM, Marek Szyprowski wrote:
> 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>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  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
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] board: amlogic: add MMC boot device detection for environment load
  2020-12-18 14:26   ` Marek Szyprowski
@ 2020-12-29  8:25     ` Neil Armstrong
  -1 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2020-12-29  8:25 UTC (permalink / raw)
  To: u-boot

On 18/12/2020 15:26, Marek Szyprowski wrote:
> 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
> 

Thanks,
I would have hoped to have something more generic... but for now it's ok !

Applying to u-boot-amlogic-next

Neil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] board: amlogic: add MMC boot device detection for environment load
@ 2020-12-29  8:25     ` Neil Armstrong
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2020-12-29  8:25 UTC (permalink / raw)
  To: Marek Szyprowski, u-boot, u-boot-amlogic
  Cc: Jaehoon Chung, Bartlomiej Zolnierkiewicz

On 18/12/2020 15:26, Marek Szyprowski wrote:
> 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
> 

Thanks,
I would have hoped to have something more generic... but for now it's ok !

Applying to u-boot-amlogic-next

Neil

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-29  8:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201218142657eucas1p1834b72338d1cd92f59738e7e3e0c875d@eucas1p1.samsung.com>
2020-12-18 14:26 ` [PATCH] board: amlogic: add MMC boot device detection for environment load Marek Szyprowski
2020-12-18 14:26   ` 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

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.