Clears up checkpatch.pl complaint about extern in c file
Completes the effort started by Ben Warren in 2008 to generalize
eth init

Signed-off-by: Joe Hershberger <joe.hershber...@ni.com>
Cc: Joe Hershberger <joe.hershber...@gmail.com>
Cc: Wolfgang Denk <w...@denx.de>
---
 board/Marvell/db64360/db64360.c |   12 ++++++-
 board/Marvell/db64360/mv_eth.c  |   76 +++++++++++++++++++++++++++++++++++----
 board/Marvell/db64360/mv_eth.h  |   63 +-------------------------------
 board/Marvell/db64460/db64460.c |   12 ++++++-
 board/Marvell/db64460/mv_eth.c  |   76 +++++++++++++++++++++++++++++++++++----
 board/Marvell/db64460/mv_eth.h  |   63 +-------------------------------
 board/esd/cpci750/cpci750.c     |    6 +++
 board/esd/cpci750/mv_eth.c      |   76 +++++++++++++++++++++++++++++++++++----
 board/esd/cpci750/mv_eth.h      |   63 +-------------------------------
 board/prodrive/p3mx/mv_eth.c    |   76 +++++++++++++++++++++++++++++++++++----
 board/prodrive/p3mx/mv_eth.h    |   63 +-------------------------------
 board/prodrive/p3mx/p3mx.c      |    6 +++
 net/eth.c                       |    9 -----
 13 files changed, 314 insertions(+), 287 deletions(-)

diff --git a/board/Marvell/db64360/db64360.c b/board/Marvell/db64360/db64360.c
index 5183466..c66dc14 100644
--- a/board/Marvell/db64360/db64360.c
+++ b/board/Marvell/db64360/db64360.c
@@ -40,6 +40,7 @@
 #include "mpsc.h"
 #include "i2c.h"
 #include "64360.h"
+#include "mv_eth.h"
 #include "mv_regs.h"
 
 #undef DEBUG
@@ -934,5 +935,14 @@ void board_prebootm_init ()
 
 int board_eth_init(bd_t *bis)
 {
-       return pci_eth_init(bis);
+       int pci_retval;
+       int mv_retval;
+
+       pci_retval = pci_eth_init(bis);
+       mv_retval = mv6436x_eth_initialize(bis);
+
+       if (pci_retval < 0 && mv_retval < 0)
+               return -1;
+       else
+               return 0;
 }
diff --git a/board/Marvell/db64360/mv_eth.c b/board/Marvell/db64360/mv_eth.c
index 550610e..c6b618f 100644
--- a/board/Marvell/db64360/mv_eth.c
+++ b/board/Marvell/db64360/mv_eth.c
@@ -78,6 +78,67 @@
 #define MV_SET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) |= ((unsigned 
int)my_cpu_to_le32(bits)))
 #define MV_RESET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) &= ~((unsigned 
int)my_cpu_to_le32(bits)))
 
+/* ethernet.h API list */
+
+/* Port operation control routines */
+static void eth_port_init(ETH_PORT_INFO *p_eth_port_ctrl);
+static void eth_port_reset(ETH_PORT    eth_port_num);
+static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
+
+
+/* Port MAC address routines */
+static void eth_port_uc_addr_set(ETH_PORT eth_port_num,
+                                 unsigned char *p_addr,
+                                 ETH_QUEUE queue);
+#if 0  /* FIXME */
+static void eth_port_mc_addr(ETH_PORT eth_port_num,
+                                unsigned char *p_addr,
+                                ETH_QUEUE queue,
+                                int option);
+#endif
+
+/* PHY and MIB routines */
+static bool ethernet_phy_reset(ETH_PORT eth_port_num);
+
+static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
+                                  unsigned int phy_reg,
+                                  unsigned int value);
+
+static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
+                                 unsigned int phy_reg,
+                                 unsigned int *value);
+
+static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
+
+/* Port data flow control routines */
+static ETH_FUNC_RET_STATUS eth_port_send(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE tx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE tx_queue,
+                                             PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_port_receive(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE rx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE rx_queue,
+                                             PKT_INFO *p_pkt_info);
+
+
+static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   tx_queue,
+                                   int                         tx_desc_num,
+                                   int                         tx_buff_size,
+                                   unsigned int        tx_desc_base_addr,
+                                   unsigned int        tx_buff_base_addr);
+
+static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   rx_queue,
+                                   int                         rx_desc_num,
+                                   int                         rx_buff_size,
+                                   unsigned int        rx_desc_base_addr,
+                                   unsigned int        rx_buff_base_addr);
+
 /* Static function declarations */
 static int mv64360_eth_real_open (struct eth_device *eth);
 static int mv64360_eth_real_stop (struct eth_device *eth);
