public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io.
@ 2003-11-19  2:02 Conn Clark
  2003-11-19  2:22 ` Andrew May
  2003-11-19  8:59 ` Wolfgang Denk
  0 siblings, 2 replies; 3+ messages in thread
From: Conn Clark @ 2003-11-19  2:02 UTC (permalink / raw)
  To: u-boot

Hello all,

	We have just finished designing the cpu to our next generation product 
and I'm just getting into the U-boot code. In my preliminary examination 
of our design and U-Boot I ran into an interesting problem and wanted to 
see if anybody had a solution or suggestion on an approach.

	Our design is based on a 333MHz IBM405EP processor. We wish to detect 
the oscilator speed we are using via a pullup or pulldown resistor on an 
IO line. In order to make our product cheap we were planning to drive 
the system clock with a 25MHz oscilator that also drives our ethernet 
phys. We wanted the flexibility to use a second oscilator to drive the 
system clock at 33.3MHz so we could have the option of driving our 
processor, RAM, and PCI bus at the maximum speed. to do this we added a 
second set of pads for an oscilator inbetween the 25MHz oscilator and 
the mcroprocessor, so we only need to cut the trace between the two 
oscilators when we wish to use the 33.3MHz clock.  What I was planning 
to do was initialy configure a microprocessor IO pin as an input and 
read the value of the pull up or pull down to determine the system clock 
speed then reconfigure it as an output to be used as a control line.

	My problem is how do I go about this without severly modifying U-Boots 
structure. In analyzing how to do this I determined that the 
configuration and reading of the IO pin sould be done in a 
board_pre_init function. This rases the issue of passing values between 
the init functions called by board_init_f. My second issue is how do I 
deal with the two frquencies since only one can be defined as 
CONFIG_SYS_CLK_FREQ(which is used in several places) without sticking 
lots of nasty board specific ifdefs through out the code.

	I didn't see a solution in any of the other boards that I looked at 
(Note I didn't look at them all). We realy don't want to have to specify 
at compile time what frequency we intend on using. This may become an 
option on our products and we don't want to have two different firmware 
images to confuse our costomers (and ourselves). This causes to many 
headaches with determining what the costomer has and problems created by 
loading the wrong firmware.

	Has anybody tackled these two problems yet or do they have any sugestions?

Many thanks in advance,

	Conn

-- 

*****************************************************************
   If you live at home long enough, your parents will move out.
  (Warning they may try to sell their house out from under you.)
*****************************************************************

Conn Clark
Engineering Stooge				clark at esteem.com
Electronic Systems Technology Inc.		www.esteem.com

Stock Ticker Symbol				ELST

"clark at esteem.com" Copyright 2000 By Electronic Systems Technology
  This email address may be used to communicate to Conn Clark
  provided it is not being used for advertisement purposes, unless
  prior written consent is given. This email address may not be
  sold under any circumstances. All other rights reserved.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io.
  2003-11-19  2:02 [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io Conn Clark
@ 2003-11-19  2:22 ` Andrew May
  2003-11-19  8:59 ` Wolfgang Denk
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew May @ 2003-11-19  2:22 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 18, 2003 at 06:02:29PM -0800, Conn Clark wrote:
> Hello all,
> 
> 	Our design is based on a 333MHz IBM405EP processor. We wish to 
> 	detect the oscilator speed we are using via a pullup or pulldown resistor 
> on an IO line. In order to make our product cheap we were planning to drive 
.....
> 
> 	My problem is how do I go about this without severly modifying 
> 	U-Boots structure. In analyzing how to do this I determined that the 
> configuration and reading of the IO pin sould be done in a 
> board_pre_init function. This rases the issue of passing values between 
> the init functions called by board_init_f. My second issue is how do I 
> deal with the two frquencies since only one can be defined as 
> CONFIG_SYS_CLK_FREQ(which is used in several places) without sticking 
> lots of nasty board specific ifdefs through out the code.
> 
I just have an old copy of the code to look at but for the 405 stuff
_SYS_CLK_FREQ is only used in C code so you can do this in the header
and c code.

#define CONFIG_SYS_CLK_FREQ get_sys_clk_freq()

unsigned int get_sys_clk_freq()
{
	if( *ADDR == 0x1 )
		return 25000000;
	else
		return 33333333;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io.
  2003-11-19  2:02 [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io Conn Clark
  2003-11-19  2:22 ` Andrew May
@ 2003-11-19  8:59 ` Wolfgang Denk
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2003-11-19  8:59 UTC (permalink / raw)
  To: u-boot

Dear Conn,

in message <3FBACF35.4020006@esteem.com> you wrote:
> 
> 	My problem is how do I go about this without severly modifying U-Boots 
> structure. In analyzing how to do this I determined that the 
> configuration and reading of the IO pin sould be done in a 
> board_pre_init function. This rases the issue of passing values between 
> the init functions called by board_init_f. My second issue is how do I 

You can store the cpu_clk / bus_clk in the global_data structure.

> deal with the two frquencies since only one can be defined as 
> CONFIG_SYS_CLK_FREQ(which is used in several places) without sticking 
> lots of nasty board specific ifdefs through out the code.

I don't see the need for #ifdef's.

> (Note I didn't look at them all). We realy don't want to have to specify 
> at compile time what frequency we intend on using. This may become an 

I see no need that CONFIG_SYS_CLK_FREQ must be a constant. Instead of

	#define CONFIG_SYS_CLK_FREQ     33333333

you can - for example - use

	#define CONFIG_SYS_CLK_FREQ     my_function_to_read_clocks()

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
"Most people would like to be delivered  from  temptation  but  would
like it to keep in touch."                             - Robert Orben

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-19  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-19  2:02 [U-Boot-Users] Question about setting the sys clk freq based on a pull up on io Conn Clark
2003-11-19  2:22 ` Andrew May
2003-11-19  8:59 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox