public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Holger Brunck <holger.brunck@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 05/15] powerpc/83xx/km: add MV88E6122 switch support for kmvect1
Date: Fri, 18 Jan 2013 10:14:39 +0100	[thread overview]
Message-ID: <50F9127F.90009@keymile.com> (raw)
In-Reply-To: <20130117184438.0e7cc453ebdc3bac6c14d416@freescale.com>

On 01/18/2013 01:44 AM, Kim Phillips wrote:
> On Thu, 17 Jan 2013 13:47:51 +0100
> Holger Brunck <holger.brunck@keymile.com> wrote:
> 
>> +#if defined(CONFIG_KMVECT1)
>> +#include <mv88e6352.h>
>> +/* Marvell MV88E6122 switch configuration */
>> +struct mv88e_sw_reg extsw_conf[] = {
>> +	/* port 1, FRONT_MDI, autoneg */
>> +	{ PORT(1), PORT_PHY, NO_SPEED_FOR },
>> +	{ PORT(1), PORT_CTRL, FORWARDING | EGRS_FLD_ALL },
>> +	{ PHY(1), PHY_1000_CTRL, NO_ADV },
>> +	{ PHY(1), PHY_SPEC_CTRL, AUTO_MDIX_EN },
>> +	{ PHY(1), PHY_CTRL, PHY_100_MBPS | AUTONEG_EN | AUTONEG_RST |
>> +		FULL_DUPLEX },
>> +	/* port 2, unused */
>> +	{ PORT(2), PORT_CTRL, PORT_DIS },
>> +	{ PHY(2), PHY_CTRL, PHY_PWR_DOWN },
>> +	{ PHY(2), PHY_SPEC_CTRL, SPEC_PWR_DOWN },
>> +	/* port 3, BP_MII (CPU), PHY mode, 100BASE */
>> +	{ PORT(3), PORT_CTRL, FORWARDING | EGRS_FLD_ALL },
>> +	/* port 4, ESTAR to slot 11, SerDes, 1000BASE-X */
>> +	{ PORT(4), PORT_STATUS, NO_PHY_DETECT },
>> +	{ PORT(4), PORT_PHY, SPEED_1000_FOR },
>> +	{ PORT(4), PORT_CTRL, FORWARDING | EGRS_FLD_ALL },
>> +	/* port 5, ESTAR to slot 13, SerDes, 1000BASE-X */
>> +	{ PORT(5), PORT_STATUS, NO_PHY_DETECT },
>> +	{ PORT(5), PORT_PHY, SPEED_1000_FOR },
>> +	{ PORT(5), PORT_CTRL, FORWARDING | EGRS_FLD_ALL },
>> +	/*
>> +	 * Errata Fix: 1.9V Output from Internal 1.8V Regulator,
>> +	 * acc . MV-S300889-00D.pdf , clause 4.5
>> +	 */
>> +	{ PORT(5), 0x1A, 0xADB1 },
>> +	/* port 6, unused, this port has no phy */
>> +	{ PORT(6), PORT_CTRL, PORT_DIS },
>> +};
>> +#endif
> 
> this chunk introduces a new sparse warning:
> 
> km83xx.c:217:21: warning: symbol 'extsw_conf' was not declared. Should it be static?
> 

Ok. I'll fix this in v2.