@@ -203,7 +264,7 @@ void db64360_eth_disable (struct eth_device *dev)
 }
 
 
-void mv6436x_eth_initialize (bd_t * bis)
+int mv6436x_eth_initialize(bd_t *bis)
 {
        struct eth_device *dev;
        ETH_PORT_INFO *ethernet_private;
@@ -216,7 +277,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                if (!dev) {
                        printf ("%s: mv_enet%d allocation failure, %s\n",
                                __FUNCTION__, devnum, "eth_device structure");
-                       return;
+                       return -1;
                }
 
                /* must be less than NAMESIZE (16) */
@@ -243,7 +304,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -273,7 +334,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                                __FUNCTION__, dev->name,
                                "Private Device Structure");
                        free (dev);
-                       return;
+                       return -1;
                }
                /* start with an zeroed ETH_PORT_INFO */
                memset (ethernet_private, 0, sizeof (ETH_PORT_INFO));
@@ -289,7 +350,7 @@ void mv6436x_eth_initialize (bd_t * bis)
 
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
 
                port_private->stats =
@@ -302,7 +363,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                        free (port_private);
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
                memset (ethernet_private->port_private, 0,
                        sizeof (struct mv64360_eth_priv));
@@ -346,7 +407,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -390,6 +451,7 @@ void mv6436x_eth_initialize (bd_t * bis)
        }
        DP (printf ("%s: exit\n", __FUNCTION__));
 
+       return 0;
 }
 
 /**********************************************************************
diff --git a/board/Marvell/db64360/mv_eth.h b/board/Marvell/db64360/mv_eth.h
index 142910b..9b2a4da 100644
--- a/board/Marvell/db64360/mv_eth.h
+++ b/board/Marvell/db64360/mv_eth.h
@@ -165,6 +165,7 @@ struct mv64360_eth_priv {
 };
 
 
+int mv6436x_eth_initialize(bd_t *bis);
 int mv64360_eth_init (struct eth_device *dev);
 int mv64360_eth_stop (struct eth_device *dev);
 int mv64360_eth_start_xmit (struct eth_device*, volatile void* packet, int 
length);
@@ -778,66 +779,4 @@ typedef struct _eth_port_ctrl
 
 } ETH_PORT_INFO;
 
-
-/* ethernet.h API list */
-
-/* Port operation control routines */
-static void eth_port_init (ETH_PORT_INFO *p_eth_port_ctrl);
-static void eth_port_reset(ETH_PORT    eth_port_num);
-static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
-
-
-/* Port MAC address routines */
-static void eth_port_uc_addr_set (ETH_PORT eth_port_num,
-                                 unsigned char *p_addr,
-                                 ETH_QUEUE queue);
-#if 0  /* FIXME */
-static void eth_port_mc_addr   (ETH_PORT eth_port_num,
-                                unsigned char *p_addr,
-                                ETH_QUEUE queue,
-                                int option);
-#endif
-
-/* PHY and MIB routines */
-static bool ethernet_phy_reset(ETH_PORT eth_port_num);
-
-static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
-                                  unsigned int phy_reg,
-                                  unsigned int value);
-
-static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
-                                 unsigned int phy_reg,
-                                 unsigned int* value);
-
-static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
-
-/* Port data flow control routines */
-static ETH_FUNC_RET_STATUS eth_port_send    (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE tx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE tx_queue,
-                                             PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_port_receive (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE rx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE rx_queue,
-                                             PKT_INFO *p_pkt_info);
-
-
-static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   tx_queue,
-                                   int                         tx_desc_num,
-                                   int                         tx_buff_size,
-                                   unsigned int        tx_desc_base_addr,
-                                   unsigned int        tx_buff_base_addr);
-
-static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   rx_queue,
-                                   int                         rx_desc_num,
-                                   int                         rx_buff_size,
-                                   unsigned int        rx_desc_base_addr,
-                                   unsigned int        rx_buff_base_addr);
-
 #endif /* MV64360_ETH_ */
