From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hong Xu Date: Wed, 03 Aug 2011 15:36:45 +0800 Subject: [U-Boot] [PATCH] AT91: Defer Dataflash access to env_relocate_spec In-Reply-To: <4E38F6D0.4080807@emk-elektronik.de> References: <1312354896-24951-1-git-send-email-hong.xu@atmel.com> <4E38F6D0.4080807@emk-elektronik.de> Message-ID: <4E38FA8D.9080203@atmel.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Reinhard, On 08/03/2011 03:20 PM, Reinhard Meyer wrote: > Dear Hong Xu, > > When env_init is called, the SPI is not actually initialized in U-Boot. > > So that we can not read Dataflash for its content. > > We simply mark it OK for now, and defer the real work to > > `env_relocate_spec'. (Idealy from env_nand.c) > > > > Signed-off-by: Hong Xu > > --- > > common/env_dataflash.c | 83 > ++++++++++++++++++++++++++---------------------- > > 1 files changed, 45 insertions(+), 38 deletions(-) > > I cannot really decide if that is a good approach. Where would be > the issue if SPI/dataflash were initialized at this point (before > relocation)? Currently the SPI is initialized in board_init which is called in board_init_r, but env_init is called in board_init_f. So actually the original code needs the SPI to be initialized before env_init, not before relocation. An alternative way is to put SPI initialization code in board_early_init_f. But I'm not sure if it's the correct way. BR, Eric > Same works well for example for I2C. > > If Wolfgang is OK with it, I can pick up this patch (once > it is agreed on the way to solve the issue). > > Best Regards, > Reinhard >