Adds two more ethernet interface to 83xx
authorrichardretanubun <richardretanubun@ruggedcom.com>
Mon, 29 Sep 2008 22:28:23 +0000 (18:28 -0400)
committerWolfgang Denk <wd@denx.de>
Sat, 18 Oct 2008 19:54:00 +0000 (21:54 +0200)
Added as a convenience for other platforms that uses MPC8360 (has 8 UCC).
Six eth interface is chosen because the platform I am using combines
UCC1&2 and UCC3&4 as 1000 Eth and the other four UCCs as 10/100 Eth.

Signed-off-by: Richard Retanubun <RichardRetanubun@RugggedCom.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
README
common/cmd_bdinfo.c
common/env_common.c
common/env_embedded.c
cpu/mpc83xx/fdt.c
drivers/qe/uec.c
include/asm-ppc/u-boot.h
lib_ppc/board.c
net/eth.c
tools/env/fw_env.c

diff --git a/README b/README
index ccd839ca25828c2be9d2ac576259b443d0704792..88023048a60c9cb4ce90d8be2ea91027dbe8cee7 100644 (file)
--- a/README
+++ b/README
@@ -1095,8 +1095,11 @@ The following options need to be configured:
 
 - Ethernet address:
                CONFIG_ETHADDR
+               CONFIG_ETH1ADDR
                CONFIG_ETH2ADDR
                CONFIG_ETH3ADDR
+               CONFIG_ETH4ADDR
+               CONFIG_ETH5ADDR
 
                Define a default value for Ethernet address to use
                for the respective Ethernet interface, in case this
index f4d9d404e62771ecba7388d374ece7fe0c21fb08..5018930107ed2d0f51fe346bd5259aa806f7f171 100644 (file)
@@ -117,6 +117,20 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        }
 #endif
 
+#if defined(CONFIG_HAS_ETH4)
+       puts ("\neth4addr    =");
+       for (i=0; i<6; ++i) {
+               printf ("%c%02X", i ? ':' : ' ', bd->bi_enet4addr[i]);
+       }
+#endif
+
+#if defined(CONFIG_HAS_ETH5)
+       puts ("\neth5addr    =");
+       for (i=0; i<6; ++i) {
+               printf ("%c%02X", i ? ':' : ' ', bd->bi_enet5addr[i]);
+       }
+#endif
+
 #ifdef CONFIG_HERMES
        print_str ("ethspeed",      strmhz(buf, bd->bi_ethspeed));
 #endif