diff --git a/board/Marvell/db64460/db64460.c b/board/Marvell/db64460/db64460.c
index a7836ed..de201b5 100644
--- a/board/Marvell/db64460/db64460.c
+++ b/board/Marvell/db64460/db64460.c
@@ -40,6 +40,7 @@
 #include "mpsc.h"
 #include "i2c.h"
 #include "64460.h"
+#include "mv_eth.h"
 #include "mv_regs.h"
 
 #undef DEBUG
@@ -934,5 +935,14 @@ void board_prebootm_init ()
 
 int board_eth_init(bd_t *bis)
 {
-       return pci_eth_init(bis);
+       int pci_retval;
+       int mv_retval;
+
+       pci_retval = pci_eth_init(bis);
+       mv_retval = mv6446x_eth_initialize(bis);
+
+       if (pci_retval < 0 && mv_retval < 0)
+               return -1;
+       else
+               return 0;
 }
diff --git a/board/Marvell/db64460/mv_eth.c b/board/Marvell/db64460/mv_eth.c
index c447229..2630b85 100644
--- a/board/Marvell/db64460/mv_eth.c
+++ b/board/Marvell/db64460/mv_eth.c
@@ -78,6 +78,67 @@
 #define MV_SET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) |= ((unsigned 
int)my_cpu_to_le32(bits)))
 #define MV_RESET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) &= ~((unsigned 
int)my_cpu_to_le32(bits)))
 
+/* ethernet.h API list */
+
+/* Port operation control routines */
+static void eth_port_init(ETH_PORT_INFO *p_eth_port_ctrl);
+static void eth_port_reset(ETH_PORT    eth_port_num);
+static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
+
+
+/* Port MAC address routines */
+static void eth_port_uc_addr_set(ETH_PORT eth_port_num,
+                                 unsigned char *p_addr,
+                                 ETH_QUEUE queue);
+#if 0  /* FIXME */
+static void eth_port_mc_addr(ETH_PORT eth_port_num,
+                                unsigned char *p_addr,
+                                ETH_QUEUE queue,
+                                int option);
+#endif
+
+/* PHY and MIB routines */
+static bool ethernet_phy_reset(ETH_PORT eth_port_num);
+
+static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
+                                  unsigned int phy_reg,
+                                  unsigned int value);
+
+static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
+                                 unsigned int phy_reg,
+                                 unsigned int *value);
+
+static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
+
+/* Port data flow control routines */
+static ETH_FUNC_RET_STATUS eth_port_send(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE tx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE tx_queue,
+                                             PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_port_receive(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE rx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE rx_queue,
+                                             PKT_INFO *p_pkt_info);
+
+
+static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   tx_queue,
+                                   int                         tx_desc_num,
+                                   int                         tx_buff_size,
+                                   unsigned int        tx_desc_base_addr,
+                                   unsigned int        tx_buff_base_addr);
+
+static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   rx_queue,
+                                   int                         rx_desc_num,
+                                   int                         rx_buff_size,
+                                   unsigned int        rx_desc_base_addr,
+                                   unsigned int        rx_buff_base_addr);
+
 /* Static function declarations */
 static int mv64460_eth_real_open (struct eth_device *eth);
 static int mv64460_eth_real_stop (struct eth_device *eth);
@@ -203,7 +264,7 @@ void db64460_eth_disable (struct eth_device *dev)
 }
 
 
