public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Struct SoC access (was:Make preparatory patches that initially have no effect?)
Date: Sat, 14 Aug 2010 21:41:17 +0200	[thread overview]
Message-ID: <20100814194117.982C71606A5@gemini.denx.de> (raw)
In-Reply-To: <4C66EECA.5020509@emk-elektronik.de>

Dear Reinhard Meyer,

In message <4C66EECA.5020509@emk-elektronik.de> you wrote:
>
> > Have the first add that file, and the second assume it comes later in
> > the sequence.
> 
> You don't mean by "sequence" PATCH 1/n, 2/n, etc? The drivers are so
> independent that that would not really make sense...

Then just write in the comment part of the second patch that the other
one has to be applied first...

> That's a thin line. Although I need only one register of the DBU (for
> example) I think its wise to define all registers in it, and not to
> _reserve[] the unused ones....

Right. If you add a function, add all the registers in it.
But don't bother to explain each and every bit in the registers you
never refer to, nor add completely unrelated blocks.

> Anyway, is the method of (for example!)
> 
> #define DBU_ADDR 0xsomething (in a SoC header file)
> 
> dbu_t *dbu = (dbu_t *)DBU_ADDR; (in a function)
> 
> OK?

Yes.

> Or do we need to further encapsulate that in a function like

No.

> I was even thinking of something like
> 
> struct soc {
> 	u32 xyz[0x80];	/* XYZ unit */
> 	u32 dbu[0x80];	/* Debug Unit */
> 	u32 rstc[0x80];	/* Reset Controller */
> and so on.

This is what PPC used to do; I like that - but ARM people always
explained to me that it makes no sense because address space on ARM
SoC is only sparely populated.

> Then in a driver one could write
> dbu_t *dbu = (dbu_t *)soc.dbu;
> or something along that line

I think this looks nice, but as mentioned before - I'm not an ARM
expert. They tend to do it differently.

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
Q:  How many DEC repairman does it take to fix a flat ?
A:  Five; four to hold the car up and one to swap tires.

  parent reply	other threads:[~2010-08-14 19:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-14  9:07 [U-Boot] Make preparatory patches that initially have no effect? Reinhard Meyer
2010-08-14 14:30 ` Wolfgang Denk
2010-08-14 17:05   ` Reinhard Meyer
2010-08-14 18:46     ` Wolfgang Denk
2010-08-14 19:30       ` [U-Boot] Struct SoC access (was:Make preparatory patches that initially have no effect?) Reinhard Meyer
2010-08-14 19:36         ` Mike Frysinger
2010-08-14 19:40           ` [U-Boot] Struct SoC access Reinhard Meyer
2010-08-14 20:48             ` Mike Frysinger
2010-08-14 19:41         ` Wolfgang Denk [this message]
2010-08-14 19:58           ` Reinhard Meyer
2010-08-14 20:47             ` Reinhard Meyer
2010-08-14 21:49               ` Wolfgang Denk
2010-08-14 21:47             ` Wolfgang Denk
2010-08-14 22:15               ` Reinhard Meyer
2010-08-16 20:21                 ` Scott Wood
2010-08-17  6:58                   ` Reinhard Meyer

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=20100814194117.982C71606A5@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