public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] driver/mxc_i2c: Move static data structure to global_data
Date: Tue, 11 Feb 2014 11:46:05 -0800	[thread overview]
Message-ID: <52FA7DFD.5060406@freescale.com> (raw)
In-Reply-To: <52FA7915.8000307@boundarydevices.com>

On 02/11/2014 11:25 AM, Troy Kisky wrote:
> 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 <yorksun@freescale.com>
>>> CC: Troy Kisky <troy.kisky@boundarydevices.com>
>>> ---
>>>   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,

Thanks for the insight. I am not using SPL either. I need this driver to run
before u-boot relocates to DDR. Everything is in flash. I need to find a
writable location for the variable srdata. I can put this section in linker script

       .data.sram :
       {
               drivers/i2c/built-in.o (.data)
       } > sram

It works before and after the relocation. But the address after relocation is
not what I want. It is simply the original SRAM address plus the offset. It
lands the variable into DDR below U-boot. I am hoping to find a way to put it
into stack.

York

  reply	other threads:[~2014-02-11 19:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 22:02 [U-Boot] [PATCH] driver/mxc_i2c: Move static data structure to global_data York Sun
2014-02-10 22:10 ` Tom Rini
2014-02-10 22:28   ` York Sun
2014-02-10 22:45     ` Tom Rini
2014-02-10 22:47       ` York Sun
2014-02-11 18:01       ` York Sun
2014-02-11 21:46         ` York Sun
2014-02-12 14:41           ` Tom Rini
2014-02-11  2:34 ` York Sun
2014-02-11 19:25   ` Troy Kisky
2014-02-11 19:46     ` York Sun [this message]
2014-02-11 19:59       ` Wolfgang Denk
2014-02-11 20:03         ` York Sun
2014-02-11 20:57           ` Wolfgang Denk
2014-02-11 21:02             ` York Sun
2014-02-11 22:12               ` Wolfgang Denk
2014-02-11 22:20                 ` York Sun
2014-02-12 14:27                   ` Wolfgang Denk
2014-02-12 14:43                     ` Tom Rini
2014-02-12 17:56                       ` York Sun

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=52FA7DFD.5060406@freescale.com \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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