-void mv6446x_eth_initialize (bd_t * bis)
+int mv6446x_eth_initialize(bd_t *bis)
 {
        struct eth_device *dev;
        ETH_PORT_INFO *ethernet_private;
@@ -216,7 +277,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                if (!dev) {
                        printf ("%s: mv_enet%d allocation failure, %s\n",
                                __FUNCTION__, devnum, "eth_device structure");
-                       return;
+                       return -1;
                }
 
                /* must be less than NAMESIZE (16) */
@@ -243,7 +304,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -272,7 +333,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                                __FUNCTION__, dev->name,
                                "Private Device Structure");
                        free (dev);
-                       return;
+                       return -1;
                }
                /* start with an zeroed ETH_PORT_INFO */
                memset (ethernet_private, 0, sizeof (ETH_PORT_INFO));
@@ -288,7 +349,7 @@ void mv6446x_eth_initialize (bd_t * bis)
 
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
 
                port_private->stats =
@@ -301,7 +362,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                        free (port_private);
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
                memset (ethernet_private->port_private, 0,
                        sizeof (struct mv64460_eth_priv));
@@ -345,7 +406,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -389,6 +450,7 @@ void mv6446x_eth_initialize (bd_t * bis)
        }
        DP (printf ("%s: exit\n", __FUNCTION__));
 
+       return 0;
 }
 
 /**********************************************************************
diff --git a/board/Marvell/db64460/mv_eth.h b/board/Marvell/db64460/mv_eth.h
index cbe751a..61d71a2 100644
--- a/board/Marvell/db64460/mv_eth.h
+++ b/board/Marvell/db64460/mv_eth.h
@@ -164,6 +164,7 @@ struct mv64460_eth_priv {
 
 };
 
+int mv6446x_eth_initialize(bd_t *bis);
 int mv64460_eth_init (struct eth_device *dev);
 int mv64460_eth_stop (struct eth_device *dev);
 int mv64460_eth_start_xmit (struct eth_device*, volatile void* packet, int 
length);
@@ -775,66 +776,4 @@ typedef struct _eth_port_ctrl
 
 } ETH_PORT_INFO;
 
-
-/* ethernet.h API list */
-
-/* Port operation control routines */
-static void eth_port_init (ETH_PORT_INFO *p_eth_port_ctrl);
-static void eth_port_reset(ETH_PORT    eth_port_num);
-static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
-
-
-/* Port MAC address routines */
-static void eth_port_uc_addr_set (ETH_PORT eth_port_num,
-                                 unsigned char *p_addr,
-                                 ETH_QUEUE queue);
-#if 0  /* FIXME */
-static void eth_port_mc_addr   (ETH_PORT eth_port_num,
-                                unsigned char *p_addr,
-                                ETH_QUEUE queue,
-                                int option);
-#endif
-
-/* PHY and MIB routines */
-static bool ethernet_phy_reset(ETH_PORT eth_port_num);
-
-static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
-                                  unsigned int phy_reg,
-                                  unsigned int value);
-
-static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
-                                 unsigned int phy_reg,
-                                 unsigned int* value);
-
-static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
-
-/* Port data flow control routines */
-static ETH_FUNC_RET_STATUS eth_port_send    (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE tx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE tx_queue,
-                                             PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_port_receive (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE rx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE rx_queue,
-                                             PKT_INFO *p_pkt_info);
-
-
-static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   tx_queue,
-                                   int                         tx_desc_num,
-                                   int                         tx_buff_size,
-                                   unsigned int        tx_desc_base_addr,
-                                   unsigned int        tx_buff_base_addr);
-
-static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   rx_queue,
-                                   int                         rx_desc_num,
-                                   int                         rx_buff_size,
-                                   unsigned int        rx_desc_base_addr,
-                                   unsigned int        rx_buff_base_addr);
-
 #endif /* MV64460_ETH_ */
diff --git a/board/esd/cpci750/cpci750.c b/board/esd/cpci750/cpci750.c
index 08311c9..904eff7 100644
--- a/board/esd/cpci750/cpci750.c
+++ b/board/esd/cpci750/cpci750.c
@@ -40,6 +40,7 @@
 #include "mpsc.h"
 #include "i2c.h"
 #include "64360.h"
