From: Wolfgang Denk Date: Wed, 20 Jul 2011 14:09:32 +0200 Subject: [U-Boot] [PATCH 1/4] gpio: Adds GPIO driver support for Armada100 In-Reply-To: <794341286.33968.1311143785027.JavaMail.root@ahm.einfochips.com> References: <794341286.33968.1311143785027.JavaMail.root@ahm.einfochips.com> Message-ID: <20110720120932.82ACC1579DF2@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 Ajay Bhargav, In message <794341286.33968.1311143785027.JavaMail.root@ahm.einfochips.com> you wrote: > > > Is there any specific reason for not using u32 for the padding as > > well? > > > nothing specific. It makes easy to find number of bytes than words. If there is no specific reason (which I could not think of either), then please use u32 consistently. If you think in number of bytes, feel free to write u32 reserved[128/sizeof(u32)]; > > Why would you need this BASE + OFFSET notation when using a C struct > > for the registers? Thi smakes little sense to me. > > Well I did use the C struct method, if you see my patches submitted earlier > but according to Prafulla and Lie structure size is too big. so they want me Who cares about the size of the struct? We never alocate any memory for such a structure - it is just an overlay over the existing register space, so nobody cares if this is 16 kB of 16 MB. > to use a mix of C struct and BASE + OFFSET notation. so I thought to break the big > C struct into smaller grouped structures pointing each group with GPIO base + group > offset. I would be glad if you can suggest me something better or smarter. This may make sense of you have separate, logically independent IP blocks. But the reason for such a desicion is if the data belong together in any way or not. The "size" of such a structure is completely irrelevant. 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 Pray to God, but keep rowing to shore. - Russian Proverb