Hi Detlev,

On Tue, Aug 17, 2010 at 17:42:32, Detlev Zundel wrote:
> >> > Yes, but I am still unconvinced ATAG_REVISION is not suitable for this
> >> > purpose.
> >>
> >> When writing code which should also be maintainable by other people it
> >> is a good idea to consider common expectations also of other people.
> >
> > Agreed. And I am open to concrete suggestions on how this could be
> > better done.
>
> Let's take a step back.  What information do you want to pass to the
> Linux kernel?  What does the Linux kernel do with it?

>From the patch description: "The kernel uses this information to determine
the maximum speed reachable using cpufreq"

> As far as I understand you, it is a maximum frequency, correct?  The
> absolute limit is given by the labeling of individual parts - but for
> whatever reason - maybe the user also wants to influence that.

The user does not "influence" this rating. Do you call it influenced by
user because there is an environment variable to set this? The way
the patch is written it can also be specified in the board configuration
header file. The environment variable is just a convenience option. The
expectation is that the user will rebuild U-Boot based on which silicon
he is using so he doesn't have to set the environment variable at all.

So, the user is just "configuring" the software according to the
hardware. There no user "influence" on the silicon speed grade.

>  So why
> not call it "maximum operating frequency"?

Yes, that's a correct description. Where do you want to call it such?

> If you really do have to pass the informatino to the kernel (why does no
> other SoC in ARM use such a aconcept yet?  How do they handle multiple
> frequencies?) and because I'm not too familiar with the ATAGs (flat
> device trees are far superior), let's see what the current Linux kernel
> declares.  [Studying the code] Ah, in arch/avr32/include/asm/setup.h
> someone came up with the idea to create a generic ATAG_CLOCK tag.  That
> does look promising - it scales, i.e. one can specify multiple "clocks"
> (i.e. core, bus, whatever) and it uses long long so it will not overflow
> in the near future.
>
> Why not reuse such an existing concept which matches your usage much
> better (arch/arm/include/asm/setup.h comments ATAG_REVISION as "board
> revision")?

Note again that we are not trying to pass information regarding the
current clock speed here. We are passing information regarding a silicon
characteristic. The DA850 kernel reads the system registers directly to
find out the clock speed. Even in the avr32 platform this ATAG is unused.

>From kernel file: arch/avr32/kernel/setup.c:

static int __init parse_tag_clock(struct tag *tag)
{
        /*
         * We'll figure out the clocks by peeking at the system
         * manager regs directly.
         */
        return 0;
}
__tagtable(ATAG_CLOCK, parse_tag_clock);

Anyway, I can see the talk of "speed" and board "revision" has created
some confusion.

What if instead of "maxspeed", I named the variable as "soctype" and had
values like "am18x-300", "am18x-375", "am18x-450" passed to it?

It means the same thing, but will probably create a different perception?

I wanted to avoid taking this route since the same code supports
different SoC part numbers and passing part number specific values
can cause some confusion for users of other parts. That is all.

The question is why should a new ARM ATAG be introduced if an existing
one is good enough for the purpose?

> >> Using HZ would probably settle the "which unit is used" question, but
> >> the code would overflow at ~4.2 GHz and the numbers will be large and
> >> entry errors have to be expected.  As Hz is too fine for CPU frequencies
> >> this would lead me to use either kilo or megaherz but I would express it
> >> in the variable name.
> >
> > I don't have a very strong inclination on this so I will go with
> > your suggestion.
>
> Did you check if we can learn from other code already present in U-Boot?
>
> Let's see - in arch/mips/cpu/incaip_clock.c there is an environment
> variable "cpuclk" which is in MHz. Aha, the 8xx parts also use a
> "cpuclk" environment variable which is even documented in
> doc/README.MPC866.

Yes, U-Boot online documentation also has a reference to it:
http://www.denx.de/wiki/view/DULG/UBootEnvVariables.

>
> Ah, now I'm in a tight spot - contrary to my previous writings when I
> belived we did not have a comparably construct - I would now vote to use
> exactly the same name and thus unfortunately not use a "_mhz" suffix but
> still specify the clock in mhz.

You mean replace "maxspeed" by "cpuclk"? As I have noted a number of times
before, we are not passing the cpu clock speed here. That information kernel
directly reads from system registers. No need to pass it from U-Boot. The
example you are giving is not the right comparison.

The cpuclk variable in MPC866 is used to set the current cpu speed and pass that
information to kernel. I had a feeling this confusion is going to arise and
that is why I noted in my patch description:

"
Note that U-Boot itself does not set the CPU rate. The CPU
speed is setup by a primary bootloader ("UBL"). The rate setup
by UBL could be different from the maximum speed grade of the
device.
"

Thanks,
Sekhar

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to