[U-Boot] [PATCH v3 8/8] arm/km: update mgcoge3un board support

Holger Brunck holger.brunck at keymile.com
Fri May 13 16:12:19 CEST 2011


Hi Prafulla,
thanks for reviewing.

On 05/12/2011 01:01 PM, Prafulla Wadaskar wrote:
> 
> 
>> -----Original Message-----
>> From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
>> Sent: Wednesday, May 04, 2011 9:24 PM
>> To: u-boot at lists.denx.de
>> Cc: holger.brunck at keymile.com; Prafulla Wadaskar; Valentin Longchamp;
>> Wolfgang Denk; Detlev Zundel
>> Subject: [PATCH v3 8/8] arm/km: update mgcoge3un board support
>>
>> From: Holger Brunck <holger.brunck at keymile.com>
> 
> This line should be removed or moved to cc/ack/test list, it will appear in commit log
> 

this is only the indication that the patch is not from Valentin and is common
practice or am I wrong? Patch 5/8 in the serie does exactly the same.

>>
>> We change default settings for egiga on mgcoge3un.
>> The reason we need this is that we have the gig port on mgcoge3un
>> connected using a back-to-back pair of PHYs. There are no magnetics and
>> because of that the port has to be run with a fixd configuration and
>> auto-negotiation must be disabled. In the default mode the egiga driver
>> uses autoneg to determine port speed - which defaults to 1G (we need
>> 100M full duplex).
>>
>> Add wait for the GPIO line connected to mgcoge3ne before
>> starting mgcoge3un. A board specific ethernet present function
>> was added, because on this board ethernet is always present.
>> The BOCO FPGA access was enhanced and changed to use register
>> definitions.
>>
>> Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
>> Acked-by: Heiko Schocher <hs at denx.de>
>> cc: Wolfgang Denk <wd at denx.de>
>> cc: Detlev Zundel <dzu at denx.de>
>> cc: Prafulla Wadaskar <prafulla at marvell.com>
>> ---
>> Changes for v2:
>>    - split up first large patch series to three independent smaller
>>      patch series
>> Changes for v3:
>>    - taken Prafulla's comments into account, merged with previous 08/08
>> patch
>>
>>  board/keymile/km_arm/km_arm.c |   80 +++++++++++++++++++++++++++++++++-
>> ------
>>  include/configs/mgcoge3un.h   |   25 +++++++++++++
>>  2 files changed, 91 insertions(+), 14 deletions(-)
>>
>> diff --git a/board/keymile/km_arm/km_arm.c
>> b/board/keymile/km_arm/km_arm.c
>> index 4049a4e..d86acc9 100644
>> --- a/board/keymile/km_arm/km_arm.c
>> +++ b/board/keymile/km_arm/km_arm.c
>> @@ -41,6 +41,16 @@
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> +/*
>> + * BOCO FPGA definitions
>> + */
>> +#define BOCO		0x10
>> +#define REG_CTRL_H		0x02
>> +#define MASK_WRL_UNITRUN	0x01
>> +#define MASK_RBX_PGY_PRESENT	0x40
>> +#define REG_IRQ_CIRQ2		0x2d
>> +#define MASK_RBI_DEFECT_16	0x01
>> +
>>  /* Multi-Purpose Pins Functionality configuration */
>>  u32 kwmpp_config[] = {
>>  	MPP0_NF_IO2,
>> @@ -102,43 +112,64 @@ u32 kwmpp_config[] = {
>>  	0
>>  };
>>
>> +#if defined(CONFIG_MGCOGE3UN)
>> +/*
>> + * Wait for startup OK from mgcoge3ne
>> + */
>> +int startup_allowed(void)
>> +{
>> +	unsigned char buf;
>> +
>> +	/*
>> +	 * Read CIRQ16 bit (bit 0)
>> +	 */
>> +	if (i2c_read(BOCO, REG_IRQ_CIRQ2, 1, &buf, 1) != 0)
>> +		printf("%s: Error reading Boco\n", __func__);
>> +	else
>> +		if ((buf & MASK_RBI_DEFECT_16) == MASK_RBI_DEFECT_16)
>> +			return 1;
>> +	return 0;
>> +}
>> +
>> +/*
>> + * mgcoge3un has always ethernet present. Its connected to the 6061
>> switch
>> + * and provides ICNev and piggy4 connections.
>> + */
>> +int ethernet_present(void)
>> +{
>> +	return 1;
>> +}
>> +#else
>>  int ethernet_present(void)
>>  {
>>  	uchar	buf;
>>  	int	ret = 0;
>>
>> -	if (i2c_read(0x10, 2, 1, &buf, 1) != 0) {
>> +	if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {
>>  		printf("%s: Error reading Boco\n", __func__);
>>  		return -1;
>>  	}
>> -	if ((buf & 0x40) == 0x40)
>> +	if ((buf & MASK_RBX_PGY_PRESENT) == MASK_RBX_PGY_PRESENT)
> 
> You can #if here instead of as done above, it will help to reduce code size and will be more readable.
> I am sorry if I missed this in the earlier post.
>  

hm, #if is evaluated during compile time and buf is a variable determined
runtime. What do you mean exactly?

Best regards
Holger Brunck


More information about the U-Boot mailing list