From: Wolfgang Denk Date: Wed, 20 May 2009 21:42:35 +0200 Subject: [U-Boot] [PATCH 11/15] MPC85xx: update uec to support up to 8 UECs in QE In-Reply-To: <1242837043-8243-11-git-send-email-Haiying.Wang@freescale.com> References: <1242837043-8243-1-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-2-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-3-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-4-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-5-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-6-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-7-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-8-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-9-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-10-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-11-git-send-email-Haiying.Wang@freescale.com> Message-ID: <20090520194235.31926832E416@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Haiying Wang, In message <1242837043-8243-11-git-send-email-Haiying.Wang@freescale.com> you wrote: > Signed-off-by: Haiying Wang > --- > cpu/mpc85xx/cpu.c | 6 +++++ > cpu/mpc85xx/fdt.c | 4 ++- > drivers/qe/uec.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++- > 3 files changed, 74 insertions(+), 2 deletions(-) > > diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c > index b812d88..eb2aeec 100644 > --- a/cpu/mpc85xx/cpu.c > +++ b/cpu/mpc85xx/cpu.c > @@ -399,6 +399,12 @@ int cpu_eth_init(bd_t *bis) > #if defined(CONFIG_UEC_ETH6) > uec_initialize(5); > #endif > +#if defined(CONFIG_UEC_ETH7) > + uec_initialize(6); > +#endif > +#if defined(CONFIG_UEC_ETH8) > + uec_initialize(7); > +#endif This cries for using a loop instead. There are several places that contain similar code - would it make sense to initialize a variable with a bit files of used interfaces, so we can do this in a simple runtime loop? > #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\ > - defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) > + defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\ > + defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5) ||\ > + defined(CONFIG_HAS_ETH6) || defined(CONFIG_HAS_ETH7) > fdt_fixup_ethernet(blob); Ditto here. > #ifdef CONFIG_UEC_ETH6 > uec_info = ð6_uec_info; > #endif > + } else if (index == 6) { > +#ifdef CONFIG_UEC_ETH7 > + uec_info = ð7_uec_info; > +#endif > + } else if (index == 7) { > +#ifdef CONFIG_UEC_ETH8 > + uec_info = ð8_uec_info; > +#endif And here again. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A morsel of genuine history is a thing so rare as to be always valuable. - Thomas Jefferson