All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grzegorz Bernacki <gjb@semihalf.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Add support for the digsy MTC board.
Date: Tue, 03 Feb 2009 11:05:36 +0100	[thread overview]
Message-ID: <498816F0.90407@semihalf.com> (raw)
In-Reply-To: <20090128210559.8CF2A832E416@gemini.denx.de>

Wolfgang Denk wrote:
> Dear Grzegorz,
> 
> In message <12331552753467-git-send-email-gjb@semihalf.com> you wrote:
>> This is the InterControl custom device based on the MPC5200B chip.
> ...
> 
> General comment: there is a lot of code which could use a few comments
> so the reader has a chance to understand what exactly you are doing.
> 
>> --- /dev/null
>> +++ b/board/digsymtc/digsymtc.c
> ...
>> +static void sdram_start(int hi_addr)
>> +{
>> +	long hi_addr_bit = hi_addr ? 0x01000000 : 0;
>> +	long control = SDRAM_CONTROL | hi_addr_bit;
>> +
>> +	/* unlock mode register */
>> +	*(vu_long *)MPC5XXX_SDRAM_CTRL = control | 0x80000000;
>> +	__asm__ volatile ("sync");
>> +
>> +	/* precharge all banks */
>> +	*(vu_long *)MPC5XXX_SDRAM_CTRL = control | 0x80000002;
>> +	__asm__ volatile ("sync");
>> +
>> +	/* auto refresh */
>> +	*(vu_long *)MPC5XXX_SDRAM_CTRL = control | 0x80000004;
>> +	__asm__ volatile ("sync");
>> +
>> +	/* set mode register */
>> +	*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
>> +	__asm__ volatile ("sync");
>> +
>> +	/* normal operation */
>> +	*(vu_long *)MPC5XXX_SDRAM_CTRL = control;
>> +	__asm__ volatile ("sync");
> 
> Please use proper I/O accessor functions instead of volatile pointer
> accesses, here and in all other similar places as well...
> 
> You can then get rid of the "sync"s as well.
> 

Ok, I changed it in whole file.

>> +phys_size_t initdram(int board_type)
>> +{
>> +	ulong dramsize = 0;
>> +	ulong dramsize2 = 0;
>> +	uint svr, pvr;
>> +#ifndef CONFIG_SYS_RAMBOOT
>> +	ulong test1, test2;
>> +
>> +	/* setup SDRAM chip selects */
>> +	*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001C;	/* 512MB at 0x0 */
>> +	*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;	/* disabled */
> 
> ... like here and below.
> 
>> +	if (s != NULL) { puts(", "); puts(s); }
> 
> Please use proper indentation.
> 

ok, done

>> +void set_ethaddr(void)
> 
> Please add "static" here.
> 

ok, done 

>> +int last_stage_init (void)
>> +{
>> +	set_ethaddr();
>> +	return 0;
> 
> You should do this only as long as "ethaddr" is not already set in the
> environment.
> 

ok, done

>> --- /dev/null
>> +++ b/board/digsymtc/eeprom.h
> ...
>> +
>> +#define	EEPROM_ADDR		CONFIG_SYS_I2C_EEPROM_ADDR
>> +#define	EEPROM_LEN		1024
>> +#define	EEPROM_IDENT		2408
>> +#define	EEPROM_ADDR_IDENT	0x0000
>> +#define	EEPROM_ADDR_LEN_SYS	0x0002
>> +#define	EEPROM_ADDR_LEN_SYSCFG	0x0004
>> +#define	EEPROM_OFF_ETHADDR	23
> 
> You want to add some comments what all these magic defines mean...
> 

comments added

>> diff --git a/cpu/mpc5xxx/ide.c b/cpu/mpc5xxx/ide.c
>> index df5b4ac..07d33e3 100644
>> --- a/cpu/mpc5xxx/ide.c
>> +++ b/cpu/mpc5xxx/ide.c
>> @@ -12,7 +12,7 @@
>>   *
>>   * This program is distributed in the hope that it will be useful,
>>   * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>   * GNU General Public License for more details.
>>   *
>>   * You should have received a copy of the GNU General Public License
> 
> Please don't arbitrarily reformat the code.
> 

ok, I restored original layout

>> --- /dev/null
>> +++ b/include/configs/digsymtc.h
> ...
>> +#define CONFIG_PSC_CONSOLE	4	/* console is on PSC4  */
> ...
>> +	"console=ttyPSC1\0"				\
> 
> This looks fishy to me - is it PSC1 or PSC4 ?
> 

Linux enumerates ttyPSC starting from zero, so PSC3 is ttyPSC0 and
ttyPSC4 is ttyPSC4. Some time ago ttyPSC number could be enforced
by setting port-number field in dts, but lately it was removed.
 
> 
>> +#define OF_CPU			"PowerPC,5200 at 0"
>> +#define OF_SOC			"soc5200 at f0000000"
>> +#define OF_TBCLK		(bd->bi_busfreq / 4)
>> +#define OF_STDOUT_PATH		"/soc5200 at f0000000/serial at 2600"
> 
> Do we really need this?

OF_CPU, OF_SOC and OF_TBCLK is used and I removed OF_STDOUT_PATH.

regards,
Grzesiek

  parent reply	other threads:[~2009-02-03 10:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 15:07 [U-Boot] [PATCH] Add support for the digsy MTC board Grzegorz Bernacki
2009-01-28 21:05 ` Wolfgang Denk
2009-01-29  8:56   ` Grzegorz Bernacki
2009-01-29 10:52     ` Wolfgang Denk
2009-01-29 11:09       ` Grzegorz Bernacki
2009-01-29 12:51       ` Jerry Van Baren
2009-02-03 10:05   ` Grzegorz Bernacki [this message]
2009-02-12  9:21 Grzegorz Bernacki
2009-02-12  9:49 ` Stefan Roese

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=498816F0.90407@semihalf.com \
    --to=gjb@semihalf.com \
    --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 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.