diff options
author | Trent Piepho <tpiepho@kymetacorp.com> | 2015-12-17 00:53:59 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-01-08 08:30:56 +0100 |
commit | 76b059f311a3e79afea055618f692591c618e6d6 (patch) | |
tree | db293e013da9fee4a3e5ff17f826e058748958c2 /arch | |
parent | 3a0e9b49e7f167e1bec2257b44e4f0ca91497cc6 (diff) | |
download | barebox-76b059f311a3e79afea055618f692591c618e6d6.tar.gz barebox-76b059f311a3e79afea055618f692591c618e6d6.tar.xz |
socfpga: Find partition with environment via device tree
socfpga would load the environment from a file named "barebox.env"
located on the device "/dev/mmc0.1". Both those names are hard-coded
in the socfpga code and can't be changed.
Barebox supports selecting the location of the environment using a
"barebox,environment" node in device tree's "chosen" node. And
recently supports specifying that the env should come from a file on
this device.
Change socfpga to use this mechanism by adding the appropriate device
node.
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/configs/socfpga_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/dts/socfpga.dtsi | 8 | ||||
-rw-r--r-- | arch/arm/mach-socfpga/generic.c | 38 |
3 files changed, 9 insertions, 38 deletions
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig index 0a31de518d..7fbe045e27 100644 --- a/arch/arm/configs/socfpga_defconfig +++ b/arch/arm/configs/socfpga_defconfig @@ -67,6 +67,7 @@ CONFIG_NET=y CONFIG_NET_NETCONSOLE=y CONFIG_NET_RESOLV=y CONFIG_OF_BAREBOX_DRIVERS=y +CONFIG_OF_BAREBOX_ENV_IN_FS=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_NET_DESIGNWARE=y CONFIG_MCI=y diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi index d4d498be13..d16758fdab 100644 --- a/arch/arm/dts/socfpga.dtsi +++ b/arch/arm/dts/socfpga.dtsi @@ -1,4 +1,12 @@ / { + chosen { + environment@0 { + compatible = "barebox,environment"; + device-path = &mmc, "partname:1"; + file-path = "barebox.env"; + }; + }; + aliases { mmc0 = &mmc; }; diff --git a/arch/arm/mach-socfpga/generic.c b/arch/arm/mach-socfpga/generic.c index 2d4afd0a7a..906bc63330 100644 --- a/arch/arm/mach-socfpga/generic.c +++ b/arch/arm/mach-socfpga/generic.c @@ -103,41 +103,3 @@ static int socfpga_init(void) return 0; } core_initcall(socfpga_init); - -#if defined(CONFIG_ENV_HANDLING) -#define ENV_PATH "/boot/barebox.env" -static int socfpga_env_init(void) -{ - struct stat s; - char *diskdev, *partname; - int ret; - - diskdev = "mmc0"; - - device_detect_by_name(diskdev); - - partname = asprintf("/dev/%s.1", diskdev); - - ret = stat(partname, &s); - - if (ret) { - pr_err("Failed to load environment: no device '%s'\n", diskdev); - goto out_free; - } - - mkdir("/boot", 0666); - ret = mount(partname, "fat", "/boot", NULL); - if (ret) { - pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret); - goto out_free; - } - - pr_debug("Loading default env from %s on device %s\n", ENV_PATH, diskdev); - default_environment_path_set(ENV_PATH); - -out_free: - free(partname); - return 0; -} -late_initcall(socfpga_env_init); -#endif |