+#include "mv_eth.h"
 #include "mv_regs.h"
 
 #undef DEBUG
@@ -148,6 +149,11 @@ int board_video_skip(void)
        return CPCI750_SLAVE_TEST;
 }
 
+int board_eth_init(bd_t *bis)
+{
+       return mv6436x_eth_initialize(bis);
+}
+
 /* ------------------------------------------------------------------------- */
 
 /*
diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c
index db2324b..22bf9b5 100644
--- a/board/esd/cpci750/mv_eth.c
+++ b/board/esd/cpci750/mv_eth.c
@@ -78,6 +78,67 @@
 #define MV_SET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) |= ((unsigned 
int)my_cpu_to_le32(bits)))
 #define MV_RESET_REG_BITS(regOffset,bits) ((*((volatile unsigned 
int*)((INTERNAL_REG_BASE_ADDR) + (regOffset)))) &= ~((unsigned 
int)my_cpu_to_le32(bits)))
 
+/* ethernet.h API list */
+
+/* Port operation control routines */
+static void eth_port_init(ETH_PORT_INFO *p_eth_port_ctrl);
+static void eth_port_reset(ETH_PORT    eth_port_num);
+static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
+
+
+/* Port MAC address routines */
+static void eth_port_uc_addr_set(ETH_PORT eth_port_num,
+                                 unsigned char *p_addr,
+                                 ETH_QUEUE queue);
+#if 0  /* FIXME */
+static void eth_port_mc_addr(ETH_PORT eth_port_num,
+                                unsigned char *p_addr,
+                                ETH_QUEUE queue,
+                                int option);
+#endif
+
+/* PHY and MIB routines */
+static bool ethernet_phy_reset(ETH_PORT eth_port_num);
+
+static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
+                                  unsigned int phy_reg,
+                                  unsigned int value);
+
+static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
+                                 unsigned int phy_reg,
+                                 unsigned int *value);
+
+static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
+
+/* Port data flow control routines */
+static ETH_FUNC_RET_STATUS eth_port_send(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE tx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE tx_queue,
+                                             PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_port_receive(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE rx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE rx_queue,
+                                             PKT_INFO *p_pkt_info);
+
+
+static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   tx_queue,
+                                   int                         tx_desc_num,
+                                   int                         tx_buff_size,
+                                   unsigned int        tx_desc_base_addr,
+                                   unsigned int        tx_buff_base_addr);
+
+static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   rx_queue,
+                                   int                         rx_desc_num,
+                                   int                         rx_buff_size,
+                                   unsigned int        rx_desc_base_addr,
+                                   unsigned int        rx_buff_base_addr);
+
 /* Static function declarations */
 static int mv64360_eth_real_open (struct eth_device *eth);
 static int mv64360_eth_real_stop (struct eth_device *eth);
@@ -203,7 +264,7 @@ void db64360_eth_disable (struct eth_device *dev)
 }
 
 
-void mv6436x_eth_initialize (bd_t * bis)
+int mv6436x_eth_initialize(bd_t *bis)
 {
        struct eth_device *dev;
        ETH_PORT_INFO *ethernet_private;
@@ -216,7 +277,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                if (!dev) {
                        printf ("%s: mv_enet%d allocation failure, %s\n",
                                __FUNCTION__, devnum, "eth_device structure");
-                       return;
+                       return -1;
                }
 
                /* must be less than NAMESIZE (16) */
@@ -243,7 +304,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -273,7 +334,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                                __FUNCTION__, dev->name,
                                "Private Device Structure");
                        free (dev);
-                       return;
+                       return -1;
                }
                /* start with an zeroed ETH_PORT_INFO */
                memset (ethernet_private, 0, sizeof (ETH_PORT_INFO));
@@ -290,7 +351,7 @@ void mv6436x_eth_initialize (bd_t * bis)
 
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
 
                port_private->stats =
@@ -303,7 +364,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                        free (port_private);
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
                memset (ethernet_private->port_private, 0,
                        sizeof (struct mv64360_eth_priv));
