From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Sat, 14 Aug 2010 21:41:17 +0200 Subject: [U-Boot] Struct SoC access (was:Make preparatory patches that initially have no effect?) In-Reply-To: <4C66EECA.5020509@emk-elektronik.de> References: <4C665CB9.2040406@emk-elektronik.de> <20100814143009.A18461606A5@gemini.denx.de> <4C66CCCF.9080303@emk-elektronik.de> <20100814184641.981AC1606A5@gemini.denx.de> <4C66EECA.5020509@emk-elektronik.de> Message-ID: <20100814194117.982C71606A5@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.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.