From mboxrd@z Thu Jan 1 00:00:00 1970 From: Troy Kisky Date: Tue, 11 Feb 2014 12:25:09 -0700 Subject: [U-Boot] [PATCH] driver/mxc_i2c: Move static data structure to global_data In-Reply-To: <52F98C18.7020402@freescale.com> References: <1392069772-24742-1-git-send-email-yorksun@freescale.com> <52F98C18.7020402@freescale.com> Message-ID: <52FA7915.8000307@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/10/2014 7:34 PM, York Sun wrote: > On 02/10/2014 02:02 PM, York Sun wrote: >> This driver needs a data structure in SRAM before SDRAM is available. >> This is not alway the case using .data section. Moving this data >> structure to global_data guarantees it is writable. >> >> Signed-off-by: York Sun >> CC: Troy Kisky >> --- >> drivers/i2c/mxc_i2c.c | 18 ++++++++---------- >> include/asm-generic/global_data.h | 3 +++ >> 2 files changed, 11 insertions(+), 10 deletions(-) >> > Troy, > > Following Tom's suggestion, I am trying to use linker script to put the srdata > into SRAM. But I still have a concern regarding initializing the srdata. I don't > see it is initialized anywhere. Do you presume the data is wiped out before the > driver runs? If that's the case, I need to clear the data somewhere in my code. > > York > > . > As I understand it, the .data section follows the .text section and is relocated with it. Thus, if your program is loaded into sram, the .data will be there as well. The .data section also contains the initial value, so no need for code to initialize it. If later your code is relocated to sdram, the .data section should be relocated as well. But if the data has pointers initialized in code to point at sram, those will not be relocated and will need some kind of fixup routine. I'm not very familiar with the SPL code so take whatever I say with a grain of salt. Troy