@@ -347,7 +408,7 @@ void mv6436x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -391,6 +452,7 @@ void mv6436x_eth_initialize (bd_t * bis)
        }
        DP (printf ("%s: exit\n", __FUNCTION__));
 
+       return 0;
 }
 
 /**********************************************************************
diff --git a/board/esd/cpci750/mv_eth.h b/board/esd/cpci750/mv_eth.h
index b761135..6dfe807 100644
--- a/board/esd/cpci750/mv_eth.h
+++ b/board/esd/cpci750/mv_eth.h
@@ -166,6 +166,7 @@ struct mv64360_eth_priv {
 };
 
 
+int mv6436x_eth_initialize(bd_t *bis);
 int mv64360_eth_init (struct eth_device *dev);
 int mv64360_eth_stop (struct eth_device *dev);
 int mv64360_eth_start_xmit (struct eth_device*, volatile void* packet, int 
length);
@@ -779,66 +780,4 @@ typedef struct _eth_port_ctrl
 
 } ETH_PORT_INFO;
 
-
-/* ethernet.h API list */
-
-/* Port operation control routines */
-static void eth_port_init (ETH_PORT_INFO *p_eth_port_ctrl);
-static void eth_port_reset(ETH_PORT    eth_port_num);
-static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
-
-
-/* Port MAC address routines */
-static void eth_port_uc_addr_set (ETH_PORT eth_port_num,
-                                 unsigned char *p_addr,
-                                 ETH_QUEUE queue);
-#if 0  /* FIXME */
-static void eth_port_mc_addr   (ETH_PORT eth_port_num,
-                                unsigned char *p_addr,
-                                ETH_QUEUE queue,
-                                int option);
-#endif
-
-/* PHY and MIB routines */
-static bool ethernet_phy_reset(ETH_PORT eth_port_num);
-
-static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
-                                  unsigned int phy_reg,
-                                  unsigned int value);
-
-static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
-                                 unsigned int phy_reg,
-                                 unsigned int* value);
-
-static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
-
-/* Port data flow control routines */
-static ETH_FUNC_RET_STATUS eth_port_send    (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE tx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE tx_queue,
-                                             PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_port_receive (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE rx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE rx_queue,
-                                             PKT_INFO *p_pkt_info);
-
-
-static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   tx_queue,
-                                   int                         tx_desc_num,
-                                   int                         tx_buff_size,
-                                   unsigned int        tx_desc_base_addr,
-                                   unsigned int        tx_buff_base_addr);
-
-static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   rx_queue,
-                                   int                         rx_desc_num,
-                                   int                         rx_buff_size,
-                                   unsigned int        rx_desc_base_addr,
-                                   unsigned int        rx_buff_base_addr);
-
 #endif /* MV64360_ETH_ */
diff --git a/board/prodrive/p3mx/mv_eth.c b/board/prodrive/p3mx/mv_eth.c
index f26ded8..264dc2b 100644
--- a/board/prodrive/p3mx/mv_eth.c
+++ b/board/prodrive/p3mx/mv_eth.c
@@ -85,6 +85,67 @@
 
 #define my_cpu_to_le32(x) my_le32_to_cpu((x))
 
