[U-Boot] [PATCH] mx31: provide readable WEIM CS accessor

Stefano Babic sbabic at denx.de
Thu Sep 29 11:17:44 CEST 2011


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
=====================================================================


More information about the U-Boot mailing list