From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Thu, 29 Sep 2011 11:17:44 +0200 Subject: [U-Boot] [PATCH] mx31: provide readable WEIM CS accessor In-Reply-To: <4E841EA9.7070001@hale.at> References: <20110922140833.CF0B6140796D@gemini.denx.de> <1317214100-1379-1-git-send-email-helmut.raiger@hale.at> <1317214100-1379-2-git-send-email-helmut.raiger@hale.at> <4E8339E9.3080204@denx.de> <4E841EA9.7070001@hale.at> Message-ID: <4E8437B8.3040401@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 On 09/29/2011 09:30 AM, Helmut Raiger wrote: > On 09/28/2011 05:14 PM, Stefano Babic wrote: >>> +#ifndef __ASSEMBLER__ >>> +static inline void mx31_setup_weimcs(int cs, >> Is there a reason to embed this function in imx-regs.h ? Why not in >> ./arch/arm/cpu/arm1136/mx31/generic.c, where I think this function >> belongs ? >> > > I re-checked, it makes a lot of sense to inline this function as it > results into 3 simple register writes (addresses are compile time > calculated if 'cs' is a constant)! Well, this is correct, but I wonder if this is the right function to be optimized. I cannot imagine that this function runs a lot of times. It is used to initialize the chipselects, and it is normally called not more as one time for each chip select, or less. For the i.MX31, not more as 6 times. What I am trying in any case to avoid is that the code becomes messy. And I am trying to have the code as consistent as possible among the several i.MX SOCs. The i.MX31 is the older, and only part of code was cleaned up. You see for example a lot of accesses using the __REG macro inside the i.MX31 code, and this is not accepted for new code.So there are some "unwritten" rules, that can be acquired reading the code for the i.MX processors. - each i.MX SOC has a imx-regs.h file, where the registers and the layout of the SOC is described. Neither functions nor prototypes must be inserted here. - for clock related defines, a crm_regs.h file is defined - common prototypes are put in sys_proto.h (same name as other ARM SOCs, see OMAP/TI/s5p). So please do not put inline functions inside imx-regs.h, and feel free to add a sys_proto.h (check for the same file for MX35/MX5) for your purposes. Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================