index 77f99441a1cc1d20b986d9cb36776cfcd60d1bf6..0fee3affb7fe5cf0bc50df09d7cbe113c28d6968 100644 (file)
@@ -91,6 +91,12 @@ uchar default_environment[] = {
 #ifdef CONFIG_ETH3ADDR
        "eth3addr="     MK_STR(CONFIG_ETH3ADDR)         "\0"
 #endif
+#ifdef CONFIG_ETH4ADDR
+       "eth4addr="     MK_STR(CONFIG_ETH4ADDR)         "\0"
+#endif
+#ifdef CONFIG_ETH5ADDR
+       "eth5addr="     MK_STR(CONFIG_ETH5ADDR)         "\0"
+#endif
 #ifdef CONFIG_IPADDR
        "ipaddr="       MK_STR(CONFIG_IPADDR)           "\0"
 #endif
index 77e561912cb1d5a8151a354058ae85cb4753d074..e79f843fb1cae434f9c332452f251eb76fb5f796 100644 (file)
@@ -135,6 +135,12 @@ env_t environment __PPCENV__ = {
 #ifdef CONFIG_ETH3ADDR
        "eth3addr="     MK_STR(CONFIG_ETH3ADDR)         "\0"
 #endif
+#ifdef CONFIG_ETH4ADDR
+       "eth4addr="     MK_STR(CONFIG_ETH4ADDR)         "\0"
+#endif
+#ifdef CONFIG_ETH5ADDR
+       "eth5addr="     MK_STR(CONFIG_ETH5ADDR)         "\0"
+#endif
 #ifdef CONFIG_ETHPRIME
        "ethprime="     CONFIG_ETHPRIME                 "\0"
 #endif
index 39bd9dc7d52822f36afe4075ae2c84f0bbe9f91a..3e3e1c8ed035b4e95b4254e624837872e975f554 100644 (file)
@@ -52,7 +52,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
                fdt_fixup_crypto_node(blob, 0x0204);
 
 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
-    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
+    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
+    defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5)
        fdt_fixup_ethernet(blob);
 #endif
 
index 85e2ad35872f9ba3755027147dcde07cefb863a8..0d48360a2de1938f20f2024ec44f6bc134fdf817 100644 (file)
@@ -123,8 +123,54 @@ static uec_info_t eth4_uec_info = {
        .enet_interface         = CFG_UEC4_INTERFACE_MODE,
 };
 #endif
+#ifdef CONFIG_UEC_ETH5
+static uec_info_t eth5_uec_info = {
+       .uf_info                = {
+               .ucc_num        = CFG_UEC5_UCC_NUM,
+               .rx_clock       = CFG_UEC5_RX_CLK,
+               .tx_clock       = CFG_UEC5_TX_CLK,
+               .eth_type       = CFG_UEC5_ETH_TYPE,
+       },
+#if (CFG_UEC5_ETH_TYPE == FAST_ETH)
+       .num_threads_tx         = UEC_NUM_OF_THREADS_1,
+       .num_threads_rx         = UEC_NUM_OF_THREADS_1,
+#else
+       .num_threads_tx         = UEC_NUM_OF_THREADS_4,
+       .num_threads_rx         = UEC_NUM_OF_THREADS_4,
+#endif
+       .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_UEC5_PHY_ADDR,
+       .enet_interface         = CFG_UEC5_INTERFACE_MODE,
+};
+#endif
+#ifdef CONFIG_UEC_ETH6
+static uec_info_t eth6_uec_info = {
+       .uf_info                = {
+               .ucc_num        = CFG_UEC6_UCC_NUM,
+               .rx_clock       = CFG_UEC6_RX_CLK,
+               .tx_clock       = CFG_UEC6_TX_CLK,
+               .eth_type       = CFG_UEC6_ETH_TYPE,
+       },
+#if (CFG_UEC6_ETH_TYPE == FAST_ETH)
+       .num_threads_tx         = UEC_NUM_OF_THREADS_1,
+       .num_threads_rx         = UEC_NUM_OF_THREADS_1,
+#else
+       .num_threads_tx         = UEC_NUM_OF_THREADS_4,
+       .num_threads_rx         = UEC_NUM_OF_THREADS_4,
+#endif
+       .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_UEC6_PHY_ADDR,
+       .enet_interface         = CFG_UEC6_INTERFACE_MODE,
+};
+#endif
 
-#define MAXCONTROLLERS (4)
+#define MAXCONTROLLERS (6)
 
 static struct eth_device *devlist[MAXCONTROLLERS];
 
index 54ac01d3620de1b30919c035eedc7a0cf0f6c44e..745190584147b7acb64b532afaed434346f8be5d 100644 (file)
@@ -111,6 +111,12 @@ typedef struct bd_info {
 #ifdef CONFIG_HAS_ETH3
        unsigned char   bi_enet3addr[6];
 #endif
+#ifdef CONFIG_HAS_ETH4
+       unsigned char   bi_enet4addr[6];
+#endif
+#ifdef CONFIG_HAS_ETH5
+       unsigned char   bi_enet5addr[6];
+#endif
 
 #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
     defined(CONFIG_405EZ) || defined(CONFIG_440GX) || \
index 865e74f08a6d1cdcc1a5a90ac62abdb33b4d5b57..3fdd94b73952ade4544abd3c841159565ffdde7b 100644 (file)
@@ -954,6 +954,36 @@ void board_init_r (gd_t *id, ulong dest_addr)
        }
 #endif
 
+#ifdef CONFIG_HAS_ETH4
+       /* handle 5th ethernet address */
+       s = getenv("eth4addr");
+#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
+       if (s == NULL)
+               board_get_enetaddr(bd->bi_enet4addr);
+       else
+#endif
+       for (i = 0; i < 6; ++i) {
+               bd->bi_enet4addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
+               if (s)
+                       s = (*e) ? e + 1 : e;
+       }
+#endif
+
+#ifdef CONFIG_HAS_ETH5
+       /* handle 6th ethernet address */
+       s = getenv("eth5addr");
+#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
+       if (s == NULL)
+               board_get_enetaddr(bd->bi_enet5addr);
+       else
+#endif
+       for (i = 0; i < 6; ++i) {
+               bd->bi_enet5addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
+               if (s)
+                       s = (*e) ? e + 1 : e;
+       }
+#endif
+
 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
     defined(CONFIG_TQM8272) || \
     defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
index 432dd60bdc8f56c7db9d77853f6a34f61b987749..ccd871a67c320daec528345c36fa6471570ef5c0 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -180,6 +180,12 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_UEC_ETH4)
        uec_initialize(3);
 #endif
+#if defined(CONFIG_UEC_ETH5)
+       uec_initialize(4);
+#endif
+#if defined(CONFIG_UEC_ETH6)
+       uec_initialize(5);
+#endif
 
 #if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
        fec_initialize(bis);
index 46747d337c547e118ed859095db9cbc48cd4f7ea..6e9c34f3de928c337f613c1ae9cfc9b13bdc5c43 100644 (file)
@@ -157,6 +157,12 @@ static char default_environment[] = {
 #ifdef CONFIG_ETH3ADDR
        "eth3addr=" MK_STR (CONFIG_ETH3ADDR) "\0"
 #endif
+#ifdef CONFIG_ETH4ADDR
+       "eth4addr=" MK_STR (CONFIG_ETH4ADDR) "\0"
+#endif
+#ifdef CONFIG_ETH5ADDR
+       "eth5addr=" MK_STR (CONFIG_ETH5ADDR) "\0"
+#endif
 #ifdef CONFIG_ETHPRIME
        "ethprime=" CONFIG_ETHPRIME "\0"
 #endif