+/* ethernet.h API list */
+
+/* Port operation control routines */
+static void eth_port_init(ETH_PORT_INFO *p_eth_port_ctrl);
+static void eth_port_reset(ETH_PORT    eth_port_num);
+static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
+
+
+/* Port MAC address routines */
+static void eth_port_uc_addr_set(ETH_PORT eth_port_num,
+                                 unsigned char *p_addr,
+                                 ETH_QUEUE queue);
+#if 0  /* FIXME */
+static void eth_port_mc_addr(ETH_PORT eth_port_num,
+                                unsigned char *p_addr,
+                                ETH_QUEUE queue,
+                                int option);
+#endif
+
+/* PHY and MIB routines */
+static bool ethernet_phy_reset(ETH_PORT eth_port_num);
+
+static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
+                                  unsigned int phy_reg,
+                                  unsigned int value);
+
+static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
+                                 unsigned int phy_reg,
+                                 unsigned int *value);
+
+static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
+
+/* Port data flow control routines */
+static ETH_FUNC_RET_STATUS eth_port_send(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE tx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE tx_queue,
+                                             PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_port_receive(ETH_PORT_INFO *p_eth_port_ctrl,
+                                            ETH_QUEUE rx_queue,
+                                            PKT_INFO *p_pkt_info);
+static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
+                                             ETH_QUEUE rx_queue,
+                                             PKT_INFO *p_pkt_info);
+
+
+static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   tx_queue,
+                                   int                         tx_desc_num,
+                                   int                         tx_buff_size,
+                                   unsigned int        tx_desc_base_addr,
+                                   unsigned int        tx_buff_base_addr);
+
+static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
+                                   ETH_QUEUE   rx_queue,
+                                   int                         rx_desc_num,
+                                   int                         rx_buff_size,
+                                   unsigned int        rx_desc_base_addr,
+                                   unsigned int        rx_buff_base_addr);
+
 /* Static function declarations */
 static int mv64460_eth_real_open (struct eth_device *eth);
 static int mv64460_eth_real_stop (struct eth_device *eth);
@@ -247,7 +308,7 @@ void mv_eth_phy_init (void)
        MV_REG_WRITE (ETH_PHY_DFCDL_CONFIG0_REG, 0x300000);
 }
 
-void mv6446x_eth_initialize (bd_t * bis)
+int mv6446x_eth_initialize(bd_t *bis)
 {
        struct eth_device *dev;
        ETH_PORT_INFO *ethernet_private;
@@ -269,7 +330,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                if (!dev) {
                        printf ("%s: mv_enet%d allocation failure, %s\n",
                                __FUNCTION__, devnum, "eth_device structure");
-                       return;
+                       return -1;
                }
 
                /* must be less than NAMESIZE (16) */
@@ -293,7 +354,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -322,7 +383,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                                __FUNCTION__, dev->name,
                                "Private Device Structure");
                        free (dev);
-                       return;
+                       return -1;
                }
                /* start with an zeroed ETH_PORT_INFO */
                memset (ethernet_private, 0, sizeof (ETH_PORT_INFO));
@@ -338,7 +399,7 @@ void mv6446x_eth_initialize (bd_t * bis)
 
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
 
                port_private->stats =
@@ -351,7 +412,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                        free (port_private);
                        free (ethernet_private);
                        free (dev);
-                       return;
+                       return -1;
                }
                memset (ethernet_private->port_private, 0,
                        sizeof (struct mv64460_eth_priv));
@@ -392,7 +453,7 @@ void mv6446x_eth_initialize (bd_t * bis)
                default:        /* this should never happen */
                        printf ("%s: Invalid device number %d\n",
                                __FUNCTION__, devnum);
-                       return;
+                       return -1;
                }
 
                temp = getenv_f(s, buf, sizeof (buf));
@@ -437,6 +498,7 @@ void mv6446x_eth_initialize (bd_t * bis)
        }
        DP (printf ("%s: exit\n", __FUNCTION__));
 
