summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-07-01 11:11:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-07-14 20:32:56 +0200
commit9ac9186550fce7fe13ddb389ddf2e81c47859662 (patch)
treedac894b5180adbc0e4a2823b6c778ba372d18bcf /arch/arm
parent5991cb8eeb8a4eea2587be3b1d1b45d845bd3c68 (diff)
downloadbarebox-9ac9186550fce7fe13ddb389ddf2e81c47859662.tar.gz
barebox-9ac9186550fce7fe13ddb389ddf2e81c47859662.tar.xz
ARM: at91: sama5d27-som1-ek: add barebox_update and multi environment support
We now have second stage support for running from sdmmc0 and sdmmc1. Add a barebox environment and update handler for the two SD cards. As fall back, we use the environment in the QSPI flash as before as this is soldered to the SoM and is always available. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/boards/sama5d27-som1/Makefile1
-rw-r--r--arch/arm/boards/sama5d27-som1/board.c35
-rw-r--r--arch/arm/dts/at91-sama5d27_som1_ek.dts17
-rw-r--r--arch/arm/mach-at91/Kconfig1
4 files changed, 53 insertions, 1 deletions
diff --git a/arch/arm/boards/sama5d27-som1/Makefile b/arch/arm/boards/sama5d27-som1/Makefile
index b08c4a93ca..092c31d6b2 100644
--- a/arch/arm/boards/sama5d27-som1/Makefile
+++ b/arch/arm/boards/sama5d27-som1/Makefile
@@ -1 +1,2 @@
lwl-y += lowlevel.o
+obj-y += board.o
diff --git a/arch/arm/boards/sama5d27-som1/board.c b/arch/arm/boards/sama5d27-som1/board.c
new file mode 100644
index 0000000000..00c0e92a5d
--- /dev/null
+++ b/arch/arm/boards/sama5d27-som1/board.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <common.h>
+#include <linux/sizes.h>
+#include <init.h>
+#include <asm/memory.h>
+#include <bbu.h>
+#include <bootsource.h>
+#include <of.h>
+
+static int ek_device_init(void)
+{
+ int flags_sd = 0, flags_usd = 0;
+ if (!of_machine_is_compatible("atmel,sama5d27-som1-ek"))
+ return 0;
+
+ if (bootsource_get() == BOOTSOURCE_MMC) {
+ if (bootsource_get_instance() == 0) {
+ flags_sd = BBU_HANDLER_FLAG_DEFAULT;
+ of_device_enable_path("/chosen/environment-sd");
+ } else {
+ flags_usd = BBU_HANDLER_FLAG_DEFAULT;
+ of_device_enable_path("/chosen/environment-microsd");
+ }
+ } else {
+ of_device_enable_path("/chosen/environment-qspi");
+ }
+
+ bbu_register_std_file_update("SD", flags_sd, "/mnt/mmc0.0/barebox.bin",
+ filetype_arm_barebox);
+ bbu_register_std_file_update("microSD", flags_usd, "/mnt/mmc1.0/barebox.bin",
+ filetype_arm_barebox);
+ return 0;
+}
+device_initcall(ek_device_init);
diff --git a/arch/arm/dts/at91-sama5d27_som1_ek.dts b/arch/arm/dts/at91-sama5d27_som1_ek.dts
index b9042d1131..befee89ad7 100644
--- a/arch/arm/dts/at91-sama5d27_som1_ek.dts
+++ b/arch/arm/dts/at91-sama5d27_som1_ek.dts
@@ -8,9 +8,24 @@
/ {
chosen {
- environment {
+ environment-qspi {
compatible = "barebox,environment";
device-path = &barebox_env;
+ status = "disabled";
+ };
+
+ environment-sd {
+ compatible = "barebox,environment";
+ device-path = &sdmmc0;
+ file-path = "barebox.env";
+ status = "disabled";
+ };
+
+ environment-microsd {
+ compatible = "barebox,environment";
+ device-path = &sdmmc1;
+ file-path = "barebox.env";
+ status = "disabled";
};
};
};
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 8584dcd979..52eefc7361 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -609,6 +609,7 @@ config MACH_SAMA5D27_SOM1
select OFDEVICE
select MCI_ATMEL_SDHCI_PBL
select COMMON_CLK_OF_PROVIDER
+ select FS_FAT_WRITE if MCI_ATMEL_SDHCI && FS_FAT && ENV_HANDLING
help
Select this if you are using Microchip's sama5d27 SoM evaluation kit