summaryrefslogtreecommitdiff
path: root/cpu/ppc4xx/4xx_enet.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpu/ppc4xx/4xx_enet.c')
-rw-r--r--cpu/ppc4xx/4xx_enet.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 2d2918e085..8423cc3ca4 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -100,6 +100,10 @@
#error "CONFIG_MII has to be defined!"
#endif
+#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_NET_MULTI)
+#error "CONFIG_NET_MULTI has to be defined for NetConsole"
+#endif
+
#define EMAC_RESET_TIMEOUT 1000 /* 1000 ms reset timeout */
#define PHY_AUTONEGOTIATE_TIMEOUT 4000 /* 4000 ms autonegotiate timeout */
@@ -111,10 +115,6 @@
#define ENET_MAX_MTU PKTSIZE
#define ENET_MAX_MTU_ALIGNED PKTSIZE_ALIGN
-/* define the number of channels implemented */
-#define EMAC_RXCHL EMAC_NUM_DEV
-#define EMAC_TXCHL EMAC_NUM_DEV
-
/*-----------------------------------------------------------------------------+
* Defines for MAL/EMAC interrupt conditions as reported in the UIC (Universal
* Interrupt Controller).
@@ -142,6 +142,20 @@ static uint32_t mal_ier;
struct eth_device *emac0_dev = NULL;
#endif
+/*
+ * Get count of EMAC devices (doesn't have to be the max. possible number
+ * supported by the cpu)
+ */
+#if defined(CONFIG_HAS_ETH3)
+#define LAST_EMAC_NUM 4
+#elif defined(CONFIG_HAS_ETH2)
+#define LAST_EMAC_NUM 3
+#elif defined(CONFIG_HAS_ETH1)
+#define LAST_EMAC_NUM 2
+#else
+#define LAST_EMAC_NUM 1
+#endif
+
/*-----------------------------------------------------------------------------+
* Prototypes and externals.
*-----------------------------------------------------------------------------*/
@@ -190,7 +204,9 @@ static void ppc_4xx_eth_halt (struct eth_device *dev)
/* EMAC RESET */
out32 (EMAC_M0 + hw_p->hw_addr, EMAC_M0_SRST);
+#ifndef CONFIG_NETCONSOLE
hw_p->print_speed = 1; /* print speed message again next time */
+#endif
return;
}
@@ -1344,7 +1360,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
#endif
#endif
- for (eth_num = 0; eth_num < EMAC_NUM_DEV; eth_num++) {
+ for (eth_num = 0; eth_num < LAST_EMAC_NUM; eth_num++) {
/* See if we can actually bring up the interface, otherwise, skip it */
switch (eth_num) {