aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index 3dc19f482959..e9f95dcde379 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -318,19 +318,15 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
318} 318}
319 319
320#if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) 320#if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE)
321static int tx4939_get_eth_speed(struct net_device *dev) 321static u32 tx4939_get_eth_speed(struct net_device *dev)
322{ 322{
323 struct ethtool_cmd cmd = { ETHTOOL_GSET }; 323 struct ethtool_cmd cmd;
324 int speed = 100; /* default 100Mbps */ 324 if (dev_ethtool_get_settings(dev, &cmd))
325 int err; 325 return 100; /* default 100Mbps */
326 if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) 326
327 return speed; 327 return ethtool_cmd_speed(&cmd);
328 err = dev->ethtool_ops->get_settings(dev, &cmd);
329 if (err < 0)
330 return speed;
331 speed = cmd.speed == SPEED_100 ? 100 : 10;
332 return speed;
333} 328}
329
334static int tx4939_netdev_event(struct notifier_block *this, 330static int tx4939_netdev_event(struct notifier_block *this,
335 unsigned long event, 331 unsigned long event,
336 void *ptr) 332 void *ptr)
@@ -343,8 +339,7 @@ static int tx4939_netdev_event(struct notifier_block *this,
343 else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1)) 339 else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1))
344 bit = TX4939_PCFG_SPEED1; 340 bit = TX4939_PCFG_SPEED1;
345 if (bit) { 341 if (bit) {
346 int speed = tx4939_get_eth_speed(dev); 342 if (tx4939_get_eth_speed(dev) == 100)
347 if (speed == 100)
348 txx9_set64(&tx4939_ccfgptr->pcfg, bit); 343 txx9_set64(&tx4939_ccfgptr->pcfg, bit);
349 else 344 else
350 txx9_clear64(&tx4939_ccfgptr->pcfg, bit); 345 txx9_clear64(&tx4939_ccfgptr->pcfg, bit);