public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
@ 2010-02-14 11:20 Jens Scharsig
  2010-02-16  6:17 ` Daniel Gorsulowski
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Scharsig @ 2010-02-14 11:20 UTC (permalink / raw)
  To: u-boot

 * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
 * add need register flags


Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
---
 cpu/arm926ejs/at91/clock.c           |    7 ++++---
 include/asm-arm/arch-at91/at91_pmc.h |    3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/cpu/arm926ejs/at91/clock.c b/cpu/arm926ejs/at91/clock.c
index 7e03907..f3988fc 100644
--- a/cpu/arm926ejs/at91/clock.c
+++ b/cpu/arm926ejs/at91/clock.c
@@ -157,9 +157,10 @@ int at91_clock_init(unsigned long main_clock)
 	 */
 	if (!main_clock) {
 		do {
-			tmp = at91_sys_read(AT91_CKGR_MCFR);
-		} while (!(tmp & AT91_PMC_MAINRDY));
-		main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16);
+			tmp = readl(&pmc->mcfr);
+		} while (!(tmp & AT91_PMC_MCFR_MAINRDY));
+		tmp &= AT91_PMC_MCFR_MAINF_MASK;
+		main_clock = tmp * (AT91_SLOW_CLOCK / 16);
 	}
 #endif
 	main_clk_rate_hz = main_clock;
diff --git a/include/asm-arm/arch-at91/at91_pmc.h b/include/asm-arm/arch-at91/at91_pmc.h
index 369b5d7..680fe33 100644
--- a/include/asm-arm/arch-at91/at91_pmc.h
+++ b/include/asm-arm/arch-at91/at91_pmc.h
@@ -71,6 +71,9 @@ typedef struct at91_pmc {
 #define AT91_PMC_PLLBR_USBDIV_2		0x10000000
 #define AT91_PMC_PLLBR_USBDIV_4		0x20000000
 
+#define AT91_PMC_MCFR_MAINRDY		0x00010000
+#define AT91_PMC_MCFR_MAINF_MASK	0x0000FFFF
+
 #define AT91_PMC_MCKR_CSS_SLOW		0x00000000
 #define AT91_PMC_MCKR_CSS_MAIN		0x00000001
 #define AT91_PMC_MCKR_CSS_PLLA		0x00000002
-- 
1.6.0.2

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

* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
  2010-02-14 11:20 [U-Boot] [PATCH ARM] updates the at91 main_clock calculation Jens Scharsig
@ 2010-02-16  6:17 ` Daniel Gorsulowski
  2010-02-16 15:23   ` Tom
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Gorsulowski @ 2010-02-16  6:17 UTC (permalink / raw)
  To: u-boot

Jens Scharsig wrote:
>  * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
>  * add need register flags
> 
> 
> Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
> ---
>  cpu/arm926ejs/at91/clock.c           |    7 ++++---
>  include/asm-arm/arch-at91/at91_pmc.h |    3 +++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
...

Thank you, now the updated otc570 builds without errors.
I didn't check, whether the board boots, but I guess it does.

Regards,
Daniel Gorsulowski

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

* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
  2010-02-16  6:17 ` Daniel Gorsulowski
@ 2010-02-16 15:23   ` Tom
  2010-02-17  8:29     ` Daniel Gorsulowski
  0 siblings, 1 reply; 6+ messages in thread
From: Tom @ 2010-02-16 15:23 UTC (permalink / raw)
  To: u-boot

Daniel Gorsulowski wrote:
> Jens Scharsig wrote:
>>  * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
>>  * add need register flags
>>
>>
>> Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
>> ---
>>  cpu/arm926ejs/at91/clock.c           |    7 ++++---
>>  include/asm-arm/arch-at91/at91_pmc.h |    3 +++
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>
> ...
> 
> Thank you, now the updated otc570 builds without errors.
> I didn't check, whether the board boots, but I guess it does.
> 
Were you going to check in the next couple of days ?
Tom


> Regards,
> Daniel Gorsulowski

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

* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
  2010-02-16 15:23   ` Tom
@ 2010-02-17  8:29     ` Daniel Gorsulowski
  2010-02-17 19:08       ` Jens Scharsig
  2010-02-17 21:17       ` Tom
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Gorsulowski @ 2010-02-17  8:29 UTC (permalink / raw)
  To: u-boot

Am 16.02.2010 16:23, schrieb Tom:
> Daniel Gorsulowski wrote:
>> Jens Scharsig wrote:
>>>  * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
>>>  * add need register flags
>>>
>>>
>>> Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
>>> ---
>>>  cpu/arm926ejs/at91/clock.c           |    7 ++++---
>>>  include/asm-arm/arch-at91/at91_pmc.h |    3 +++
>>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>>
>> ...
>>
>> Thank you, now the updated otc570 builds without errors.
>> I didn't check, whether the board boots, but I guess it does.
>>
> Were you going to check in the next couple of days ?
> Tom
> 
>
Checked... board boots.

Btw. there are some warnings during build:
mkimage.c: In function ?main?:
mkimage.c:204: warning: dereferencing type-punned pointer will break
strict-aliasing rules
mkimage.c:222: warning: dereferencing type-punned pointer will break
strict-aliasing rules
soft_i2c.c: In function 'send_reset':
soft_i2c.c:103: warning: unused variable 'pio'
soft_i2c.c: In function 'send_start':
soft_i2c.c:130: warning: unused variable 'pio'
soft_i2c.c: In function 'send_stop':
soft_i2c.c:147: warning: unused variable 'pio'
soft_i2c.c: In function 'send_ack':
soft_i2c.c:166: warning: unused variable 'pio'
soft_i2c.c: In function 'write_byte':
soft_i2c.c:185: warning: unused variable 'pio'
soft_i2c.c: In function 'read_byte':
soft_i2c.c:259: warning: unused variable 'pio'
atmel_dataflash_spi.c:25:2: warning: #warning Please update to use C structur
SoC access !
atmel_usart.c:21:2: warning: #warning Please update to use C structur SoC access !
ohci-at91.c:30:2: warning: #warning Please update to use C structur SoC access !

Regards,
Daniel

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

* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
  2010-02-17  8:29     ` Daniel Gorsulowski
@ 2010-02-17 19:08       ` Jens Scharsig
  2010-02-17 21:17       ` Tom
  1 sibling, 0 replies; 6+ messages in thread
From: Jens Scharsig @ 2010-02-17 19:08 UTC (permalink / raw)
  To: u-boot

Daniel Gorsulowski wrote:
>>> Jens Scharsig wrote:
> soft_i2c.c: In function 'send_reset':
> soft_i2c.c:103: warning: unused variable 'pio'
--snip--
> soft_i2c.c: In function 'read_byte':
> soft_i2c.c:259: warning: unused variable 'pio'

There are two ways to define  I2C_xxxx macros:
gpio or direct SoC access

if you are using gpio to define macros, I think you get this warnings.

If you are using direct SoC access (no gpio driver needed)
there are no warnings 
e.g.

#define I2C_ACTIVE	writel(AT91_PMX_AA_TWD, &pio->pioa.mddr);
#define I2C_TRISTATE	writel(AT91_PMX_AA_TWD, &pio->pioa.mder);
and so on

> atmel_dataflash_spi.c:25:2: warning: #warning Please update to use C structur
> SoC access !
> atmel_usart.c:21:2: warning: #warning Please update to use C structur SoC access !
> ohci-at91.c:30:2: warning: #warning Please update to use C structur SoC access !

We need some volunteers, which convert the drivers.

Regards Jens

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

* [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
  2010-02-17  8:29     ` Daniel Gorsulowski
  2010-02-17 19:08       ` Jens Scharsig
@ 2010-02-17 21:17       ` Tom
  1 sibling, 0 replies; 6+ messages in thread
From: Tom @ 2010-02-17 21:17 UTC (permalink / raw)
  To: u-boot

Daniel Gorsulowski wrote:
> Am 16.02.2010 16:23, schrieb Tom:
>> Daniel Gorsulowski wrote:
>>> Jens Scharsig wrote:
>>>>  * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
>>>>  * add need register flags
>>>>
>>>>
>>>> Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
>>>> ---
>>>>  cpu/arm926ejs/at91/clock.c           |    7 ++++---
>>>>  include/asm-arm/arch-at91/at91_pmc.h |    3 +++
>>>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>>>
>>> ...
>>>
>>> Thank you, now the updated otc570 builds without errors.
>>> I didn't check, whether the board boots, but I guess it does.
>>>
>> Were you going to check in the next couple of days ?
>> Tom
>>
>>
> Checked... board boots.
> 

Thanks!

> Btw. there are some warnings during build:
> mkimage.c: In function ?main?:
> mkimage.c:204: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> mkimage.c:222: warning: dereferencing type-punned pointer will break

In general I look for new compiler warnings and errors.
Any old warnings should be fixed but it is unlikely that
this change introduced them.

Of course results will vary depending on toolchain.

Thanks,
Tom

> 
> Regards,
> Daniel

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

end of thread, other threads:[~2010-02-17 21:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-14 11:20 [U-Boot] [PATCH ARM] updates the at91 main_clock calculation Jens Scharsig
2010-02-16  6:17 ` Daniel Gorsulowski
2010-02-16 15:23   ` Tom
2010-02-17  8:29     ` Daniel Gorsulowski
2010-02-17 19:08       ` Jens Scharsig
2010-02-17 21:17       ` Tom

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