aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2007-07-18 23:47:47 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-24 16:28:38 -0400
commitac421852b3a01e7440ac7bb2e635b60a99d0a391 (patch)
treeb5dc87e69b764cf40cb5fb3a915340e1bbd0a08b /drivers/net
parentf695baf2df9e0413d3521661070103711545207a (diff)
ucc_geth: add ethtool support
The patch enables statistics in ucc_geth and adds ethtool support to ucc_geth driver. Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Makefile2
-rw-r--r--drivers/net/ucc_geth.c19
-rw-r--r--drivers/net/ucc_geth.h6
-rw-r--r--drivers/net/ucc_geth_ethtool.c388
-rw-r--r--drivers/net/ucc_geth_mii.c6
5 files changed, 407 insertions, 14 deletions
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 336af0635df8..94b78cc5fe86 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -18,7 +18,7 @@ gianfar_driver-objs := gianfar.o \
18 gianfar_sysfs.o 18 gianfar_sysfs.o
19 19
20obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o 20obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
21ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o 21ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o
22 22
23# 23#
24# link order important here 24# link order important here
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e4736a3b1b7a..4a3fd62156d9 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
@@ -65,6 +61,8 @@
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 */
67 63
64void uec_set_ethtool_ops(struct net_device *netdev);
65
68static DEFINE_SPINLOCK(ugeth_lock); 66static DEFINE_SPINLOCK(ugeth_lock);
69 67
70static struct ucc_geth_info ugeth_primary_info = { 68static struct ucc_geth_info ugeth_primary_info = {
@@ -104,6 +102,7 @@ static struct ucc_geth_info ugeth_primary_info = {
104 .maxRetransmission = 0xf, 102 .maxRetransmission = 0xf,
105 .collisionWindow = 0x37, 103 .collisionWindow = 0x37,
106 .receiveFlowControl = 1, 104 .receiveFlowControl = 1,
105 .transmitFlowControl = 1,
107 .maxGroupAddrInHash = 4, 106 .maxGroupAddrInHash = 4,
108 .maxIndAddrInHash = 4, 107 .maxIndAddrInHash = 4,
109 .prel = 7, 108 .prel = 7,
@@ -139,7 +138,9 @@ static struct ucc_geth_info ugeth_primary_info = {
139 .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1, 138 .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
140 .largestexternallookupkeysize = 139 .largestexternallookupkeysize =
141 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE, 140 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
142 .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE, 141 .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
142 UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
143 UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
143 .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP, 144 .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
144 .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP, 145 .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
145 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, 146 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
@@ -1200,7 +1201,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
1200 return 0; 1201 return 0;
1201} 1202}
1202 1203
1203static int init_flow_control_params(u32 automatic_flow_control_mode, 1204int init_flow_control_params(u32 automatic_flow_control_mode,
1204 int rx_flow_control_enable, 1205 int rx_flow_control_enable,
1205 int tx_flow_control_enable, 1206 int tx_flow_control_enable,
1206 u16 pause_period, 1207 u16 pause_period,
@@ -2507,7 +2508,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2507 /* For more details see the hardware spec. */ 2508 /* For more details see the hardware spec. */
2508 init_flow_control_params(ug_info->aufc, 2509 init_flow_control_params(ug_info->aufc,
2509 ug_info->receiveFlowControl, 2510 ug_info->receiveFlowControl,
2510 1, 2511 ug_info->transmitFlowControl,
2511 ug_info->pausePeriod, 2512 ug_info->pausePeriod,
2512 ug_info->extensionField, 2513 ug_info->extensionField,
2513 &uf_regs->upsmr, 2514 &uf_regs->upsmr,
@@ -3732,8 +3733,6 @@ static int ucc_geth_close(struct net_device *dev)
3732 return 0; 3733 return 0;
3733} 3734}
3734 3735
3735const struct ethtool_ops ucc_geth_ethtool_ops = { };
3736
3737static phy_interface_t to_phy_interface(const char *phy_connection_type) 3736static phy_interface_t to_phy_interface(const char *phy_connection_type)
3738{ 3737{
3739 if (strcasecmp(phy_connection_type, "mii") == 0) 3738 if (strcasecmp(phy_connection_type, "mii") == 0)
@@ -3896,6 +3895,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3896 SET_NETDEV_DEV(dev, device); 3895 SET_NETDEV_DEV(dev, device);
3897 3896
3898 /* Fill in the dev structure */ 3897 /* Fill in the dev structure */
3898 uec_set_ethtool_ops(dev);
3899 dev->open = ucc_geth_open; 3899 dev->open = ucc_geth_open;
3900 dev->hard_start_xmit = ucc_geth_start_xmit; 3900 dev->hard_start_xmit = ucc_geth_start_xmit;
3901 dev->tx_timeout = ucc_geth_timeout; 3901 dev->tx_timeout = ucc_geth_timeout;
@@ -3909,7 +3909,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3909// dev->change_mtu = ucc_geth_change_mtu; 3909// dev->change_mtu = ucc_geth_change_mtu;
3910 dev->mtu = 1500; 3910 dev->mtu = 1500;
3911 dev->set_multicast_list = ucc_geth_set_multi; 3911 dev->set_multicast_list = ucc_geth_set_multi;
3912 dev->ethtool_ops = &ucc_geth_ethtool_ops;
3913 3912
3914 ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; 3913 ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
3915 ugeth->phy_interface = phy_interface; 3914 ugeth->phy_interface = phy_interface;
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index a29e1c3ca4b7..bb4dac8c0c65 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -30,6 +30,10 @@
30 30
31#include "ucc_geth_mii.h" 31#include "ucc_geth_mii.h"
32 32
33#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
34#define DRV_NAME "ucc_geth"
35#define DRV_VERSION "1.1"
36
33#define NUM_TX_QUEUES 8 37#define NUM_TX_QUEUES 8
34#define NUM_RX_QUEUES 8 38#define NUM_RX_QUEUES 8
35#define NUM_BDS_IN_PREFETCHED_BDS 4 39#define NUM_BDS_IN_PREFETCHED_BDS 4
@@ -896,6 +900,7 @@ struct ucc_geth_hardware_statistics {
896#define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8 900#define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8
897#define UCC_GETH_RX_BD_RING_SIZE_MIN 8 901#define UCC_GETH_RX_BD_RING_SIZE_MIN 8
898#define UCC_GETH_TX_BD_RING_SIZE_MIN 2 902#define UCC_GETH_TX_BD_RING_SIZE_MIN 2
903#define UCC_GETH_BD_RING_SIZE_MAX 0xffff
899 904
900#define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD 905#define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD
901 906
@@ -1135,6 +1140,7 @@ struct ucc_geth_info {
1135 int bro; 1140 int bro;
1136 int ecm; 1141 int ecm;
1137 int receiveFlowControl; 1142 int receiveFlowControl;
1143 int transmitFlowControl;
1138 u8 maxGroupAddrInHash; 1144 u8 maxGroupAddrInHash;
1139 u8 maxIndAddrInHash; 1145 u8 maxIndAddrInHash;
1140 u8 prel; 1146 u8 prel;
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
new file mode 100644
index 000000000000..a8994c7b8583
--- /dev/null
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -0,0 +1,388 @@
1/*
2 * Copyright (c) 2007 Freescale Semiconductor, Inc. All rights reserved.
3 *
4 * Description: QE UCC Gigabit Ethernet Ethtool API Set
5 *
6 * Author: Li Yang <leoli@freescale.com>
7 *
8 * Limitation:
9 * Can only get/set setttings of the first queue.
10 * Need to re-open the interface manually after changing some paramters.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/slab.h>
22#include <linux/stddef.h>
23#include <linux/interrupt.h>
24#include <linux/netdevice.h>
25#include <linux/etherdevice.h>
26#include <linux/skbuff.h>
27#include <linux/spinlock.h>
28#include <linux/mm.h>
29#include <linux/delay.h>
30#include <linux/dma-mapping.h>
31#include <linux/fsl_devices.h>
32#include <linux/ethtool.h>
33#include <linux/mii.h>
34#include <linux/phy.h>
35
36#include <asm/io.h>
37#include <asm/irq.h>
38#include <asm/uaccess.h>
39#include <asm/types.h>
40#include <asm/uaccess.h>
41
42#include "ucc_geth.h"
43#include "ucc_geth_mii.h"
44
45static char hw_stat_gstrings[][ETH_GSTRING_LEN] = {
46 "tx-64-frames",
47 "tx-65-127-frames",
48 "tx-128-255-frames",
49 "rx-64-frames",
50 "rx-65-127-frames",
51 "rx-128-255-frames",
52 "tx-bytes-ok",
53 "tx-pause-frames",
54 "tx-multicast-frames",
55 "tx-broadcast-frames",
56 "rx-frames",
57 "rx-bytes-ok",
58 "rx-bytes-all",
59 "rx-multicast-frames",
60 "rx-broadcast-frames",
61 "stats-counter-carry",
62 "stats-counter-mask",
63 "rx-dropped-frames",
64};
65
66static char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = {
67 "tx-single-collision",
68 "tx-multiple-collision",
69 "tx-late-collsion",
70 "tx-aborted-frames",
71 "tx-lost-frames",
72 "tx-carrier-sense-errors",
73 "tx-frames-ok",
74 "tx-excessive-differ-frames",
75 "tx-256-511-frames",
76 "tx-1024-1518-frames",
77 "tx-jumbo-frames",
78};
79
80static char rx_fw_stat_gstrings[][ETH_GSTRING_LEN] = {
81 "rx-crc-errors",
82 "rx-alignment-errors",
83 "rx-in-range-length-errors",
84 "rx-out-of-range-length-errors",
85 "rx-too-long-frames",
86 "rx-runt",
87 "rx-very-long-event",
88 "rx-symbol-errors",
89 "rx-busy-drop-frames",
90 "reserved",
91 "reserved",
92 "rx-mismatch-drop-frames",
93 "rx-small-than-64",
94 "rx-256-511-frames",
95 "rx-512-1023-frames",
96 "rx-1024-1518-frames",
97 "rx-jumbo-frames",
98 "rx-mac-error-loss",
99 "rx-pause-frames",
100 "reserved",
101 "rx-vlan-removed",
102 "rx-vlan-replaced",
103 "rx-vlan-inserted",
104 "rx-ip-checksum-errors",
105};
106
107#define UEC_HW_STATS_LEN ARRAY_SIZE(hw_stat_gstrings)
108#define UEC_TX_FW_STATS_LEN ARRAY_SIZE(tx_fw_stat_gstrings)
109#define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings)
110
111extern int init_flow_control_params(u32 automatic_flow_control_mode,
112 int rx_flow_control_enable,
113 int tx_flow_control_enable, u16 pause_period,
114 u16 extension_field, volatile u32 *upsmr_register,
115 volatile u32 *uempr_register, volatile u32 *maccfg1_register);
116
117static int
118uec_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
119{
120 struct ucc_geth_private *ugeth = netdev_priv(netdev);
121 struct phy_device *phydev = ugeth->phydev;
122 struct ucc_geth_info *ug_info = ugeth->ug_info;
123
124 if (!phydev)
125 return -ENODEV;
126
127 ecmd->maxtxpkt = 1;
128 ecmd->maxrxpkt = ug_info->interruptcoalescingmaxvalue[0];
129
130 return phy_ethtool_gset(phydev, ecmd);
131}
132
133static int
134uec_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
135{
136 struct ucc_geth_private *ugeth = netdev_priv(netdev);
137 struct phy_device *phydev = ugeth->phydev;
138
139 if (!phydev)
140 return -ENODEV;
141
142 return phy_ethtool_sset(phydev, ecmd);
143}
144
145static void
146uec_get_pauseparam(struct net_device *netdev,
147 struct ethtool_pauseparam *pause)
148{
149 struct ucc_geth_private *ugeth = netdev_priv(netdev);
150
151 pause->autoneg = ugeth->phydev->autoneg;
152
153 if (ugeth->ug_info->receiveFlowControl)
154 pause->rx_pause = 1;
155 if (ugeth->ug_info->transmitFlowControl)
156 pause->tx_pause = 1;
157}
158
159static int
160uec_set_pauseparam(struct net_device *netdev,
161 struct ethtool_pauseparam *pause)
162{
163 struct ucc_geth_private *ugeth = netdev_priv(netdev);
164 int ret = 0;
165
166 ugeth->ug_info->receiveFlowControl = pause->rx_pause;
167 ugeth->ug_info->transmitFlowControl = pause->tx_pause;
168
169 if (ugeth->phydev->autoneg) {
170 if (netif_running(netdev)) {
171 /* FIXME: automatically restart */
172 printk(KERN_INFO
173 "Please re-open the interface.\n");
174 }
175 } else {
176 struct ucc_geth_info *ug_info = ugeth->ug_info;
177
178 ret = init_flow_control_params(ug_info->aufc,
179 ug_info->receiveFlowControl,
180 ug_info->transmitFlowControl,
181 ug_info->pausePeriod,
182 ug_info->extensionField,
183 &ugeth->uccf->uf_regs->upsmr,
184 &ugeth->ug_regs->uempr,
185 &ugeth->ug_regs->maccfg1);
186 }
187
188 return ret;
189}
190
191static uint32_t
192uec_get_msglevel(struct net_device *netdev)
193{
194 struct ucc_geth_private *ugeth = netdev_priv(netdev);
195 return ugeth->msg_enable;
196}
197
198static void
199uec_set_msglevel(struct net_device *netdev, uint32_t data)
200{
201 struct ucc_geth_private *ugeth = netdev_priv(netdev);
202 ugeth->msg_enable = data;
203}
204
205static int
206uec_get_regs_len(struct net_device *netdev)
207{
208 return sizeof(struct ucc_geth);
209}
210
211static void
212uec_get_regs(struct net_device *netdev,
213 struct ethtool_regs *regs, void *p)
214{
215 int i;
216 struct ucc_geth_private *ugeth = netdev_priv(netdev);
217 u32 __iomem *ug_regs = (u32 __iomem *)ugeth->ug_regs;
218 u32 *buff = p;
219
220 for (i = 0; i < sizeof(struct ucc_geth) / sizeof(u32); i++)
221 buff[i] = in_be32(&ug_regs[i]);
222}
223
224static void
225uec_get_ringparam(struct net_device *netdev,
226 struct ethtool_ringparam *ring)
227{
228 struct ucc_geth_private *ugeth = netdev_priv(netdev);
229 struct ucc_geth_info *ug_info = ugeth->ug_info;
230 int queue = 0;
231
232 ring->rx_max_pending = UCC_GETH_BD_RING_SIZE_MAX;
233 ring->rx_mini_max_pending = UCC_GETH_BD_RING_SIZE_MAX;
234 ring->rx_jumbo_max_pending = UCC_GETH_BD_RING_SIZE_MAX;
235 ring->tx_max_pending = UCC_GETH_BD_RING_SIZE_MAX;
236
237 ring->rx_pending = ug_info->bdRingLenRx[queue];
238 ring->rx_mini_pending = ug_info->bdRingLenRx[queue];
239 ring->rx_jumbo_pending = ug_info->bdRingLenRx[queue];
240 ring->tx_pending = ug_info->bdRingLenTx[queue];
241}
242
243static int
244uec_set_ringparam(struct net_device *netdev,
245 struct ethtool_ringparam *ring)
246{
247 struct ucc_geth_private *ugeth = netdev_priv(netdev);
248 struct ucc_geth_info *ug_info = ugeth->ug_info;
249 int queue = 0, ret = 0;
250
251 if (ring->rx_pending < UCC_GETH_RX_BD_RING_SIZE_MIN) {
252 printk("%s: RxBD ring size must be no smaller than %d.\n",
253 netdev->name, UCC_GETH_RX_BD_RING_SIZE_MIN);
254 return -EINVAL;
255 }
256 if (ring->rx_pending % UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT) {
257 printk("%s: RxBD ring size must be multiple of %d.\n",
258 netdev->name, UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT);
259 return -EINVAL;
260 }
261 if (ring->tx_pending < UCC_GETH_TX_BD_RING_SIZE_MIN) {
262 printk("%s: TxBD ring size must be no smaller than %d.\n",
263 netdev->name, UCC_GETH_TX_BD_RING_SIZE_MIN);
264 return -EINVAL;
265 }
266
267 ug_info->bdRingLenRx[queue] = ring->rx_pending;
268 ug_info->bdRingLenTx[queue] = ring->tx_pending;
269
270 if (netif_running(netdev)) {
271 /* FIXME: restart automatically */
272 printk(KERN_INFO
273 "Please re-open the interface.\n");
274 }
275
276 return ret;
277}
278
279static int uec_get_stats_count(struct net_device *netdev)
280{
281 struct ucc_geth_private *ugeth = netdev_priv(netdev);
282 u32 stats_mode = ugeth->ug_info->statisticsMode;
283 int len = 0;
284
285 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE)
286 len += UEC_HW_STATS_LEN;
287 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX)
288 len += UEC_TX_FW_STATS_LEN;
289 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX)
290 len += UEC_RX_FW_STATS_LEN;
291
292 return len;
293}
294
295static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
296{
297 struct ucc_geth_private *ugeth = netdev_priv(netdev);
298 u32 stats_mode = ugeth->ug_info->statisticsMode;
299
300 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
301 memcpy(buf, hw_stat_gstrings, UEC_HW_STATS_LEN *
302 ETH_GSTRING_LEN);
303 buf += UEC_HW_STATS_LEN * ETH_GSTRING_LEN;
304 }
305 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
306 memcpy(buf, tx_fw_stat_gstrings, UEC_TX_FW_STATS_LEN *
307 ETH_GSTRING_LEN);
308 buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN;
309 }
310 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX)
311 memcpy(buf, tx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN *
312 ETH_GSTRING_LEN);
313}
314
315static void uec_get_ethtool_stats(struct net_device *netdev,
316 struct ethtool_stats *stats, uint64_t *data)
317{
318 struct ucc_geth_private *ugeth = netdev_priv(netdev);
319 u32 stats_mode = ugeth->ug_info->statisticsMode;
320 u32 __iomem *base;
321 int i, j = 0;
322
323 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
324 base = (u32 __iomem *)&ugeth->ug_regs->tx64;
325 for (i = 0; i < UEC_HW_STATS_LEN; i++)
326 data[j++] = (u64)in_be32(&base[i]);
327 }
328 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
329 base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram;
330 for (i = 0; i < UEC_TX_FW_STATS_LEN; i++)
331 data[j++] = (u64)in_be32(&base[i]);
332 }
333 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) {
334 base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram;
335 for (i = 0; i < UEC_RX_FW_STATS_LEN; i++)
336 data[j++] = (u64)in_be32(&base[i]);
337 }
338}
339
340static int uec_nway_reset(struct net_device *netdev)
341{
342 struct ucc_geth_private *ugeth = netdev_priv(netdev);
343
344 return phy_start_aneg(ugeth->phydev);
345}
346
347/* Report driver information */
348static void
349uec_get_drvinfo(struct net_device *netdev,
350 struct ethtool_drvinfo *drvinfo)
351{
352 strncpy(drvinfo->driver, DRV_NAME, 32);
353 strncpy(drvinfo->version, DRV_VERSION, 32);
354 strncpy(drvinfo->fw_version, "N/A", 32);
355 strncpy(drvinfo->bus_info, "QUICC ENGINE", 32);
356 drvinfo->n_stats = uec_get_stats_count(netdev);
357 drvinfo->testinfo_len = 0;
358 drvinfo->eedump_len = 0;
359 drvinfo->regdump_len = uec_get_regs_len(netdev);
360}
361
362static const struct ethtool_ops uec_ethtool_ops = {
363 .get_settings = uec_get_settings,
364 .set_settings = uec_set_settings,
365 .get_drvinfo = uec_get_drvinfo,
366 .get_regs_len = uec_get_regs_len,
367 .get_regs = uec_get_regs,
368 .get_msglevel = uec_get_msglevel,
369 .set_msglevel = uec_set_msglevel,
370 .nway_reset = uec_nway_reset,
371 .get_link = ethtool_op_get_link,
372 .get_ringparam = uec_get_ringparam,
373 .set_ringparam = uec_set_ringparam,
374 .get_pauseparam = uec_get_pauseparam,
375 .set_pauseparam = uec_set_pauseparam,
376 .get_sg = ethtool_op_get_sg,
377 .set_sg = ethtool_op_set_sg,
378 .get_tso = ethtool_op_get_tso,
379 .get_stats_count = uec_get_stats_count,
380 .get_strings = uec_get_strings,
381 .get_ethtool_stats = uec_get_ethtool_stats,
382 .get_perm_addr = ethtool_op_get_perm_addr,
383};
384
385void uec_set_ethtool_ops(struct net_device *netdev)
386{
387 SET_ETHTOOL_OPS(netdev, &uec_ethtool_ops);
388}
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 7bcb82f50cf7..5f8c2d30a328 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -54,8 +54,8 @@
54#define vdbg(format, arg...) do {} while(0) 54#define vdbg(format, arg...) do {} while(0)
55#endif 55#endif
56 56
57#define DRV_DESC "QE UCC Ethernet Controller MII Bus" 57#define MII_DRV_DESC "QE UCC Ethernet Controller MII Bus"
58#define DRV_NAME "fsl-uec_mdio" 58#define MII_DRV_NAME "fsl-uec_mdio"
59 59
60/* Write value to the PHY for this device to the register at regnum, */ 60/* Write value to the PHY for this device to the register at regnum, */
61/* waiting until the write is done before it returns. All PHY */ 61/* waiting until the write is done before it returns. All PHY */
@@ -261,7 +261,7 @@ static struct of_device_id uec_mdio_match[] = {
261}; 261};
262 262
263static struct of_platform_driver uec_mdio_driver = { 263static struct of_platform_driver uec_mdio_driver = {
264 .name = DRV_NAME, 264 .name = MII_DRV_NAME,
265 .probe = uec_mdio_probe, 265 .probe = uec_mdio_probe,
266 .remove = uec_mdio_remove, 266 .remove = uec_mdio_remove,
267 .match_table = uec_mdio_match, 267 .match_table = uec_mdio_match,