* [U-Boot-Users] flat tree clock setting
@ 2006-11-09 16:49 David Updegraff
2006-11-09 17:07 ` Timur Tabi
2006-11-09 17:08 ` Wolfgang Denk
0 siblings, 2 replies; 6+ messages in thread
From: David Updegraff @ 2006-11-09 16:49 UTC (permalink / raw)
To: u-boot
Hi.
Might it be nice if FT could use the calculated -- more likely to be
correct timebase value?
-dbu.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ft.patch
Type: text/x-patch
Size: 477 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061109/53628e5b/attachment.bin
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot-Users] flat tree clock setting
2006-11-09 16:49 [U-Boot-Users] flat tree clock setting David Updegraff
@ 2006-11-09 17:07 ` Timur Tabi
2006-11-09 17:28 ` Scott Wood
2006-11-09 17:08 ` Wolfgang Denk
1 sibling, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2006-11-09 17:07 UTC (permalink / raw)
To: u-boot
David Updegraff wrote:
> Hi.
>
> Might it be nice if FT could use the calculated -- more likely to be
> correct timebase value?
Wouldn't it be better to change get_tbclk() to look like this?
unsigned long get_tbclk(void)
{
#ifdef OF_TBCLK
return OF_TBCLK
#else
ulong tbclk;
tbclk = (gd->bus_clk + 3L) / 4L;
return tbclk;
#endif
}
And then change the ft_build.c code to always call get_tbclk()?
I haven't tried compiling the above code, but I think you all get the idea.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot-Users] flat tree clock setting
2006-11-09 17:07 ` Timur Tabi
@ 2006-11-09 17:28 ` Scott Wood
2006-11-09 21:23 ` Timur Tabi
2006-11-09 23:15 ` Timur Tabi
0 siblings, 2 replies; 6+ messages in thread
From: Scott Wood @ 2006-11-09 17:28 UTC (permalink / raw)
To: u-boot
Timur Tabi wrote:
> Wouldn't it be better to change get_tbclk() to look like this?
>
> unsigned long get_tbclk(void)
> {
> #ifdef OF_TBCLK
> return OF_TBCLK
> #else
> ulong tbclk;
>
> tbclk = (gd->bus_clk + 3L) / 4L;
>
> return tbclk;
> #endif
> }
>
> And then change the ft_build.c code to always call get_tbclk()?
Are there any boards on which OF_TBCLK is (properly) set to something
other than what get_tbclk() returns (ignoring the difference in
rounding)? I don't see any, nor can I think of a reason why such a
difference should ever exist. Perhaps OF_TBCLK should just be removed?
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot-Users] flat tree clock setting
2006-11-09 17:28 ` Scott Wood
@ 2006-11-09 21:23 ` Timur Tabi
2006-11-09 23:15 ` Timur Tabi
1 sibling, 0 replies; 6+ messages in thread
From: Timur Tabi @ 2006-11-09 21:23 UTC (permalink / raw)
To: u-boot
Scott Wood wrote:
> Are there any boards on which OF_TBCLK is (properly) set to something
> other than what get_tbclk() returns (ignoring the difference in
> rounding)?
A search of the source code shows this:
File /temp/u-boot-83xx/include/configs/MPC8349EMDS.h
332 2:#define OF_TBCLK (bd->bi_busfreq / 4)
File /temp/u-boot-83xx/include/configs/MPC8349ITX.h
395 2:#define OF_TBCLK (bd->bi_busfreq / 4)
File /temp/u-boot-83xx/include/configs/MPC8360EMDS.h
327 2:#define OF_TBCLK (bd->bi_busfreq / 4)
File /temp/u-boot-83xx/include/configs/MPC8540ADS.h
309 2:#define OF_TBCLK (bd->bi_busfreq / 8)
File /temp/u-boot-83xx/include/configs/MPC8541CDS.h
320 2:#define OF_TBCLK (bd->bi_busfreq / 8)
File /temp/u-boot-83xx/include/configs/MPC8548CDS.h
326 2:#define OF_TBCLK (bd->bi_busfreq / 8)
File /temp/u-boot-83xx/include/configs/MPC8555CDS.h
320 2:#define OF_TBCLK (bd->bi_busfreq / 8)
File /temp/u-boot-83xx/include/configs/MPC8560ADS.h
302 2:#define OF_TBCLK (bd->bi_busfreq / 8)
File /temp/u-boot-83xx/include/configs/MPC8641HPCN.h
269 2:#define OF_TBCLK (bd->bi_busfreq / 4)
File /temp/u-boot-83xx/include/configs/stxxtc.h
587 2:#define OF_TBCLK (MPC8XX_HZ / 16)
Let's ignore the stxxtc for now, whatever that is.
On the 83xx, get_tbclk() returns "(gd->bus_clk + 3L) / 4L". On 85xx and 86xx,
it does this:
get_sys_info(&sys_info);
return ((sys_info.freqSystemBus + 7L) / 8L);
sys_info.freqSystemBus can be any number of things (see get_sys_info).
Well, it looks like they COULD always contain the same value.
> I don't see any, nor can I think of a reason why such a
> difference should ever exist. Perhaps OF_TBCLK should just be removed?
I think it's safe to say that *something* is redundant here, but I don't know
yet what. My vote would be for OF_TBCLK, though, if that works.
The only thing I know for sure is that all of this clock stuff is making me
cuckoo.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot-Users] flat tree clock setting
2006-11-09 17:28 ` Scott Wood
2006-11-09 21:23 ` Timur Tabi
@ 2006-11-09 23:15 ` Timur Tabi
1 sibling, 0 replies; 6+ messages in thread
From: Timur Tabi @ 2006-11-09 23:15 UTC (permalink / raw)
To: u-boot
Scott Wood wrote:
> Are there any boards on which OF_TBCLK is (properly) set to something
> other than what get_tbclk() returns (ignoring the difference in
> rounding)? I don't see any, nor can I think of a reason why such a
> difference should ever exist. Perhaps OF_TBCLK should just be removed?
Ok, I've done some more digging.
On PPC, bd->bi_busfreq is the same as gd->bus_clk. In fact, there are a bunch
of clocks in bd that are equal to similar values in gd. The bd_t contains
info that is passed to non-openfirmware versions of Linux, and the gd_t
contains just general globally-defined data.
My guess is that anything which isn't directly used to boot non-OF Linux
should use the gd structure. So get_tbclk() does the right thing (although
the rounding could be wrong), but OF_TBCLK should probably use gd->bus_clk.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot-Users] flat tree clock setting
2006-11-09 16:49 [U-Boot-Users] flat tree clock setting David Updegraff
2006-11-09 17:07 ` Timur Tabi
@ 2006-11-09 17:08 ` Wolfgang Denk
1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2006-11-09 17:08 UTC (permalink / raw)
To: u-boot
In message <eivm63$njd$1@sea.gmane.org> you wrote:
>
> Might it be nice if FT could use the calculated -- more likely to be
> correct timebase value?
Coding style problems: indentation not by TAB.
Please cleanup and resubmit.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I don't know if it's what you want, but it's what you get. :-)
- Larry Wall in <10502@jpl-devvax.JPL.NASA.GOV>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-11-09 23:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-09 16:49 [U-Boot-Users] flat tree clock setting David Updegraff
2006-11-09 17:07 ` Timur Tabi
2006-11-09 17:28 ` Scott Wood
2006-11-09 21:23 ` Timur Tabi
2006-11-09 23:15 ` Timur Tabi
2006-11-09 17:08 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.