Add support CONFIG_UEC_ETH3 in MPC83xx

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index 8d69d22..3d3f20a 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -520,6 +520,15 @@
 		"local-mac-address",
 		fdt_set_eth0
 	},
+#elif CFG_UEC1_UCC_NUM == 1  /* UCC2 */
+	{	"/" OF_QE "/ucc@3000",
+		"mac-address",
+		fdt_set_eth0
+	},
+	{	"/" OF_QE "/ucc@3000",
+		"local-mac-address",
+		fdt_set_eth0
+	},
 #elif CFG_UEC1_UCC_NUM == 2  /* UCC3 */
 	{	"/" OF_QE "/ucc@2200",
 		"mac-address",
@@ -529,10 +538,28 @@
 		"local-mac-address",
 		fdt_set_eth0
 	},
+#elif CFG_UEC1_UCC_NUM == 3  /* UCC4 */
+	{	"/" OF_QE "/ucc@3200",
+		"mac-address",
+		fdt_set_eth0
+	},
+	{	"/" OF_QE "/ucc@3200",
+		"local-mac-address",
+		fdt_set_eth0
+	},
 #endif
 #endif /* CONFIG_UEC_ETH1 */
 #ifdef CONFIG_UEC_ETH2
-#if CFG_UEC2_UCC_NUM == 1  /* UCC2 */
+#if CFG_UEC2_UCC_NUM == 0  /* UCC1 */
+	{	"/" OF_QE "/ucc@2000",
+		"mac-address",
+		fdt_set_eth1
+	},
+	{	"/" OF_QE "/ucc@2000",
+		"local-mac-address",
+		fdt_set_eth1
+	},
+#elif CFG_UEC2_UCC_NUM == 1  /* UCC2 */
 	{	"/" OF_QE "/ucc@3000",
 		"mac-address",
 		fdt_set_eth1
@@ -541,6 +568,15 @@
 		"local-mac-address",
 		fdt_set_eth1
 	},
+#elif CFG_UEC2_UCC_NUM == 2  /* UCC3 */
+	{	"/" OF_QE "/ucc@2200",
+		"mac-address",
+		fdt_set_eth1
+	},
+	{	"/" OF_QE "/ucc@2200",
+		"local-mac-address",
+		fdt_set_eth1
+	},
 #elif CFG_UEC2_UCC_NUM == 3  /* UCC4 */
 	{	"/" OF_QE "/ucc@3200",
 		"mac-address",
@@ -552,6 +588,84 @@
 	},
 #endif
 #endif /* CONFIG_UEC_ETH2 */
+#ifdef CONFIG_UEC_ETH3
+#if CFG_UEC3_UCC_NUM == 0  /* UCC1 */
+	{	"/" OF_QE "/ucc@2000",
+		"mac-address",
+		fdt_set_eth2
+	},
+	{	"/" OF_QE "/ucc@2000",
+		"local-mac-address",
+		fdt_set_eth2
+	},
+#elif CFG_UEC3_UCC_NUM == 1  /* UCC2 */
+	{	"/" OF_QE "/ucc@3000",
+		"mac-address",
+		fdt_set_eth2
+	},
+	{	"/" OF_QE "/ucc@3000",
+		"local-mac-address",
+		fdt_set_eth2
+	},
+#elif CFG_UEC3_UCC_NUM == 2  /* UCC3 */
+	{	"/" OF_QE "/ucc@2200",
+		"mac-address",
+		fdt_set_eth2
+	},
+	{	"/" OF_QE "/ucc@2200",
+		"local-mac-address",
+		fdt_set_eth2
+	},
+#elif CFG_UEC3_UCC_NUM == 3  /* UCC4 */
+	{	"/" OF_QE "/ucc@3200",
+		"mac-address",
+		fdt_set_eth2
+	},
+	{	"/" OF_QE "/ucc@3200",
+		"local-mac-address",
+		fdt_set_eth2
+	},
+#endif
+#endif /* CONFIG_UEC_ETH3 */
+#ifdef CONFIG_UEC_ETH4
+#if CFG_UEC4_UCC_NUM == 0  /* UCC1 */
+	{	"/" OF_QE "/ucc@2000",
+		"mac-address",
+		fdt_set_eth3
+	},
+	{	"/" OF_QE "/ucc@2000",
+		"local-mac-address",
+		fdt_set_eth3
+	},
+#elif CFG_UEC4_UCC_NUM == 1  /* UCC2 */
+	{	"/" OF_QE "/ucc@3000",
+		"mac-address",
+		fdt_set_eth3
+	},
+	{	"/" OF_QE "/ucc@3000",
+		"local-mac-address",
+		fdt_set_eth3
+	},
+#elif CFG_UEC4_UCC_NUM == 2  /* UCC3 */
+	{	"/" OF_QE "/ucc@2200",
+		"mac-address",
+		fdt_set_eth3
+	},
+	{	"/" OF_QE "/ucc@2200",
+		"local-mac-address",
+		fdt_set_eth3
+	},
+#elif CFG_UEC4_UCC_NUM == 3  /* UCC4 */
+	{	"/" OF_QE "/ucc@3200",
+		"mac-address",
+		fdt_set_eth3
+	},
+	{	"/" OF_QE "/ucc@3200",
+		"local-mac-address",
+		fdt_set_eth3
+	},
+#endif
+#endif /* CONFIG_UEC_ETH4 */
 #endif /* CONFIG_QE */
 };
 
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index dc2765b..a27c12a 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -69,6 +69,25 @@
 };
 #endif
 
+#ifdef CONFIG_UEC_ETH3
+static uec_info_t eth3_uec_info = {
+	.uf_info		= {
+		.ucc_num	= CFG_UEC3_UCC_NUM,
+		.rx_clock	= CFG_UEC3_RX_CLK,
+		.tx_clock	= CFG_UEC3_TX_CLK,
+		.eth_type	= CFG_UEC3_ETH_TYPE,
+	},
+	.num_threads_tx		= UEC_NUM_OF_THREADS_4,
+	.num_threads_rx		= UEC_NUM_OF_THREADS_4,
+	.riscTx			= QE_RISC_ALLOCATION_RISC1_AND_RISC2,
+	.riscRx			= QE_RISC_ALLOCATION_RISC1_AND_RISC2,
+	.tx_bd_ring_len		= 16,
+	.rx_bd_ring_len		= 16,
+	.phy_address		= CFG_UEC3_PHY_ADDR,
+	.enet_interface		= CFG_UEC3_INTERFACE_MODE,
+};
+#endif
+
 static int uec_mac_enable(uec_private_t *uec, comm_dir_e mode)
 {
 	uec_t		*uec_regs;
@@ -1238,6 +1257,10 @@
 #ifdef CONFIG_UEC_ETH2
 		uec_info = &eth2_uec_info;
 #endif
+	} else if (index == 2) {
+#ifdef CONFIG_UEC_ETH3
+		uec_info = &eth3_uec_info;
+#endif
 	} else {
 		printf("%s: index is illegal.\n", __FUNCTION__);
 		return -EINVAL;
diff --git a/net/eth.c b/net/eth.c
index 3373a05..d2fced8b 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -214,6 +214,9 @@
 #if defined(CONFIG_UEC_ETH2)
 	uec_initialize(1);
 #endif
+#if defined(CONFIG_UEC_ETH3)
+	uec_initialize(2);
+#endif
 
 #if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
 	fec_initialize(bis);