From mboxrd@z Thu Jan 1 00:00:00 1970 From: Reinhard Meyer Date: Sat, 14 Aug 2010 21:30:18 +0200 Subject: [U-Boot] Struct SoC access (was:Make preparatory patches that initially have no effect?) In-Reply-To: <20100814184641.981AC1606A5@gemini.denx.de> References: <4C665CB9.2040406@emk-elektronik.de> <20100814143009.A18461606A5@gemini.denx.de> <4C66CCCF.9080303@emk-elektronik.de> <20100814184641.981AC1606A5@gemini.denx.de> Message-ID: <4C66EECA.5020509@emk-elektronik.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 Wolfgang Denk, > 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... > The wiki page does not talk about drivers... It's a general rule and > applies to all sorts of code. Only add what is really used (this also > refers, for example, to struct definitions for register blocks etc. - > don't try to provide a complete description of your SoC; add only > stuff that is actually used by the code). 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.... 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? Or do we need to further encapsulate that in a function like dbut_t *get_dbu_addr(void) {return (dbu_t *)DBU_ADDR;} 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. Then in a driver one could write dbu_t *dbu = (dbu_t *)soc.dbu; or something along that line Best Regards Reinhard