From 76b059f311a3e79afea055618f692591c618e6d6 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 17 Dec 2015 00:53:59 +0000 Subject: 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 Signed-off-by: Sascha Hauer --- arch/arm/mach-socfpga/generic.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'arch/arm/mach-socfpga/generic.c') 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 -- cgit v1.2.3