OMAP: Add option to use environment from MMC
Make loading environment from MMC generic for all OMAP. Tested on AM335x, OMAP4. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Tested-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
c61cc98091
commit
c1bea6f4ed
|
@ -25,8 +25,6 @@
|
|||
#include <console.h>
|
||||
#include <init.h>
|
||||
#include <driver.h>
|
||||
#include <fs.h>
|
||||
#include <linux/stat.h>
|
||||
#include <envfs.h>
|
||||
#include <sizes.h>
|
||||
#include <io.h>
|
||||
|
@ -112,33 +110,3 @@ static int beaglebone_devices_init(void)
|
|||
return 0;
|
||||
}
|
||||
device_initcall(beaglebone_devices_init);
|
||||
|
||||
#ifdef CONFIG_DEFAULT_ENVIRONMENT
|
||||
static int beaglebone_env_init(void)
|
||||
{
|
||||
struct stat s;
|
||||
char *diskdev = "/dev/disk0.0";
|
||||
int ret;
|
||||
|
||||
ret = stat(diskdev, &s);
|
||||
if (ret) {
|
||||
printf("device %s not found. Using default environment\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mkdir ("/boot", 0666);
|
||||
ret = mount(diskdev, "fat", "/boot");
|
||||
if (ret) {
|
||||
printf("failed to mount %s\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_OMAP_BUILD_IFT))
|
||||
default_environment_path = "/dev/defaultenv";
|
||||
else
|
||||
default_environment_path = "/boot/barebox.env";
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall(beaglebone_env_init);
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <init.h>
|
||||
#include <fs.h>
|
||||
#include <driver.h>
|
||||
#include <io.h>
|
||||
#include <ns16550.h>
|
||||
#include <asm/armlinux.h>
|
||||
#include <linux/stat.h>
|
||||
#include <generated/mach-types.h>
|
||||
#include <mach/omap4-silicon.h>
|
||||
#include <mach/omap4-devices.h>
|
||||
|
@ -20,7 +18,6 @@
|
|||
#include <asm/mmu.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <envfs.h>
|
||||
#include <mach/generic.h>
|
||||
#include <i2c/i2c.h>
|
||||
#include <gpio.h>
|
||||
#include <led.h>
|
||||
|
@ -164,30 +161,3 @@ static int panda_devices_init(void)
|
|||
return 0;
|
||||
}
|
||||
device_initcall(panda_devices_init);
|
||||
|
||||
#ifdef CONFIG_DEFAULT_ENVIRONMENT
|
||||
static int panda_env_init(void)
|
||||
{
|
||||
struct stat s;
|
||||
char *diskdev = "/dev/disk0.0";
|
||||
int ret;
|
||||
|
||||
ret = stat(diskdev, &s);
|
||||
if (ret) {
|
||||
printf("no %s. using default env\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mkdir ("/boot", 0666);
|
||||
ret = mount(diskdev, "fat", "/boot");
|
||||
if (ret) {
|
||||
printf("failed to mount %s\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
default_environment_path = "/boot/bareboxenv";
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall(panda_env_init);
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@ enum omap_boot_src {
|
|||
OMAP_BOOTSRC_USB1,
|
||||
};
|
||||
|
||||
enum omap_boot_src omap_bootsrc(void);
|
||||
enum omap_boot_src am33xx_bootsrc(void);
|
||||
enum omap_boot_src omap3_bootsrc(void);
|
||||
enum omap_boot_src omap4_bootsrc(void);
|
||||
|
|
|
@ -30,3 +30,36 @@ enum omap_boot_src omap_bootsrc(void)
|
|||
return am33xx_bootsrc();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEFAULT_ENVIRONMENT) && defined(CONFIG_MCI_STARTUP)
|
||||
static int omap_env_init(void)
|
||||
{
|
||||
struct stat s;
|
||||
char *diskdev = "/dev/disk0.0";
|
||||
int ret;
|
||||
|
||||
if (omap_bootsrc() != OMAP_BOOTSRC_MMC1)
|
||||
return 0;
|
||||
|
||||
ret = stat(diskdev, &s);
|
||||
if (ret) {
|
||||
printf("no %s. using default env\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mkdir("/boot", 0666);
|
||||
ret = mount(diskdev, "fat", "/boot");
|
||||
if (ret) {
|
||||
printf("failed to mount %s\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_OMAP_BUILD_IFT))
|
||||
default_environment_path = "/dev/defaultenv";
|
||||
else
|
||||
default_environment_path = "/boot/barebox.env";
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall(omap_env_init);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue