public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jens Scharsig <js_at_ng@scharsoft.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/9 V3] update at91sam9263ek board to new SoC access
Date: Sun, 31 Jan 2010 13:12:35 +0100	[thread overview]
Message-ID: <4B6573B3.80106@scharsoft.de> (raw)
In-Reply-To: <4B64DBFD.1040203@windriver.com>

Tom wrote:
>>  #ifdef CONFIG_SYS_NAND_DBW_16
>> -		       AT91_SMC_DBW_16 |
>> +		       AT91_SMC_MODE_DBW_16 |
> 
> Name of define should not change
> apply globally

Some flag names are not refer to hw register (e.g.AT91_SMC_DBW_16). 
In this case defines with new name are added with c structure. 
Only this names are changed by soc access updates.

>>  #ifdef CONFIG_MACB
>>  static void at91sam9263ek_macb_hw_init(void)
>>  {
>> -	unsigned long rstc;
>> -
>> +	unsigned long 	erstl;
> 
> Keep name of the variable the same
> 
>> +	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
>> +	at91_pio_t	*pio	= (at91_pio_t *) AT91_PIO_BASE;
>> +	at91_rstc_t	*rstc	= (at91_rstc_t *) AT91_RSTC_BASE;
>>  	/* Enable clock */
>> -	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
>> +	writel(1 << AT91SAM9263_ID_EMAC, &pmc->pcer);
>>  
>>  	/*
>>  	 * Disable pull-up on:
>> @@ -104,35 +112,27 @@ static void at91sam9263ek_macb_hw_init(void)
>>  	 *
>>  	 * PHY has internal pull-down
>>  	 */
>> -	writel(pin_to_mask(AT91_PIN_PC25),
>> -	       pin_to_controller(AT91_PIN_PC0) + PIO_PUDR);
>> -	writel(pin_to_mask(AT91_PIN_PE25) |
>> -	       pin_to_mask(AT91_PIN_PE26),
>> -	       pin_to_controller(AT91_PIN_PE0) + PIO_PUDR);
>>  
>> -	rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
>> +	writel(AT91_PIN_TO_MASK(25), &pio->pioc.pudr);
>> +	writel(AT91_PIN_TO_MASK(25) | AT91_PIN_TO_MASK(26), &pio->pioe.pudr);
>>  
>> -	/* Need to reset PHY -> 500ms reset */
>> -	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
>> -				     (AT91_RSTC_ERSTL & (0x0D << 8)) |
>> -				     AT91_RSTC_URSTEN);
>> +	erstl = readl(&rstc->mr) & AT91_RSTC_MR_ERSTL_MASK;
> 
> Name of define changes here.
> Do not do this..
> Revert names globally

rstc is a short for reset controller, so rstc should point to the hw registers.
erstl means external reset length. this patch do not change names, but it is
possible it use similar names by an other way.

> 
>>  
>>  
>> @@ -151,39 +149,36 @@
>>  #ifndef CONFIG_SKIP_LOWLEVEL_INIT
>>  #define MASTER_PLL_MUL		171
>>  #define MASTER_PLL_DIV		14
>> +#define MASTER_PLL_OUT		3
>>  
>>  /* clocks */
>>  #define CONFIG_SYS_MOR_VAL						\
>> -		(AT91_PMC_MOSCEN |					\
>> -		 (255 << 8))		/* Main Oscillator Start-up Time */
>> -#define CONFIG_SYS_PLLAR_VAL						\
>> -		(AT91_PMC_PLLA_WR_ERRATA | /* Bit 29 must be 1 when prog */ \
>> -		 AT91_PMC_OUT |						\
>> -		 AT91_PMC_PLLCOUNT |	/* PLL Counter */		\
>> -		 (2 << 28) |		/* PLL Clock Frequency Range */	\
>> -		 ((MASTER_PLL_MUL - 1) << 16) | (MASTER_PLL_DIV))
>> +		(AT91_PMC_MOR_MOSCEN | AT91_PMC_MOR_OSCOUNT(255))
>> +#define CONFIG_SYS_PLLAR_VAL					\
>> +	(AT91_PMC_PLLAR_29 |					\
>> +	AT91_PMC_PLLxR_OUT(MASTER_PLL_OUT) |			\
>> +	AT91_PMC_PLLxR_PLLCOUNT(63) |				\
>> +	AT91_PMC_PLLxR_MUL(MASTER_PLL_MUL - 1) | 		\
>> +	AT91_PMC_PLLxR_DIV(MASTER_PLL_DIV))
>>  
> 
> Why did this macro need to change ?
> Other macros are similar.
> If there isn't a change in the way registers are read/write,
> the macros should be the same.
See above.
Additional some defines are not correct, but work (see datashee)
eg.
The value of AT91_PMC_OUT and AT91_PMC_PLL value should not be fix. 
The soc update will be change this.

regards Jens

  reply	other threads:[~2010-01-31 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-23 11:03 [U-Boot] [PATCH 6/9 V3] update at91sam9263ek board to new SoC access Jens Scharsig
2010-01-31  1:25 ` Tom
2010-01-31 12:12   ` Jens Scharsig [this message]
2010-02-03 21:47 ` [U-Boot] [PATCH 6/9 V4] " Jens Scharsig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B6573B3.80106@scharsoft.de \
    --to=js_at_ng@scharsoft.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox