Commit c68a05feeb88de9fcf158e67ff6423c4cc988f88

Authored by richardretanubun
Committed by Wolfgang Denk
1 parent 41410eee47

Adds two more ethernet interface to 83xx

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>

Showing 10 changed files with 126 additions and 2 deletions Side-by-side Diff

... ... @@ -1095,8 +1095,11 @@
1095 1095  
1096 1096 - Ethernet address:
1097 1097 CONFIG_ETHADDR
  1098 + CONFIG_ETH1ADDR
1098 1099 CONFIG_ETH2ADDR
1099 1100 CONFIG_ETH3ADDR
  1101 + CONFIG_ETH4ADDR
  1102 + CONFIG_ETH5ADDR
1100 1103  
1101 1104 Define a default value for Ethernet address to use
1102 1105 for the respective Ethernet interface, in case this
... ... @@ -117,6 +117,20 @@
117 117 }
118 118 #endif
119 119  
  120 +#if defined(CONFIG_HAS_ETH4)
  121 + puts ("\neth4addr =");
  122 + for (i=0; i<6; ++i) {
  123 + printf ("%c%02X", i ? ':' : ' ', bd->bi_enet4addr[i]);
  124 + }
  125 +#endif
  126 +
  127 +#if defined(CONFIG_HAS_ETH5)
  128 + puts ("\neth5addr =");
  129 + for (i=0; i<6; ++i) {
  130 + printf ("%c%02X", i ? ':' : ' ', bd->bi_enet5addr[i]);
  131 + }
  132 +#endif
  133 +
120 134 #ifdef CONFIG_HERMES
121 135 print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
122 136 #endif
... ... @@ -91,6 +91,12 @@
91 91 #ifdef CONFIG_ETH3ADDR
92 92 "eth3addr=" MK_STR(CONFIG_ETH3ADDR) "\0"
93 93 #endif
  94 +#ifdef CONFIG_ETH4ADDR
  95 + "eth4addr=" MK_STR(CONFIG_ETH4ADDR) "\0"
  96 +#endif
  97 +#ifdef CONFIG_ETH5ADDR
  98 + "eth5addr=" MK_STR(CONFIG_ETH5ADDR) "\0"
  99 +#endif
94 100 #ifdef CONFIG_IPADDR
95 101 "ipaddr=" MK_STR(CONFIG_IPADDR) "\0"
96 102 #endif
common/env_embedded.c
... ... @@ -135,6 +135,12 @@
135 135 #ifdef CONFIG_ETH3ADDR
136 136 "eth3addr=" MK_STR(CONFIG_ETH3ADDR) "\0"
137 137 #endif
  138 +#ifdef CONFIG_ETH4ADDR
  139 + "eth4addr=" MK_STR(CONFIG_ETH4ADDR) "\0"
  140 +#endif
  141 +#ifdef CONFIG_ETH5ADDR
  142 + "eth5addr=" MK_STR(CONFIG_ETH5ADDR) "\0"
  143 +#endif
138 144 #ifdef CONFIG_ETHPRIME
139 145 "ethprime=" CONFIG_ETHPRIME "\0"
140 146 #endif
... ... @@ -52,7 +52,8 @@
52 52 fdt_fixup_crypto_node(blob, 0x0204);
53 53  
54 54 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
55   - defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
  55 + defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
  56 + defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5)
56 57 fdt_fixup_ethernet(blob);
57 58 #endif
58 59  
... ... @@ -123,8 +123,54 @@
123 123 .enet_interface = CFG_UEC4_INTERFACE_MODE,
124 124 };
125 125 #endif
  126 +#ifdef CONFIG_UEC_ETH5
  127 +static uec_info_t eth5_uec_info = {
  128 + .uf_info = {
  129 + .ucc_num = CFG_UEC5_UCC_NUM,
  130 + .rx_clock = CFG_UEC5_RX_CLK,
  131 + .tx_clock = CFG_UEC5_TX_CLK,
  132 + .eth_type = CFG_UEC5_ETH_TYPE,
  133 + },
  134 +#if (CFG_UEC5_ETH_TYPE == FAST_ETH)
  135 + .num_threads_tx = UEC_NUM_OF_THREADS_1,
  136 + .num_threads_rx = UEC_NUM_OF_THREADS_1,
  137 +#else
  138 + .num_threads_tx = UEC_NUM_OF_THREADS_4,
  139 + .num_threads_rx = UEC_NUM_OF_THREADS_4,
  140 +#endif
  141 + .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
  142 + .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
  143 + .tx_bd_ring_len = 16,
  144 + .rx_bd_ring_len = 16,
  145 + .phy_address = CFG_UEC5_PHY_ADDR,
  146 + .enet_interface = CFG_UEC5_INTERFACE_MODE,
  147 +};
  148 +#endif
  149 +#ifdef CONFIG_UEC_ETH6
  150 +static uec_info_t eth6_uec_info = {
  151 + .uf_info = {
  152 + .ucc_num = CFG_UEC6_UCC_NUM,
  153 + .rx_clock = CFG_UEC6_RX_CLK,
  154 + .tx_clock = CFG_UEC6_TX_CLK,
  155 + .eth_type = CFG_UEC6_ETH_TYPE,
  156 + },
  157 +#if (CFG_UEC6_ETH_TYPE == FAST_ETH)
  158 + .num_threads_tx = UEC_NUM_OF_THREADS_1,
  159 + .num_threads_rx = UEC_NUM_OF_THREADS_1,
  160 +#else
  161 + .num_threads_tx = UEC_NUM_OF_THREADS_4,
  162 + .num_threads_rx = UEC_NUM_OF_THREADS_4,
  163 +#endif
  164 + .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
  165 + .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
  166 + .tx_bd_ring_len = 16,
  167 + .rx_bd_ring_len = 16,
  168 + .phy_address = CFG_UEC6_PHY_ADDR,
  169 + .enet_interface = CFG_UEC6_INTERFACE_MODE,
  170 +};
  171 +#endif
126 172  
127   -#define MAXCONTROLLERS (4)
  173 +#define MAXCONTROLLERS (6)
128 174  
129 175 static struct eth_device *devlist[MAXCONTROLLERS];
130 176  
include/asm-ppc/u-boot.h
... ... @@ -111,6 +111,12 @@
111 111 #ifdef CONFIG_HAS_ETH3
112 112 unsigned char bi_enet3addr[6];
113 113 #endif
  114 +#ifdef CONFIG_HAS_ETH4
  115 + unsigned char bi_enet4addr[6];
  116 +#endif
  117 +#ifdef CONFIG_HAS_ETH5
  118 + unsigned char bi_enet5addr[6];
  119 +#endif
114 120  
115 121 #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
116 122 defined(CONFIG_405EZ) || defined(CONFIG_440GX) || \
... ... @@ -954,6 +954,36 @@
954 954 }
955 955 #endif
956 956  
  957 +#ifdef CONFIG_HAS_ETH4
  958 + /* handle 5th ethernet address */
  959 + s = getenv("eth4addr");
  960 +#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  961 + if (s == NULL)
  962 + board_get_enetaddr(bd->bi_enet4addr);
  963 + else
  964 +#endif
  965 + for (i = 0; i < 6; ++i) {
  966 + bd->bi_enet4addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  967 + if (s)
  968 + s = (*e) ? e + 1 : e;
  969 + }
  970 +#endif
  971 +
  972 +#ifdef CONFIG_HAS_ETH5
  973 + /* handle 6th ethernet address */
  974 + s = getenv("eth5addr");
  975 +#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  976 + if (s == NULL)
  977 + board_get_enetaddr(bd->bi_enet5addr);
  978 + else
  979 +#endif
  980 + for (i = 0; i < 6; ++i) {
  981 + bd->bi_enet5addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  982 + if (s)
  983 + s = (*e) ? e + 1 : e;
  984 + }
  985 +#endif
  986 +
957 987 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
958 988 defined(CONFIG_TQM8272) || \
959 989 defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
... ... @@ -180,6 +180,12 @@
180 180 #if defined(CONFIG_UEC_ETH4)
181 181 uec_initialize(3);
182 182 #endif
  183 +#if defined(CONFIG_UEC_ETH5)
  184 + uec_initialize(4);
  185 +#endif
  186 +#if defined(CONFIG_UEC_ETH6)
  187 + uec_initialize(5);
  188 +#endif
183 189  
184 190 #if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
185 191 fec_initialize(bis);
... ... @@ -157,6 +157,12 @@
157 157 #ifdef CONFIG_ETH3ADDR
158 158 "eth3addr=" MK_STR (CONFIG_ETH3ADDR) "\0"
159 159 #endif
  160 +#ifdef CONFIG_ETH4ADDR
  161 + "eth4addr=" MK_STR (CONFIG_ETH4ADDR) "\0"
  162 +#endif
  163 +#ifdef CONFIG_ETH5ADDR
  164 + "eth5addr=" MK_STR (CONFIG_ETH5ADDR) "\0"
  165 +#endif
160 166 #ifdef CONFIG_ETHPRIME
161 167 "ethprime=" CONFIG_ETHPRIME "\0"
162 168 #endif