mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Teresa Gamez <t.gamez@phytec.de>
To: barebox@lists.infradead.org
Subject: Re: [RFC PATCH 2/2] OMAP: Add option to use enviroment from MMC
Date: Wed, 27 Mar 2013 09:10:28 +0100	[thread overview]
Message-ID: <5152A974.4020905@phytec.de> (raw)
In-Reply-To: <20130326201713.GA3564@x61s.Speedport_W_921V_1_21_000>

Am 26.03.2013 21:17, schrieb Alexander Aring:

> Hi,
>
> On Tue, Mar 26, 2013 at 03:23:16PM +0100, Teresa Gámez wrote:
>> Make loading enviroment 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>
>> ---
>>   arch/arm/boards/panda/board.c             |   30 ---------------------------
>>   arch/arm/mach-omap/include/mach/generic.h |    1 +
>>   arch/arm/mach-omap/omap_generic.c         |   32 +++++++++++++++++++++++++++++
>>   3 files changed, 33 insertions(+), 30 deletions(-)
>>
>> diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
>> index 2518d3a..d1f9a5e 100644
>> --- a/arch/arm/boards/panda/board.c
>> +++ b/arch/arm/boards/panda/board.c
>> @@ -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
> There is a second env_init in beaglebone:
>
> late_initcall(beaglebone_env_init); in
> arch/arm/boards/beaglebone/board.c
>
> I think you need to remove this too. Otherwise this will be called twice.

Oh, missed that one....

>
>> diff --git a/arch/arm/mach-omap/include/mach/generic.h b/arch/arm/mach-omap/include/mach/generic.h
>> index edc4f1d..7455404 100644
>> --- a/arch/arm/mach-omap/include/mach/generic.h
>> +++ b/arch/arm/mach-omap/include/mach/generic.h
>> @@ -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);
>> diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
>> index f2fd1d3..5882794 100644
>> --- a/arch/arm/mach-omap/omap_generic.c
>> +++ b/arch/arm/mach-omap/omap_generic.c
>> @@ -30,3 +30,35 @@ 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;
>> +	}
>> +
>> +	printf("Loading enviroment from MMC\n");
> s/enviroment/environment
>> +
>> +	default_environment_path = "/boot/bareboxenv";
>> +
>> +	return 0;
>> +}
>> +late_initcall(omap_env_init);
>> +#endif
> The part in beaglebone/board.c checks for build in environment:
> IS_ENABLED(CONFIG_OMAP_BUILD_IFT)
>
> Maybe you can add this here, too. But remember to disable
> CONFIG_OMAP_BUILD_IFT to use a mmc environment.
>
> But maybe you can drop this here, because you check on
> CONFIG_MCI_STARTUP.

Is this used for the am335x_beaglebone_mlo_large_defconfig?

Teresa

> Alex


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-03-27  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 14:23 [RFC PATCH 1/2] OMAP: Move bootsource functions Teresa Gámez
2013-03-26 14:23 ` [RFC PATCH 2/2] OMAP: Add option to use enviroment from MMC Teresa Gámez
2013-03-26 20:17   ` Alexander Aring
2013-03-27  8:10     ` Teresa Gamez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5152A974.4020905@phytec.de \
    --to=t.gamez@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox