public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mgcoge, mgsuvd: added support for the IVM EEprom.
Date: Mon, 29 Sep 2008 11:57:43 +0200	[thread overview]
Message-ID: <48E0A697.4000808@denx.de> (raw)
In-Reply-To: <20080929091014.755A724851@gemini.denx.de>

Hello Wolfgang,

Wolfgang Denk wrote:
> In message <48E08A41.1090708@denx.de> you wrote:
>> The EEprom contains some Manufacturerinformation,
>> which are read from u-boot at boot time, and saved
>> in same Environmentvars.
>>
>> Signed-off-by: Heiko Schocher <hs@denx.de>
>> ---
>>  board/keymile/common/common.c |  285 +++++++++++++++++++++++++++++++++++++++++
>>  include/configs/mgcoge.h      |    5 +
>>  include/configs/mgsuvd.h      |    5 +
>>  lib_ppc/board.c               |    6 +
>>  4 files changed, 301 insertions(+), 0 deletions(-)
>>
>> diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
>> index a6ed379..25c5900 100644
>> --- a/board/keymile/common/common.c
>> +++ b/board/keymile/common/common.c
>> @@ -38,6 +38,291 @@
>>  extern int i2c_mgsuvd_read (void);
>>  #endif
>>
>> +int ivm_calc_crc (unsigned char *buf, int len)
>> +{
>> +	const unsigned short cCrc16Table[16] = {
>> +		0x0000, 0xCC01, 0xD801, 0x1400,
>> +		0xF001, 0x3C00, 0x2800, 0xE401,
>> +		0xA001, 0x6C00, 0x7800, 0xB401,
>> +		0x5000, 0x9C01, 0x8801, 0x4400};
> 
> If we need support for CRC16, it should be factored out and move to
> lib_generic.

OK.

>> +#define BTChar	unsigned char
> 
> Please get rid of this #define.

Hmm... I got a source from the Boardmanufacturer, and I wanted to stay
in sync with this code as close as possible, so this looked as the best
way for me ... this affects also the most comments from you.
What to do with such code in common?

[...]
>> +	/* IVM_MacAddress */
>> +	sprintf ((char *)valbuf, "%02X:%02X:%02X:%02X:%02X:%02X",
>> +			buf[1],
>> +			buf[2],
>> +			buf[3],
>> +			buf[4],
>> +			buf[5],
>> +			buf[6]);	
>> +	setenv ("IVM_MacAddress", (char *)valbuf);
> 
> Do we really need this? We already have "ethaddr" ?

We dont need this, but the manufacturer of the Hardware
wants explicitly such a Environmentvariable.

>> +	if (getenv ("ethaddr") == NULL)
>> +		setenv ((char *)"ethaddr", (char *)valbuf);
> 
> Oops? You are even aware of this.

Yes.

> Please avoid duplicate data.

Hmm... the boardmanufacturer wants explicitly a "IVM_" before
all of "his" variables from the EEprom.

[...]
>> +	unsigned short	val;
>> +	unsigned char	valbuf[CFG_IVM_EEPROM_PAGE_LEN];
>> +	unsigned char	*tmp;
>> +
>> +	/* used Code from ivm/src/devsrv_baseproductdata.cpp */
> 
> What is ivm/src/devsrv_baseproductdata.cpp ?

Thats the source from the boardmanufacturer ...

>> +	ivm_get_value (buf, CFG_IVM_EEPROM_PAGE_LEN, "IVM_BoardId", 0, 1);
>> +	val = ivm_get_value (buf, CFG_IVM_EEPROM_PAGE_LEN, "IVM_HWKey", 6, 1);
>> +	if (val != 0xffff) {
>> +		sprintf ((char *)valbuf, "%x", ((val /100) % 10));
>> +		setenv ("IVM_HWVariant", (char *)valbuf);
>> +		sprintf ((char *)valbuf, "%x", (val % 100));
>> +		setenv ("IVM_HWVersion", (char *)valbuf);
>> +	}
> 
> You're really polluting the environment here.

I know.

> Is this reasonable?

Hmm... I think so, because the manufacturer wants all of this vars, and
if I am right, you or Detlev arranged it.

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2008-09-29  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29  7:56 [U-Boot] [PATCH] mgcoge, mgsuvd: added support for the IVM EEprom Heiko Schocher
2008-09-29  9:10 ` Wolfgang Denk
2008-09-29  9:57   ` Heiko Schocher [this message]
2008-09-29 11:49   ` Jerry Van Baren
2008-10-14 16:32 ` Wolfgang Denk

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=48E0A697.4000808@denx.de \
    --to=hs@denx.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