[U-Boot-Users] [PATCH] CONFIG_ETHxADDR consolidation

Jon Loeliger jdl at freescale.com
Tue Aug 24 20:39:03 CEST 2004


Wolfgang,

Here is a patch that basically converts a scattering of

#if (defined CONFIG_PN62) || (defined CONFIG_PPCHAMELEONEVB) || \
    (defined CONFIG_MPC8540ADS) || (defined CONFIG_MPC8560ADS) || \
    (defined CONFIG_MPC8555CDS)

areas into this:

#if defined(CONFIG_ETH1ADDR)

This affects the files:

    common/cmd_bdinfo.c
    include/asm-ppc/u-boot.h
    lib_ppc/board.c

and the following boards:

    CFG_GT_6426x
    CONFIG_PN62
    CONFIG_PPCHAMELEONEVB
    CONFIG_SXNI855T   (Dave Ellis OK'ed)
    CONFIG_SVM_SC8xx
    CONFIG_MPC8540ADS (me)
    CONFIG_MPC8555CDS (me) 
    CONFIG_MPC8560ADS (me)
    CONFIG_440_GX     (Travis Sawyer OK'ed)

I didn't address the "CONFIG_HAS_ETH1" concept at all here.
I don't know the intent of the owner of the PN62, the
PPCHAMELEONVB, nor the SC8xx boards, so they may want to
either verify these changes or contact me as needed.

Note that this patch affects CONFIG_ETH1ADDR, CONFIG_ETH2ADDR,
and CONFIG_ETH3ADDR uniformly.

Thanks,
jdl


* Patch by Jon Loeliger, 24-Aug-2004
  Made the presence of ethXaddr be dependent on CONFIG_ETHxADDR
  rather than a collection of board CONFIG_ names.


diff -ruN --exclude=CVS u-boot-public-cvs/u-boot-20040823/common/cmd_bdinfo.c internal-development/u-boot-pq3/common/cmd_bdinfo.c
--- u-boot-public-cvs/u-boot-20040823/common/cmd_bdinfo.c	2004-06-08 19:34:47.000000000 -0500
+++ internal-development/u-boot-pq3/common/cmd_bdinfo.c	2004-08-19 14:22:18.000000000 -0500
@@ -79,24 +79,33 @@
 #endif
 	print_str ("busfreq",	    strmhz(buf, bd->bi_busfreq));
 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
+
 	puts ("ethaddr     =");
 	for (i=0; i<6; ++i) {
 		printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
 	}
-#if (defined CONFIG_PN62) || (defined CONFIG_PPCHAMELEONEVB) || \
-    (defined CONFIG_MPC8540ADS) || (defined CONFIG_MPC8560ADS) || \
-    (defined CONFIG_MPC8555CDS)
+
+#if defined(CONFIG_ETH1ADDR)
 	puts ("\neth1addr    =");
 	for (i=0; i<6; ++i) {
 		printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
 	}
-#endif /* CONFIG_PN62 */
-#if defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS) || defined(CONFIG_MPC8555CDS)
+#endif
+
+#if defined(CONFIG_ETH2ADDR)
        puts ("\neth2addr    =");
        for (i=0; i<6; ++i) {
 		printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
 	}
 #endif
+
+#if defined(CONFIG_ETH3ADDR)
+       puts ("\neth3addr    =");
+       for (i=0; i<6; ++i) {
+		printf ("%c%02X", i ? ':' : ' ', bd->bi_enet3addr[i]);
+	}
+#endif
+
 #ifdef CONFIG_HERMES
 	print_str ("ethspeed",	    strmhz(buf, bd->bi_ethspeed));
 #endif
diff -ruN --exclude=CVS u-boot-public-cvs/u-boot-20040823/include/asm-ppc/u-boot.h internal-development/u-boot-pq3/include/asm-ppc/u-boot.h
--- u-boot-public-cvs/u-boot-20040823/include/asm-ppc/u-boot.h	2004-06-08 19:51:51.000000000 -0500
+++ internal-development/u-boot-pq3/include/asm-ppc/u-boot.h	2004-08-19 14:28:54.000000000 -0500
@@ -77,27 +77,19 @@
 #if defined(CONFIG_HYMOD)
 	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */
 #endif
-#if defined(CFG_GT_6426x)		|| \
-    defined(CONFIG_PN62)		|| \
-    defined(CONFIG_PPCHAMELEONEVB)	|| \
-    defined(CONFIG_SXNI855T)		|| \
-    defined(CONFIG_SVM_SC8xx)		|| \
-    defined(CONFIG_MPC8540ADS)          || \
-    defined(CONFIG_MPC8555CDS)		|| \
-    defined(CONFIG_MPC8560ADS)		|| \
-    defined(CONFIG_440_GX)
+
+#if defined(CONFIG_ETH1ADDR)
 	/* second onboard ethernet port */
 	unsigned char   bi_enet1addr[6];
 #endif
-#if defined(CFG_GT_6426x) || defined(CONFIG_SVM_SC8xx) || \
-    defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS) || \
-    defined(CONFIG_MPC8555CDS) || defined(CONFIG_440_GX)
+#if defined(CONFIG_ETH2ADDR)
 	/* third onboard ethernet port */
 	unsigned char	bi_enet2addr[6];
 #endif
-#if defined(CONFIG_440_GX)
+#if defined(CONFIG_ETH3ADDR)
 	unsigned char   bi_enet3addr[6];
 #endif
+
 #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined (CONFIG_440_GX)
 	unsigned int	bi_opbfreq;		/* OPB clock in Hz */
 	int		bi_iic_fast[2];		/* Use fast i2c mode */
diff -ruN --exclude=CVS u-boot-public-cvs/u-boot-20040823/lib_ppc/board.c internal-development/u-boot-pq3/lib_ppc/board.c
--- u-boot-public-cvs/u-boot-20040823/lib_ppc/board.c	2004-08-01 17:48:22.000000000 -0500
+++ internal-development/u-boot-pq3/lib_ppc/board.c	2004-08-19 14:31:13.000000000 -0500
@@ -779,9 +779,7 @@
 	load_sernum_ethaddr ();
 #endif
 
-#if defined(CFG_GT_6426x) || defined(CONFIG_PN62) || defined(CONFIG_PPCHAMELEONEVB) || \
-    defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8555CDS) || \
-    defined(CONFIG_MPC8560ADS) || defined(CONFIG_440_GX)
+#if defined(CONFIG_ETH1ADDR)
 	/* handle the 2nd ethernet address */
 
 	s = getenv ("eth1addr");
@@ -792,9 +790,7 @@
 			s = (*e) ? e + 1 : e;
 	}
 #endif
-#if defined(CFG_GT_6426x) || defined(CONFIG_MPC8540ADS) || \
-    defined(CONFIG_MPC8555CDS) || defined(CONFIG_MPC8560ADS) || \
-    defined(CONFIG_440_GX)
+#if defined(CONFIG_ETH2ADDR)
 	/* handle the 3rd ethernet address */
 
 	s = getenv ("eth2addr");
@@ -810,7 +806,7 @@
 	}
 #endif
 
-#if defined(CONFIG_440_GX)
+#if defined(CONFIG_ETH3ADDR)
 	/* handle 4th ethernet address */
 	s = getenv("eth3addr");
 #if defined(CONFIG_XPEDITE1K)







More information about the U-Boot mailing list