+       return 0;
 }
 
 /**********************************************************************
diff --git a/board/prodrive/p3mx/mv_eth.h b/board/prodrive/p3mx/mv_eth.h
index af15274..138a3af 100644
--- a/board/prodrive/p3mx/mv_eth.h
+++ b/board/prodrive/p3mx/mv_eth.h
@@ -164,6 +164,7 @@ struct mv64460_eth_priv {
     int first_init;
 };
 
+int mv6446x_eth_initialize(bd_t *bis);
 int mv64460_eth_init (struct eth_device *dev);
 int mv64460_eth_stop (struct eth_device *dev);
 int mv64460_eth_start_xmit (struct eth_device*, volatile void* packet, int 
length);
@@ -775,66 +776,4 @@ typedef struct _eth_port_ctrl
 
 } ETH_PORT_INFO;
 
-
-/* ethernet.h API list */
-
-/* Port operation control routines */
-static void eth_port_init (ETH_PORT_INFO *p_eth_port_ctrl);
-static void eth_port_reset(ETH_PORT    eth_port_num);
-static bool eth_port_start(ETH_PORT_INFO *p_eth_port_ctrl);
-
-
-/* Port MAC address routines */
-static void eth_port_uc_addr_set (ETH_PORT eth_port_num,
-                                 unsigned char *p_addr,
-                                 ETH_QUEUE queue);
-#if 0  /* FIXME */
-static void eth_port_mc_addr   (ETH_PORT eth_port_num,
-                                unsigned char *p_addr,
-                                ETH_QUEUE queue,
-                                int option);
-#endif
-
-/* PHY and MIB routines */
-static bool ethernet_phy_reset(ETH_PORT eth_port_num);
-
-static bool eth_port_write_smi_reg(ETH_PORT eth_port_num,
-                                  unsigned int phy_reg,
-                                  unsigned int value);
-
-static bool eth_port_read_smi_reg(ETH_PORT eth_port_num,
-                                 unsigned int phy_reg,
-                                 unsigned int* value);
-
-static void eth_clear_mib_counters(ETH_PORT    eth_port_num);
-
-/* Port data flow control routines */
-static ETH_FUNC_RET_STATUS eth_port_send    (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE tx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_tx_return_desc(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE tx_queue,
-                                             PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_port_receive (ETH_PORT_INFO *p_eth_port_ctrl,
-                                            ETH_QUEUE rx_queue,
-                                            PKT_INFO *p_pkt_info);
-static ETH_FUNC_RET_STATUS eth_rx_return_buff(ETH_PORT_INFO *p_eth_port_ctrl,
-                                             ETH_QUEUE rx_queue,
-                                             PKT_INFO *p_pkt_info);
-
-
-static bool ether_init_tx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   tx_queue,
-                                   int                         tx_desc_num,
-                                   int                         tx_buff_size,
-                                   unsigned int        tx_desc_base_addr,
-                                   unsigned int        tx_buff_base_addr);
-
-static bool ether_init_rx_desc_ring(ETH_PORT_INFO  *p_eth_port_ctrl,
-                                   ETH_QUEUE   rx_queue,
-                                   int                         rx_desc_num,
-                                   int                         rx_buff_size,
-                                   unsigned int        rx_desc_base_addr,
-                                   unsigned int        rx_buff_base_addr);
-
 #endif /* MV64460_ETH_ */
diff --git a/board/prodrive/p3mx/p3mx.c b/board/prodrive/p3mx/p3mx.c
index 09e4f82..31c7869 100644
--- a/board/prodrive/p3mx/p3mx.c
+++ b/board/prodrive/p3mx/p3mx.c
@@ -44,6 +44,7 @@
 #include "eth.h"
 #include "mpsc.h"
 #include "64460.h"
+#include "mv_eth.h"
 #include "mv_regs.h"
 #include "p3mx.h"
 
@@ -82,6 +83,11 @@ void set_led(int);
 
 /* ------------------------------------------------------------------------- */
 
+int board_eth_init(bd_t *bis)
+{
+       return mv6446x_eth_initialize(bis);
+}
+
 /*
  * This is a version of the GT register space remapping function that
  * doesn't touch globals (meaning, it's ok to run from flash.)
diff --git a/net/eth.c b/net/eth.c
index 02ccc75..fdc9e22 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -81,9 +81,6 @@ static int __def_eth_init(bd_t *bis)
 int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
 int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
 
-extern int mv6436x_eth_initialize(bd_t *);
-extern int mv6446x_eth_initialize(bd_t *);
-
 #ifdef CONFIG_API
 extern void (*push_packet)(volatile void *, int);
 
@@ -251,12 +248,6 @@ int eth_initialize(bd_t *bis)
        } else
                printf("Net Initialization Skipped\n");
 
-#if defined(CONFIG_DB64360) || defined(CONFIG_CPCI750)
-       mv6436x_eth_initialize(bis);
-#endif
-#if defined(CONFIG_DB64460) || defined(CONFIG_P3Mx)
-       mv6446x_eth_initialize(bis);
-#endif
        if (!eth_devices) {
                puts("No ethernet found.\n");
                show_boot_progress(-64);
-- 
1.6.0.2

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to