aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c334
1 files changed, 199 insertions, 135 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e4736a3b1b7a..12e01b24105a 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -43,10 +43,6 @@
43 43
44#undef DEBUG 44#undef DEBUG
45 45
46#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
47#define DRV_NAME "ucc_geth"
48#define DRV_VERSION "1.1"
49
50#define ugeth_printk(level, format, arg...) \ 46#define ugeth_printk(level, format, arg...) \
51 printk(level format "\n", ## arg) 47 printk(level format "\n", ## arg)
52 48
@@ -64,9 +60,19 @@
64#else 60#else
65#define ugeth_vdbg(fmt, args...) do { } while (0) 61#define ugeth_vdbg(fmt, args...) do { } while (0)
66#endif /* UGETH_VERBOSE_DEBUG */ 62#endif /* UGETH_VERBOSE_DEBUG */
63#define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
67 64
65void uec_set_ethtool_ops(struct net_device *netdev);
66
68static DEFINE_SPINLOCK(ugeth_lock); 67static DEFINE_SPINLOCK(ugeth_lock);
69 68
69static struct {
70 u32 msg_enable;
71} debug = { -1 };
72
73module_param_named(debug, debug.msg_enable, int, 0);
74MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)");
75
70static struct ucc_geth_info ugeth_primary_info = { 76static struct ucc_geth_info ugeth_primary_info = {
71 .uf_info = { 77 .uf_info = {
72 .bd_mem_part = MEM_PART_SYSTEM, 78 .bd_mem_part = MEM_PART_SYSTEM,
@@ -104,6 +110,7 @@ static struct ucc_geth_info ugeth_primary_info = {
104 .maxRetransmission = 0xf, 110 .maxRetransmission = 0xf,
105 .collisionWindow = 0x37, 111 .collisionWindow = 0x37,
106 .receiveFlowControl = 1, 112 .receiveFlowControl = 1,
113 .transmitFlowControl = 1,
107 .maxGroupAddrInHash = 4, 114 .maxGroupAddrInHash = 4,
108 .maxIndAddrInHash = 4, 115 .maxIndAddrInHash = 4,
109 .prel = 7, 116 .prel = 7,
@@ -139,7 +146,9 @@ static struct ucc_geth_info ugeth_primary_info = {
139 .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1, 146 .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
140 .largestexternallookupkeysize = 147 .largestexternallookupkeysize =
141 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE, 148 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
142 .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE, 149 .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
150 UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
151 UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
143 .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP, 152 .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
144 .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP, 153 .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
145 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, 154 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
@@ -281,7 +290,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
281 290
282 for (i = 0; i < num_entries; i++) { 291 for (i = 0; i < num_entries; i++) {
283 if ((snum = qe_get_snum()) < 0) { 292 if ((snum = qe_get_snum()) < 0) {
284 ugeth_err("fill_init_enet_entries: Can not get SNUM."); 293 if (netif_msg_ifup(ugeth))
294 ugeth_err("fill_init_enet_entries: Can not get SNUM.");
285 return snum; 295 return snum;
286 } 296 }
287 if ((i == 0) && skip_page_for_first_entry) 297 if ((i == 0) && skip_page_for_first_entry)
@@ -291,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
291 init_enet_offset = 301 init_enet_offset =
292 qe_muram_alloc(thread_size, thread_alignment); 302 qe_muram_alloc(thread_size, thread_alignment);
293 if (IS_ERR_VALUE(init_enet_offset)) { 303 if (IS_ERR_VALUE(init_enet_offset)) {
294 ugeth_err 304 if (netif_msg_ifup(ugeth))
295 ("fill_init_enet_entries: Can not allocate DPRAM memory."); 305 ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory.");
296 qe_put_snum((u8) snum); 306 qe_put_snum((u8) snum);
297 return -ENOMEM; 307 return -ENOMEM;
298 } 308 }
@@ -1200,7 +1210,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
1200 return 0; 1210 return 0;
1201} 1211}
1202 1212
1203static int init_flow_control_params(u32 automatic_flow_control_mode, 1213int init_flow_control_params(u32 automatic_flow_control_mode,
1204 int rx_flow_control_enable, 1214 int rx_flow_control_enable,
1205 int tx_flow_control_enable, 1215 int tx_flow_control_enable,
1206 u16 pause_period, 1216 u16 pause_period,
@@ -1486,9 +1496,9 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1486 1496
1487 ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); 1497 ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2);
1488 if (ret_val != 0) { 1498 if (ret_val != 0) {
1489 ugeth_err 1499 if (netif_msg_probe(ugeth))
1490 ("%s: Preamble length must be between 3 and 7 inclusive.", 1500 ugeth_err("%s: Preamble length must be between 3 and 7 inclusive.",
1491 __FUNCTION__); 1501 __FUNCTION__);
1492 return ret_val; 1502 return ret_val;
1493 } 1503 }
1494 1504
@@ -1726,7 +1736,8 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode)
1726 1736
1727 /* check if the UCC number is in range. */ 1737 /* check if the UCC number is in range. */
1728 if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { 1738 if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
1729 ugeth_err("%s: ucc_num out of range.", __FUNCTION__); 1739 if (netif_msg_probe(ugeth))
1740 ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
1730 return -EINVAL; 1741 return -EINVAL;
1731 } 1742 }
1732 1743
@@ -1754,7 +1765,8 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode)
1754 1765
1755 /* check if the UCC number is in range. */ 1766 /* check if the UCC number is in range. */
1756 if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { 1767 if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
1757 ugeth_err("%s: ucc_num out of range.", __FUNCTION__); 1768 if (netif_msg_probe(ugeth))
1769 ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
1758 return -EINVAL; 1770 return -EINVAL;
1759 } 1771 }
1760 1772
@@ -2306,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2306 2318
2307 if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || 2319 if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) ||
2308 (uf_info->bd_mem_part == MEM_PART_MURAM))) { 2320 (uf_info->bd_mem_part == MEM_PART_MURAM))) {
2309 ugeth_err("%s: Bad memory partition value.", __FUNCTION__); 2321 if (netif_msg_probe(ugeth))
2322 ugeth_err("%s: Bad memory partition value.",
2323 __FUNCTION__);
2310 return -EINVAL; 2324 return -EINVAL;
2311 } 2325 }
2312 2326
@@ -2315,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2315 if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || 2329 if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) ||
2316 (ug_info->bdRingLenRx[i] % 2330 (ug_info->bdRingLenRx[i] %
2317 UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { 2331 UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) {
2318 ugeth_err 2332 if (netif_msg_probe(ugeth))
2319 ("%s: Rx BD ring length must be multiple of 4," 2333 ugeth_err
2320 " no smaller than 8.", __FUNCTION__); 2334 ("%s: Rx BD ring length must be multiple of 4, no smaller than 8.",
2335 __FUNCTION__);
2321 return -EINVAL; 2336 return -EINVAL;
2322 } 2337 }
2323 } 2338 }
@@ -2325,9 +2340,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2325 /* Tx BD lengths */ 2340 /* Tx BD lengths */
2326 for (i = 0; i < ug_info->numQueuesTx; i++) { 2341 for (i = 0; i < ug_info->numQueuesTx; i++) {
2327 if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { 2342 if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) {
2328 ugeth_err 2343 if (netif_msg_probe(ugeth))
2329 ("%s: Tx BD ring length must be no smaller than 2.", 2344 ugeth_err
2330 __FUNCTION__); 2345 ("%s: Tx BD ring length must be no smaller than 2.",
2346 __FUNCTION__);
2331 return -EINVAL; 2347 return -EINVAL;
2332 } 2348 }
2333 } 2349 }
@@ -2335,31 +2351,35 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2335 /* mrblr */ 2351 /* mrblr */
2336 if ((uf_info->max_rx_buf_length == 0) || 2352 if ((uf_info->max_rx_buf_length == 0) ||
2337 (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { 2353 (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) {
2338 ugeth_err 2354 if (netif_msg_probe(ugeth))
2339 ("%s: max_rx_buf_length must be non-zero multiple of 128.", 2355 ugeth_err
2340 __FUNCTION__); 2356 ("%s: max_rx_buf_length must be non-zero multiple of 128.",
2357 __FUNCTION__);
2341 return -EINVAL; 2358 return -EINVAL;
2342 } 2359 }
2343 2360
2344 /* num Tx queues */ 2361 /* num Tx queues */
2345 if (ug_info->numQueuesTx > NUM_TX_QUEUES) { 2362 if (ug_info->numQueuesTx > NUM_TX_QUEUES) {
2346 ugeth_err("%s: number of tx queues too large.", __FUNCTION__); 2363 if (netif_msg_probe(ugeth))
2364 ugeth_err("%s: number of tx queues too large.", __FUNCTION__);
2347 return -EINVAL; 2365 return -EINVAL;
2348 } 2366 }
2349 2367
2350 /* num Rx queues */ 2368 /* num Rx queues */
2351 if (ug_info->numQueuesRx > NUM_RX_QUEUES) { 2369 if (ug_info->numQueuesRx > NUM_RX_QUEUES) {
2352 ugeth_err("%s: number of rx queues too large.", __FUNCTION__); 2370 if (netif_msg_probe(ugeth))
2371 ugeth_err("%s: number of rx queues too large.", __FUNCTION__);
2353 return -EINVAL; 2372 return -EINVAL;
2354 } 2373 }
2355 2374
2356 /* l2qt */ 2375 /* l2qt */
2357 for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { 2376 for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) {
2358 if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { 2377 if (ug_info->l2qt[i] >= ug_info->numQueuesRx) {
2359 ugeth_err 2378 if (netif_msg_probe(ugeth))
2360 ("%s: VLAN priority table entry must not be" 2379 ugeth_err
2361 " larger than number of Rx queues.", 2380 ("%s: VLAN priority table entry must not be"
2362 __FUNCTION__); 2381 " larger than number of Rx queues.",
2382 __FUNCTION__);
2363 return -EINVAL; 2383 return -EINVAL;
2364 } 2384 }
2365 } 2385 }
@@ -2367,26 +2387,29 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2367 /* l3qt */ 2387 /* l3qt */
2368 for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { 2388 for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) {
2369 if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { 2389 if (ug_info->l3qt[i] >= ug_info->numQueuesRx) {
2370 ugeth_err 2390 if (netif_msg_probe(ugeth))
2371 ("%s: IP priority table entry must not be" 2391 ugeth_err
2372 " larger than number of Rx queues.", 2392 ("%s: IP priority table entry must not be"
2373 __FUNCTION__); 2393 " larger than number of Rx queues.",
2394 __FUNCTION__);
2374 return -EINVAL; 2395 return -EINVAL;
2375 } 2396 }
2376 } 2397 }
2377 2398
2378 if (ug_info->cam && !ug_info->ecamptr) { 2399 if (ug_info->cam && !ug_info->ecamptr) {
2379 ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", 2400 if (netif_msg_probe(ugeth))
2380 __FUNCTION__); 2401 ugeth_err("%s: If cam mode is chosen, must supply cam ptr.",
2402 __FUNCTION__);
2381 return -EINVAL; 2403 return -EINVAL;
2382 } 2404 }
2383 2405
2384 if ((ug_info->numStationAddresses != 2406 if ((ug_info->numStationAddresses !=
2385 UCC_GETH_NUM_OF_STATION_ADDRESSES_1) 2407 UCC_GETH_NUM_OF_STATION_ADDRESSES_1)
2386 && ug_info->rxExtendedFiltering) { 2408 && ug_info->rxExtendedFiltering) {
2387 ugeth_err("%s: Number of station addresses greater than 1 " 2409 if (netif_msg_probe(ugeth))
2388 "not allowed in extended parsing mode.", 2410 ugeth_err("%s: Number of station addresses greater than 1 "
2389 __FUNCTION__); 2411 "not allowed in extended parsing mode.",
2412 __FUNCTION__);
2390 return -EINVAL; 2413 return -EINVAL;
2391 } 2414 }
2392 2415
@@ -2399,7 +2422,8 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2399 uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); 2422 uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i);
2400 /* Initialize the general fast UCC block. */ 2423 /* Initialize the general fast UCC block. */
2401 if (ucc_fast_init(uf_info, &ugeth->uccf)) { 2424 if (ucc_fast_init(uf_info, &ugeth->uccf)) {
2402 ugeth_err("%s: Failed to init uccf.", __FUNCTION__); 2425 if (netif_msg_probe(ugeth))
2426 ugeth_err("%s: Failed to init uccf.", __FUNCTION__);
2403 ucc_geth_memclean(ugeth); 2427 ucc_geth_memclean(ugeth);
2404 return -ENOMEM; 2428 return -ENOMEM;
2405 } 2429 }
@@ -2452,7 +2476,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2452 numThreadsRxNumerical = 8; 2476 numThreadsRxNumerical = 8;
2453 break; 2477 break;
2454 default: 2478 default:
2455 ugeth_err("%s: Bad number of Rx threads value.", __FUNCTION__); 2479 if (netif_msg_ifup(ugeth))
2480 ugeth_err("%s: Bad number of Rx threads value.",
2481 __FUNCTION__);
2456 ucc_geth_memclean(ugeth); 2482 ucc_geth_memclean(ugeth);
2457 return -EINVAL; 2483 return -EINVAL;
2458 break; 2484 break;
@@ -2475,7 +2501,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2475 numThreadsTxNumerical = 8; 2501 numThreadsTxNumerical = 8;
2476 break; 2502 break;
2477 default: 2503 default:
2478 ugeth_err("%s: Bad number of Tx threads value.", __FUNCTION__); 2504 if (netif_msg_ifup(ugeth))
2505 ugeth_err("%s: Bad number of Tx threads value.",
2506 __FUNCTION__);
2479 ucc_geth_memclean(ugeth); 2507 ucc_geth_memclean(ugeth);
2480 return -EINVAL; 2508 return -EINVAL;
2481 break; 2509 break;
@@ -2507,7 +2535,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2507 /* For more details see the hardware spec. */ 2535 /* For more details see the hardware spec. */
2508 init_flow_control_params(ug_info->aufc, 2536 init_flow_control_params(ug_info->aufc,
2509 ug_info->receiveFlowControl, 2537 ug_info->receiveFlowControl,
2510 1, 2538 ug_info->transmitFlowControl,
2511 ug_info->pausePeriod, 2539 ug_info->pausePeriod,
2512 ug_info->extensionField, 2540 ug_info->extensionField,
2513 &uf_regs->upsmr, 2541 &uf_regs->upsmr,
@@ -2527,8 +2555,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2527 ug_info->backToBackInterFrameGap, 2555 ug_info->backToBackInterFrameGap,
2528 &ug_regs->ipgifg); 2556 &ug_regs->ipgifg);
2529 if (ret_val != 0) { 2557 if (ret_val != 0) {
2530 ugeth_err("%s: IPGIFG initialization parameter too large.", 2558 if (netif_msg_ifup(ugeth))
2531 __FUNCTION__); 2559 ugeth_err("%s: IPGIFG initialization parameter too large.",
2560 __FUNCTION__);
2532 ucc_geth_memclean(ugeth); 2561 ucc_geth_memclean(ugeth);
2533 return ret_val; 2562 return ret_val;
2534 } 2563 }
@@ -2544,7 +2573,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2544 ug_info->collisionWindow, 2573 ug_info->collisionWindow,
2545 &ug_regs->hafdup); 2574 &ug_regs->hafdup);
2546 if (ret_val != 0) { 2575 if (ret_val != 0) {
2547 ugeth_err("%s: Half Duplex initialization parameter too large.", 2576 if (netif_msg_ifup(ugeth))
2577 ugeth_err("%s: Half Duplex initialization parameter too large.",
2548 __FUNCTION__); 2578 __FUNCTION__);
2549 ucc_geth_memclean(ugeth); 2579 ucc_geth_memclean(ugeth);
2550 return ret_val; 2580 return ret_val;
@@ -2597,9 +2627,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2597 tx_bd_ring_offset[j]); 2627 tx_bd_ring_offset[j]);
2598 } 2628 }
2599 if (!ugeth->p_tx_bd_ring[j]) { 2629 if (!ugeth->p_tx_bd_ring[j]) {
2600 ugeth_err 2630 if (netif_msg_ifup(ugeth))
2601 ("%s: Can not allocate memory for Tx bd rings.", 2631 ugeth_err
2602 __FUNCTION__); 2632 ("%s: Can not allocate memory for Tx bd rings.",
2633 __FUNCTION__);
2603 ucc_geth_memclean(ugeth); 2634 ucc_geth_memclean(ugeth);
2604 return -ENOMEM; 2635 return -ENOMEM;
2605 } 2636 }
@@ -2632,9 +2663,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2632 rx_bd_ring_offset[j]); 2663 rx_bd_ring_offset[j]);
2633 } 2664 }
2634 if (!ugeth->p_rx_bd_ring[j]) { 2665 if (!ugeth->p_rx_bd_ring[j]) {
2635 ugeth_err 2666 if (netif_msg_ifup(ugeth))
2636 ("%s: Can not allocate memory for Rx bd rings.", 2667 ugeth_err
2637 __FUNCTION__); 2668 ("%s: Can not allocate memory for Rx bd rings.",
2669 __FUNCTION__);
2638 ucc_geth_memclean(ugeth); 2670 ucc_geth_memclean(ugeth);
2639 return -ENOMEM; 2671 return -ENOMEM;
2640 } 2672 }
@@ -2648,8 +2680,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2648 GFP_KERNEL); 2680 GFP_KERNEL);
2649 2681
2650 if (ugeth->tx_skbuff[j] == NULL) { 2682 if (ugeth->tx_skbuff[j] == NULL) {
2651 ugeth_err("%s: Could not allocate tx_skbuff", 2683 if (netif_msg_ifup(ugeth))
2652 __FUNCTION__); 2684 ugeth_err("%s: Could not allocate tx_skbuff",
2685 __FUNCTION__);
2653 ucc_geth_memclean(ugeth); 2686 ucc_geth_memclean(ugeth);
2654 return -ENOMEM; 2687 return -ENOMEM;
2655 } 2688 }
@@ -2679,8 +2712,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2679 GFP_KERNEL); 2712 GFP_KERNEL);
2680 2713
2681 if (ugeth->rx_skbuff[j] == NULL) { 2714 if (ugeth->rx_skbuff[j] == NULL) {
2682 ugeth_err("%s: Could not allocate rx_skbuff", 2715 if (netif_msg_ifup(ugeth))
2683 __FUNCTION__); 2716 ugeth_err("%s: Could not allocate rx_skbuff",
2717 __FUNCTION__);
2684 ucc_geth_memclean(ugeth); 2718 ucc_geth_memclean(ugeth);
2685 return -ENOMEM; 2719 return -ENOMEM;
2686 } 2720 }
@@ -2711,9 +2745,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2711 qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), 2745 qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram),
2712 UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); 2746 UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT);
2713 if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { 2747 if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) {
2714 ugeth_err 2748 if (netif_msg_ifup(ugeth))
2715 ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", 2749 ugeth_err
2716 __FUNCTION__); 2750 ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
2751 __FUNCTION__);
2717 ucc_geth_memclean(ugeth); 2752 ucc_geth_memclean(ugeth);
2718 return -ENOMEM; 2753 return -ENOMEM;
2719 } 2754 }
@@ -2733,9 +2768,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2733 32 * (numThreadsTxNumerical == 1), 2768 32 * (numThreadsTxNumerical == 1),
2734 UCC_GETH_THREAD_DATA_ALIGNMENT); 2769 UCC_GETH_THREAD_DATA_ALIGNMENT);
2735 if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { 2770 if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) {
2736 ugeth_err 2771 if (netif_msg_ifup(ugeth))
2737 ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", 2772 ugeth_err
2738 __FUNCTION__); 2773 ("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
2774 __FUNCTION__);
2739 ucc_geth_memclean(ugeth); 2775 ucc_geth_memclean(ugeth);
2740 return -ENOMEM; 2776 return -ENOMEM;
2741 } 2777 }
@@ -2761,9 +2797,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2761 sizeof(struct ucc_geth_send_queue_qd), 2797 sizeof(struct ucc_geth_send_queue_qd),
2762 UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); 2798 UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT);
2763 if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { 2799 if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) {
2764 ugeth_err 2800 if (netif_msg_ifup(ugeth))
2765 ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", 2801 ugeth_err
2766 __FUNCTION__); 2802 ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
2803 __FUNCTION__);
2767 ucc_geth_memclean(ugeth); 2804 ucc_geth_memclean(ugeth);
2768 return -ENOMEM; 2805 return -ENOMEM;
2769 } 2806 }
@@ -2804,9 +2841,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2804 qe_muram_alloc(sizeof(struct ucc_geth_scheduler), 2841 qe_muram_alloc(sizeof(struct ucc_geth_scheduler),
2805 UCC_GETH_SCHEDULER_ALIGNMENT); 2842 UCC_GETH_SCHEDULER_ALIGNMENT);
2806 if (IS_ERR_VALUE(ugeth->scheduler_offset)) { 2843 if (IS_ERR_VALUE(ugeth->scheduler_offset)) {
2807 ugeth_err 2844 if (netif_msg_ifup(ugeth))
2808 ("%s: Can not allocate DPRAM memory for p_scheduler.", 2845 ugeth_err
2809 __FUNCTION__); 2846 ("%s: Can not allocate DPRAM memory for p_scheduler.",
2847 __FUNCTION__);
2810 ucc_geth_memclean(ugeth); 2848 ucc_geth_memclean(ugeth);
2811 return -ENOMEM; 2849 return -ENOMEM;
2812 } 2850 }
@@ -2852,9 +2890,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2852 (struct ucc_geth_tx_firmware_statistics_pram), 2890 (struct ucc_geth_tx_firmware_statistics_pram),
2853 UCC_GETH_TX_STATISTICS_ALIGNMENT); 2891 UCC_GETH_TX_STATISTICS_ALIGNMENT);
2854 if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { 2892 if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) {
2855 ugeth_err 2893 if (netif_msg_ifup(ugeth))
2856 ("%s: Can not allocate DPRAM memory for" 2894 ugeth_err
2857 " p_tx_fw_statistics_pram.", __FUNCTION__); 2895 ("%s: Can not allocate DPRAM memory for"
2896 " p_tx_fw_statistics_pram.",
2897 __FUNCTION__);
2858 ucc_geth_memclean(ugeth); 2898 ucc_geth_memclean(ugeth);
2859 return -ENOMEM; 2899 return -ENOMEM;
2860 } 2900 }
@@ -2891,9 +2931,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2891 qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), 2931 qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram),
2892 UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); 2932 UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT);
2893 if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { 2933 if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) {
2894 ugeth_err 2934 if (netif_msg_ifup(ugeth))
2895 ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", 2935 ugeth_err
2896 __FUNCTION__); 2936 ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
2937 __FUNCTION__);
2897 ucc_geth_memclean(ugeth); 2938 ucc_geth_memclean(ugeth);
2898 return -ENOMEM; 2939 return -ENOMEM;
2899 } 2940 }
@@ -2912,9 +2953,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2912 sizeof(struct ucc_geth_thread_data_rx), 2953 sizeof(struct ucc_geth_thread_data_rx),
2913 UCC_GETH_THREAD_DATA_ALIGNMENT); 2954 UCC_GETH_THREAD_DATA_ALIGNMENT);
2914 if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { 2955 if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) {
2915 ugeth_err 2956 if (netif_msg_ifup(ugeth))
2916 ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", 2957 ugeth_err
2917 __FUNCTION__); 2958 ("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
2959 __FUNCTION__);
2918 ucc_geth_memclean(ugeth); 2960 ucc_geth_memclean(ugeth);
2919 return -ENOMEM; 2961 return -ENOMEM;
2920 } 2962 }
@@ -2935,9 +2977,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2935 (struct ucc_geth_rx_firmware_statistics_pram), 2977 (struct ucc_geth_rx_firmware_statistics_pram),
2936 UCC_GETH_RX_STATISTICS_ALIGNMENT); 2978 UCC_GETH_RX_STATISTICS_ALIGNMENT);
2937 if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { 2979 if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) {
2938 ugeth_err 2980 if (netif_msg_ifup(ugeth))
2939 ("%s: Can not allocate DPRAM memory for" 2981 ugeth_err
2940 " p_rx_fw_statistics_pram.", __FUNCTION__); 2982 ("%s: Can not allocate DPRAM memory for"
2983 " p_rx_fw_statistics_pram.", __FUNCTION__);
2941 ucc_geth_memclean(ugeth); 2984 ucc_geth_memclean(ugeth);
2942 return -ENOMEM; 2985 return -ENOMEM;
2943 } 2986 }
@@ -2957,9 +3000,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2957 sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) 3000 sizeof(struct ucc_geth_rx_interrupt_coalescing_entry)
2958 + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); 3001 + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT);
2959 if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { 3002 if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) {
2960 ugeth_err 3003 if (netif_msg_ifup(ugeth))
2961 ("%s: Can not allocate DPRAM memory for" 3004 ugeth_err
2962 " p_rx_irq_coalescing_tbl.", __FUNCTION__); 3005 ("%s: Can not allocate DPRAM memory for"
3006 " p_rx_irq_coalescing_tbl.", __FUNCTION__);
2963 ucc_geth_memclean(ugeth); 3007 ucc_geth_memclean(ugeth);
2964 return -ENOMEM; 3008 return -ENOMEM;
2965 } 3009 }
@@ -3025,9 +3069,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3025 sizeof(struct ucc_geth_rx_prefetched_bds)), 3069 sizeof(struct ucc_geth_rx_prefetched_bds)),
3026 UCC_GETH_RX_BD_QUEUES_ALIGNMENT); 3070 UCC_GETH_RX_BD_QUEUES_ALIGNMENT);
3027 if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { 3071 if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) {
3028 ugeth_err 3072 if (netif_msg_ifup(ugeth))
3029 ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", 3073 ugeth_err
3030 __FUNCTION__); 3074 ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
3075 __FUNCTION__);
3031 ucc_geth_memclean(ugeth); 3076 ucc_geth_memclean(ugeth);
3032 return -ENOMEM; 3077 return -ENOMEM;
3033 } 3078 }
@@ -3102,8 +3147,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3102 /* initialize extended filtering */ 3147 /* initialize extended filtering */
3103 if (ug_info->rxExtendedFiltering) { 3148 if (ug_info->rxExtendedFiltering) {
3104 if (!ug_info->extendedFilteringChainPointer) { 3149 if (!ug_info->extendedFilteringChainPointer) {
3105 ugeth_err("%s: Null Extended Filtering Chain Pointer.", 3150 if (netif_msg_ifup(ugeth))
3106 __FUNCTION__); 3151 ugeth_err("%s: Null Extended Filtering Chain Pointer.",
3152 __FUNCTION__);
3107 ucc_geth_memclean(ugeth); 3153 ucc_geth_memclean(ugeth);
3108 return -EINVAL; 3154 return -EINVAL;
3109 } 3155 }
@@ -3114,9 +3160,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3114 qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), 3160 qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram),
3115 UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); 3161 UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT);
3116 if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { 3162 if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) {
3117 ugeth_err 3163 if (netif_msg_ifup(ugeth))
3118 ("%s: Can not allocate DPRAM memory for" 3164 ugeth_err
3119 " p_exf_glbl_param.", __FUNCTION__); 3165 ("%s: Can not allocate DPRAM memory for"
3166 " p_exf_glbl_param.", __FUNCTION__);
3120 ucc_geth_memclean(ugeth); 3167 ucc_geth_memclean(ugeth);
3121 return -ENOMEM; 3168 return -ENOMEM;
3122 } 3169 }
@@ -3161,9 +3208,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3161 */ 3208 */
3162 if (!(ugeth->p_init_enet_param_shadow = 3209 if (!(ugeth->p_init_enet_param_shadow =
3163 kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { 3210 kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
3164 ugeth_err 3211 if (netif_msg_ifup(ugeth))
3165 ("%s: Can not allocate memory for" 3212 ugeth_err
3166 " p_UccInitEnetParamShadows.", __FUNCTION__); 3213 ("%s: Can not allocate memory for"
3214 " p_UccInitEnetParamShadows.", __FUNCTION__);
3167 ucc_geth_memclean(ugeth); 3215 ucc_geth_memclean(ugeth);
3168 return -ENOMEM; 3216 return -ENOMEM;
3169 } 3217 }
@@ -3196,8 +3244,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3196 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) 3244 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
3197 && (ug_info->largestexternallookupkeysize != 3245 && (ug_info->largestexternallookupkeysize !=
3198 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { 3246 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) {
3199 ugeth_err("%s: Invalid largest External Lookup Key Size.", 3247 if (netif_msg_ifup(ugeth))
3200 __FUNCTION__); 3248 ugeth_err("%s: Invalid largest External Lookup Key Size.",
3249 __FUNCTION__);
3201 ucc_geth_memclean(ugeth); 3250 ucc_geth_memclean(ugeth);
3202 return -EINVAL; 3251 return -EINVAL;
3203 } 3252 }
@@ -3222,8 +3271,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3222 /* Rx needs one extra for terminator */ 3271 /* Rx needs one extra for terminator */
3223 , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, 3272 , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT,
3224 ug_info->riscRx, 1)) != 0) { 3273 ug_info->riscRx, 1)) != 0) {
3225 ugeth_err("%s: Can not fill p_init_enet_param_shadow.", 3274 if (netif_msg_ifup(ugeth))
3226 __FUNCTION__); 3275 ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
3276 __FUNCTION__);
3227 ucc_geth_memclean(ugeth); 3277 ucc_geth_memclean(ugeth);
3228 return ret_val; 3278 return ret_val;
3229 } 3279 }
@@ -3237,8 +3287,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3237 sizeof(struct ucc_geth_thread_tx_pram), 3287 sizeof(struct ucc_geth_thread_tx_pram),
3238 UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, 3288 UCC_GETH_THREAD_TX_PRAM_ALIGNMENT,
3239 ug_info->riscTx, 0)) != 0) { 3289 ug_info->riscTx, 0)) != 0) {
3240 ugeth_err("%s: Can not fill p_init_enet_param_shadow.", 3290 if (netif_msg_ifup(ugeth))
3241 __FUNCTION__); 3291 ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
3292 __FUNCTION__);
3242 ucc_geth_memclean(ugeth); 3293 ucc_geth_memclean(ugeth);
3243 return ret_val; 3294 return ret_val;
3244 } 3295 }
@@ -3246,8 +3297,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3246 /* Load Rx bds with buffers */ 3297 /* Load Rx bds with buffers */
3247 for (i = 0; i < ug_info->numQueuesRx; i++) { 3298 for (i = 0; i < ug_info->numQueuesRx; i++) {
3248 if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { 3299 if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) {
3249 ugeth_err("%s: Can not fill Rx bds with buffers.", 3300 if (netif_msg_ifup(ugeth))
3250 __FUNCTION__); 3301 ugeth_err("%s: Can not fill Rx bds with buffers.",
3302 __FUNCTION__);
3251 ucc_geth_memclean(ugeth); 3303 ucc_geth_memclean(ugeth);
3252 return ret_val; 3304 return ret_val;
3253 } 3305 }
@@ -3256,9 +3308,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3256 /* Allocate InitEnet command parameter structure */ 3308 /* Allocate InitEnet command parameter structure */
3257 init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); 3309 init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4);
3258 if (IS_ERR_VALUE(init_enet_pram_offset)) { 3310 if (IS_ERR_VALUE(init_enet_pram_offset)) {
3259 ugeth_err 3311 if (netif_msg_ifup(ugeth))
3260 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", 3312 ugeth_err
3261 __FUNCTION__); 3313 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
3314 __FUNCTION__);
3262 ucc_geth_memclean(ugeth); 3315 ucc_geth_memclean(ugeth);
3263 return -ENOMEM; 3316 return -ENOMEM;
3264 } 3317 }
@@ -3428,8 +3481,9 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3428 if (!skb || 3481 if (!skb ||
3429 (!(bd_status & (R_F | R_L))) || 3482 (!(bd_status & (R_F | R_L))) ||
3430 (bd_status & R_ERRORS_FATAL)) { 3483 (bd_status & R_ERRORS_FATAL)) {
3431 ugeth_vdbg("%s, %d: ERROR!!! skb - 0x%08x", 3484 if (netif_msg_rx_err(ugeth))
3432 __FUNCTION__, __LINE__, (u32) skb); 3485 ugeth_err("%s, %d: ERROR!!! skb - 0x%08x",
3486 __FUNCTION__, __LINE__, (u32) skb);
3433 if (skb) 3487 if (skb)
3434 dev_kfree_skb_any(skb); 3488 dev_kfree_skb_any(skb);
3435 3489
@@ -3458,7 +3512,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3458 3512
3459 skb = get_new_skb(ugeth, bd); 3513 skb = get_new_skb(ugeth, bd);
3460 if (!skb) { 3514 if (!skb) {
3461 ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); 3515 if (netif_msg_rx_err(ugeth))
3516 ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__);
3462 ugeth->stats.rx_dropped++; 3517 ugeth->stats.rx_dropped++;
3463 break; 3518 break;
3464 } 3519 }
@@ -3649,28 +3704,32 @@ static int ucc_geth_open(struct net_device *dev)
3649 3704
3650 /* Test station address */ 3705 /* Test station address */
3651 if (dev->dev_addr[0] & ENET_GROUP_ADDR) { 3706 if (dev->dev_addr[0] & ENET_GROUP_ADDR) {
3652 ugeth_err("%s: Multicast address used for station address" 3707 if (netif_msg_ifup(ugeth))
3653 " - is this what you wanted?", __FUNCTION__); 3708 ugeth_err("%s: Multicast address used for station address"
3709 " - is this what you wanted?", __FUNCTION__);
3654 return -EINVAL; 3710 return -EINVAL;
3655 } 3711 }
3656 3712
3657 err = ucc_struct_init(ugeth); 3713 err = ucc_struct_init(ugeth);
3658 if (err) { 3714 if (err) {
3659 ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); 3715 if (netif_msg_ifup(ugeth))
3716 ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name);
3660 return err; 3717 return err;
3661 } 3718 }
3662 3719
3663 err = ucc_geth_startup(ugeth); 3720 err = ucc_geth_startup(ugeth);
3664 if (err) { 3721 if (err) {
3665 ugeth_err("%s: Cannot configure net device, aborting.", 3722 if (netif_msg_ifup(ugeth))
3666 dev->name); 3723 ugeth_err("%s: Cannot configure net device, aborting.",
3724 dev->name);
3667 return err; 3725 return err;
3668 } 3726 }
3669 3727
3670 err = adjust_enet_interface(ugeth); 3728 err = adjust_enet_interface(ugeth);
3671 if (err) { 3729 if (err) {
3672 ugeth_err("%s: Cannot configure net device, aborting.", 3730 if (netif_msg_ifup(ugeth))
3673 dev->name); 3731 ugeth_err("%s: Cannot configure net device, aborting.",
3732 dev->name);
3674 return err; 3733 return err;
3675 } 3734 }
3676 3735
@@ -3687,7 +3746,8 @@ static int ucc_geth_open(struct net_device *dev)
3687 3746
3688 err = init_phy(dev); 3747 err = init_phy(dev);
3689 if (err) { 3748 if (err) {
3690 ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); 3749 if (netif_msg_ifup(ugeth))
3750 ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name);
3691 return err; 3751 return err;
3692 } 3752 }
3693 3753
@@ -3697,15 +3757,17 @@ static int ucc_geth_open(struct net_device *dev)
3697 request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, 3757 request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0,
3698 "UCC Geth", dev); 3758 "UCC Geth", dev);
3699 if (err) { 3759 if (err) {
3700 ugeth_err("%s: Cannot get IRQ for net device, aborting.", 3760 if (netif_msg_ifup(ugeth))
3701 dev->name); 3761 ugeth_err("%s: Cannot get IRQ for net device, aborting.",
3762 dev->name);
3702 ucc_geth_stop(ugeth); 3763 ucc_geth_stop(ugeth);
3703 return err; 3764 return err;
3704 } 3765 }
3705 3766
3706 err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); 3767 err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
3707 if (err) { 3768 if (err) {
3708 ugeth_err("%s: Cannot enable net device, aborting.", dev->name); 3769 if (netif_msg_ifup(ugeth))
3770 ugeth_err("%s: Cannot enable net device, aborting.", dev->name);
3709 ucc_geth_stop(ugeth); 3771 ucc_geth_stop(ugeth);
3710 return err; 3772 return err;
3711 } 3773 }
@@ -3732,8 +3794,6 @@ static int ucc_geth_close(struct net_device *dev)
3732 return 0; 3794 return 0;
3733} 3795}
3734 3796
3735const struct ethtool_ops ucc_geth_ethtool_ops = { };
3736
3737static phy_interface_t to_phy_interface(const char *phy_connection_type) 3797static phy_interface_t to_phy_interface(const char *phy_connection_type)
3738{ 3798{
3739 if (strcasecmp(phy_connection_type, "mii") == 0) 3799 if (strcasecmp(phy_connection_type, "mii") == 0)
@@ -3790,6 +3850,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3790 return -ENODEV; 3850 return -ENODEV;
3791 3851
3792 ug_info = &ugeth_info[ucc_num]; 3852 ug_info = &ugeth_info[ucc_num];
3853 if (ug_info == NULL) {
3854 if (netif_msg_probe(&debug))
3855 ugeth_err("%s: [%d] Missing additional data!",
3856 __FUNCTION__, ucc_num);
3857 return -ENODEV;
3858 }
3859
3793 ug_info->uf_info.ucc_num = ucc_num; 3860 ug_info->uf_info.ucc_num = ucc_num;
3794 3861
3795 prop = of_get_property(np, "rx-clock", NULL); 3862 prop = of_get_property(np, "rx-clock", NULL);
@@ -3868,15 +3935,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3868 3935
3869 ug_info->mdio_bus = res.start; 3936 ug_info->mdio_bus = res.start;
3870 3937
3871 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", 3938 if (netif_msg_probe(&debug))
3872 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, 3939 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
3873 ug_info->uf_info.irq); 3940 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
3874 3941 ug_info->uf_info.irq);
3875 if (ug_info == NULL) {
3876 ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__,
3877 ucc_num);
3878 return -ENODEV;
3879 }
3880 3942
3881 /* Create an ethernet device instance */ 3943 /* Create an ethernet device instance */
3882 dev = alloc_etherdev(sizeof(*ugeth)); 3944 dev = alloc_etherdev(sizeof(*ugeth));
@@ -3896,6 +3958,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3896 SET_NETDEV_DEV(dev, device); 3958 SET_NETDEV_DEV(dev, device);
3897 3959
3898 /* Fill in the dev structure */ 3960 /* Fill in the dev structure */
3961 uec_set_ethtool_ops(dev);
3899 dev->open = ucc_geth_open; 3962 dev->open = ucc_geth_open;
3900 dev->hard_start_xmit = ucc_geth_start_xmit; 3963 dev->hard_start_xmit = ucc_geth_start_xmit;
3901 dev->tx_timeout = ucc_geth_timeout; 3964 dev->tx_timeout = ucc_geth_timeout;
@@ -3909,16 +3972,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3909// dev->change_mtu = ucc_geth_change_mtu; 3972// dev->change_mtu = ucc_geth_change_mtu;
3910 dev->mtu = 1500; 3973 dev->mtu = 1500;
3911 dev->set_multicast_list = ucc_geth_set_multi; 3974 dev->set_multicast_list = ucc_geth_set_multi;
3912 dev->ethtool_ops = &ucc_geth_ethtool_ops;
3913 3975
3914 ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; 3976 ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
3915 ugeth->phy_interface = phy_interface; 3977 ugeth->phy_interface = phy_interface;
3916 ugeth->max_speed = max_speed; 3978 ugeth->max_speed = max_speed;
3917 3979
3918 err = register_netdev(dev); 3980 err = register_netdev(dev);
3919 if (err) { 3981 if (err) {
3920 ugeth_err("%s: Cannot register net device, aborting.", 3982 if (netif_msg_probe(ugeth))
3921 dev->name); 3983 ugeth_err("%s: Cannot register net device, aborting.",
3984 dev->name);
3922 free_netdev(dev); 3985 free_netdev(dev);
3923 return err; 3986 return err;
3924 } 3987 }
@@ -3972,7 +4035,8 @@ static int __init ucc_geth_init(void)
3972 if (ret) 4035 if (ret)
3973 return ret; 4036 return ret;
3974 4037
3975 printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); 4038 if (netif_msg_drv(&debug))
4039 printk(KERN_INFO "ucc_geth: " DRV_DESC "\n");
3976 for (i = 0; i < 8; i++) 4040 for (i = 0; i < 8; i++)
3977 memcpy(&(ugeth_info[i]), &ugeth_primary_info, 4041 memcpy(&(ugeth_info[i]), &ugeth_primary_info,
3978 sizeof(ugeth_primary_info)); 4042 sizeof(ugeth_primary_info));