[U-Boot-Users] [PATCH] Clean up dependency in bit-banged MDIO

Ben Warren bwarren at qstreams.com
Wed Sep 27 00:11:43 CEST 2006


Hello,

Attached is a patch that allows use of memory-mapped devices other than
CPU GPIO on boards when bit-banging MDIO.  The config option MDIO_PORT
is now the differentiator as to whether the memory mapped device is on a
CPU port or not.

CHANGELOG:

* Changed conditional inclusion of ioport variable to boards that define
the MDIO_PORT macro.

regards,
Ben

diff --git a/include/configs/ep8248.h b/include/configs/ep8248.h
index 04147a5..f6515b3 100644
--- a/include/configs/ep8248.h
+++ b/include/configs/ep8248.h
@@ -102,7 +102,7 @@
 /*
  * GPIO pins used for bit-banged MII communications
  */
-#define MDIO_PORT		0	/* Not used - implemented in BCSR */
+#undef MDIO_PORT			/* Not used - implemented in BCSR */
 #define MDIO_ACTIVE		(*(vu_char *)(CFG_BCSR + 8) &= 0xFB)
 #define MDIO_TRISTATE		(*(vu_char *)(CFG_BCSR + 8) |= 0x04)
 #define MDIO_READ		(*(vu_char *)(CFG_BCSR + 8) & 1)
diff --git a/common/miiphybb.c b/common/miiphybb.c
index adb697c..9ea5636 100644
--- a/common/miiphybb.c
+++ b/common/miiphybb.c
@@ -41,7 +41,7 @@
 static void miiphy_pre (char read, unsigned char addr, unsigned char
reg)
 {
 	int j;			/* counter */
-#ifndef CONFIG_EP8248
+#if defined(MDIO_PORT)
 	volatile ioport_t *iop = ioport_addr ((immap_t *) CFG_IMMR,
MDIO_PORT);
 #endif
 
@@ -126,7 +126,7 @@ int bb_miiphy_read (char *devname, unsig
 {
 	short rdreg;		/* register working value */
 	int j;			/* counter */
-#ifndef CONFIG_EP8248
+#if defined(MDIO_PORT)
 	volatile ioport_t *iop = ioport_addr ((immap_t *) CFG_IMMR,
MDIO_PORT);
 #endif
 
@@ -193,7 +193,7 @@ int bb_miiphy_write (char *devname, unsi
 		unsigned char reg, unsigned short value)
 {
 	int j;			/* counter */
-#ifndef CONFIG_EP8248
+#if defined(MDIO_PORT)
 	volatile ioport_t *iop = ioport_addr ((immap_t *) CFG_IMMR,
MDIO_PORT);
 #endif






More information about the U-Boot mailing list