From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ftsmc020: enhance for features and asm support.
Date: Thu, 31 Mar 2011 11:02:21 +0200 [thread overview]
Message-ID: <20110331090221.9C932EDFFD7@gemini.denx.de> (raw)
In-Reply-To: <AANLkTinYJhoGrA7ZAVUQxwByrkWNqomCBFWiJG_+3+0e@mail.gmail.com>
Dear Macpaul Lin,
Please keep the mailing list on Cc: (re-added)
In message <AANLkTinYJhoGrA7ZAVUQxwByrkWNqomCBFWiJG_+3+0e@mail.gmail.com> you wrote:
>
> > I repeat again: I consider this manual unrolling of the nested structs
> > a Bad Thing. You should have separate offsets for each of the nested
> > structs.
>
> The above code is really a rework for a nested structs.
> The origin code looks like,
> Moreover, the structure of ftsmc020 was nested like
> struct ftsmc020 {
> struct {
> unsigned int cr; /* 0x00, 0x08, 0x10, 0x18 */
> unsigned int tpr; /* 0x04, 0x0c, 0x14, 0x1c */
> } bank[4];
> unsigned int pad[8]; /* 0x20 - 0x3c */
> unsigned int ssr; /* 0x40 */
> }
>
> After rewrote it becomes
> struct ftsmc020 {
> unsigned int bank0_cr;
> unsigned int bank0_tpr;
> unsigned int bank1_cr;
> unsigned int bank1_tpr;
> unsigned int bank2_cr;
> unsigned int bank2_tpr;
> unsigned int bank3_cr;
> unsigned int bank3_tpr;
> unsigned int pad[8];
> unsigned int ssr;
> }
>
> Did I misunderstand what you exactly meant?
Yes, indeed. Unnesting means to move the inner struct declaration
outside, like that:
struct ftsmc020_bank {
unsigned int cr;
unsigned int tpr;
};
struct ftsmc020 {
struct ftsmc020_bank bank[4];
unsigned int pad[8];
unsigned int ssr;
};
> > Again: if you need larger numbers of such entries you are doing
> > something fundamentally wrong. Reconsider your coding style. What
> > exactly enforces you to use assembly?
> This is because writing assembly code (lowlevel_init) is really a
> necessity for setting the timing
> and power outpur correctly to these registers (SMC, SDMC, PMU).
What exactly prevents you from writing the very same code in C?
> It is required to give a correct setting to PMU and SMC to make the
> onboard DRAM works correctly
> before the code is loaded from ROM to DRAM and then set up stack for C
> environemnt.
We take care to provide global data and an initial stack very, very
early in the initialization sequence. You canuse C code long before
you can access the system RAM.
> Hence assembly code to setting SMC and PMU in lowlevel_init is a necessity
I seriously doubt that. Just because many boards are writen that way
does not mean that's how it must be done - actualy many just copied
existing bad examples without thinking.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The man on tops walks a lonely street; the "chain" of command is
often a noose.
next prev parent reply other threads:[~2011-03-31 9:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 8:33 [U-Boot] [PATCH] ftsmc020: enhance for features and asm support macpaul at andestech.com
2011-03-25 9:03 ` Wolfgang Denk
2011-03-31 2:38 ` Macpaul Lin
2011-03-31 6:48 ` Wolfgang Denk
2011-03-31 8:12 ` Macpaul Lin
2011-03-31 8:24 ` Wolfgang Denk
[not found] ` <AANLkTinYJhoGrA7ZAVUQxwByrkWNqomCBFWiJG_+3+0e@mail.gmail.com>
2011-03-31 9:02 ` Wolfgang Denk [this message]
2011-04-01 7:58 ` Macpaul Lin
-- strict thread matches above, loose matches on Subject: below --
2011-03-24 11:25 Macpaul Lin
2011-03-24 13:21 ` Wolfgang Denk
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=20110331090221.9C932EDFFD7@gemini.denx.de \
--to=wd@denx.de \
--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