>>  int last_stage_init(void)
>>  {
>> +#if defined(CONFIG_KMVECT1)
>> +	struct km_bec_fpga *base =
>> +		(struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE;
>> +	u8 tmp_reg;
>> +
>> +	/* Release mv88e6122 from reset */
>> +	tmp_reg = in_8(&base->res1[0]) | 0x10; /* DIRECT3 register */
>> +	out_8(&base->res1[0], tmp_reg);	       /* GP28 as output */
>> +	tmp_reg = in_8(&base->gprt3) | 0x10;   /* GP28 to high */
>> +	out_8(&base->gprt3, tmp_reg);
>> +
>> +	/* configure MV88E6122 switch */
>> +	char *name = "UEC2";
>> +
>> +	if (miiphy_set_current_dev(name))
>> +		return 0;
>> +
>> +	mv88e_sw_program(name, CONFIG_KM_MVEXTSW_ADDR, extsw_conf,
>> +		ARRAY_SIZE(extsw_conf));
>> +
>> +	mv88e_sw_reset(name, CONFIG_KM_MVEXTSW_ADDR);
>> +
>> +	if (piggy_present()) {
>> +		uchar enetaddr[6];
>> +		if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
>> +			/* increment last 3 bytes */
>> +			u32 val = (enetaddr[3] << 16) + (enetaddr[4] << 8)
>> +				+ enetaddr[5];
>> +			val++;
>> +			enetaddr[3] = (val >> 16) & 0xFF;
>> +			enetaddr[4] = (val >>  8) & 0xFF;
>> +			enetaddr[5] = (val >>  0) & 0xFF;
>> +			if (!eth_setenv_enetaddr("eth1addr", enetaddr)) {
>> +				setenv("ethact", "UEC2");
>> +				setenv("netdev", "eth1");
>> +				puts("using PIGGY for network boot\n");
>> +			} else
>> +				puts("using frontport for network boot\n");
>> +		}
>> +	} else
>> +		puts("using frontport for network boot\n");
>> +#endif
>> +
> 
> AFAIK, assigning the switch MAC address to the front port's MAC
> address plus one isn't acceptable practice for u-boot board code.
> Get eth1addr in the same manner ethaddr is obtained/assigned.
> 

Because you may get a MAC adress which is already given to someone else? In our
case this can't happen. We reserve for one instance of this board exactly two
MAC adresses. The first one is read out at startup from the inventory in
keymile/common/ivm.c. The second one is calculated like above. But it is a
unique MAC adress, because exactly this MAC adress is reserved for this board.
But maybe we should move the code to the location where we set ethaddr, even if
the calculation would be the same?

>> +#if !defined(CONFIG_MPC8309)
>>  #define CONFIG_UEC_ETH1		/* GETH1 */
>>  #define UEC_VERBOSE_DEBUG	1
>> +#endif
>>  
>>  #ifdef CONFIG_UEC_ETH1
>> -#if defined(CONFIG_MPC8309)
>> -#define CONFIG_SYS_UEC1_UCC_NUM	2	/* UCC3 */
>> -#define CONFIG_SYS_UEC1_RX_CLK		QE_CLK_NONE /* not used in RMII Mode */
>> -#define CONFIG_SYS_UEC1_TX_CLK		QE_CLK12
>> -#else
>>  #define CONFIG_SYS_UEC1_UCC_NUM	3	/* UCC4 */
>>  #define CONFIG_SYS_UEC1_RX_CLK		QE_CLK_NONE /* not used in RMII Mode */
>>  #define CONFIG_SYS_UEC1_TX_CLK		QE_CLK17
>> -#endif
>>  #define CONFIG_SYS_UEC1_ETH_TYPE	FAST_ETH
>>  #define CONFIG_SYS_UEC1_PHY_ADDR	0
>>  #define CONFIG_SYS_UEC1_INTERFACE_TYPE	PHY_INTERFACE_MODE_RMII
> 
> how are these changes related?
> 

kmvect1 is a MPC8309 board and the only board in our board serie with this
processor. Without the switch we used more or less the config options from
km83xx-common.h. But because of the new functionality we need an completely own
configuration. So we moved the remaining stuff in the board specific part for
kmvect1.

Regards
Holger

  reply	other threads:[~2013-01-18  9:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 12:47 [U-Boot] [PATCH 00/15] updates for km83xx boards Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 01/15] km/common: remove unneeded ifdefs for I2C Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 02/15] km/common/ivm: remove obsolete code Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 03/15] km/common/ivm: remove CONFIG_SYS_I2C_IVM_BUS related code Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 04/15] km82xx, km83xx: move ethernet_present() from common to cpu specific Holger Brunck
2013-01-18  0:23   ` Kim Phillips
2013-01-18  8:07     ` Holger Brunck
2013-01-18 21:09       ` Kim Phillips
2013-01-17 12:47 ` [U-Boot] [PATCH 05/15] powerpc/83xx/km: add MV88E6122 switch support for kmvect1 Holger Brunck
2013-01-18  0:44   ` Kim Phillips
2013-01-18  9:14     ` Holger Brunck [this message]
2013-01-18 21:12       ` Kim Phillips
2013-01-21  9:45         ` Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 06/15] powerpc/83xx: use ppc_6xx as arch variable " Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 07/15] km/common: introduce $uimage variable Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 08/15] km/scripts: replace hardcoded uImage Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 09/15] kmeter1_nand: allow usage of NAND_ECC_SOFT_BCH Holger Brunck
2013-01-17 16:00   ` Scott Wood
2013-01-17 12:47 ` [U-Boot] [PATCH 10/15] powerpc/83xx: use NAND_ECC_BCH for kmcoge5ne Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 11/15] km/common: add eccmode to kernel commandline Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 12/15] powerpc/83xx/km: cleanup tuxx1 support Holger Brunck
2013-01-17 12:47 ` [U-Boot] [PATCH 13/15] powerpc/83xx/km: add support for kmopti2 board Holger Brunck
2013-01-17 12:48 ` [U-Boot] [PATCH 14/15] poweprc/83xx/km: remove uneeded CONFIG_MISC_INIT_R Holger Brunck
2013-01-17 12:48 ` [U-Boot] [PATCH 15/15] powerpc/83xx/km: drop uneeded dtt_bus environment var Holger Brunck
2013-01-17 14:30 ` [U-Boot] [PATCH 00/15] updates for km83xx boards Prafulla Wadaskar
2013-01-17 14:35   ` Holger Brunck

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=50F9127F.90009@keymile.com \
    --to=holger.brunck@keymile.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox