aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/au1000_eth.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-04-06 18:09:01 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-07 05:07:48 -0400
commiteb0496308f22093d5b3ce6c9d591233047f41d39 (patch)
tree9a5717bc47d356765f0b1b490701d038407ea491 /drivers/net/au1000_eth.c
parent13130c7a9909df0f675623d73cafe595f93ce617 (diff)
au1000-eth: prefix all functions with au1000_
In order to avoid namespace clashes, prefix all internal driver functions with au1000_. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/au1000_eth.c')
-rw-r--r--drivers/net/au1000_eth.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index b96abc586c79..7d40177de399 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -149,7 +149,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
149 * specific irq-map 149 * specific irq-map
150 */ 150 */
151 151
152static void enable_mac(struct net_device *dev, int force_reset) 152static void au1000_enable_mac(struct net_device *dev, int force_reset)
153{ 153{
154 unsigned long flags; 154 unsigned long flags;
155 struct au1000_private *aup = netdev_priv(dev); 155 struct au1000_private *aup = netdev_priv(dev);
@@ -237,7 +237,7 @@ static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
237 * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */ 237 * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */
238 struct net_device *const dev = bus->priv; 238 struct net_device *const dev = bus->priv;
239 239
240 enable_mac(dev, 0); /* make sure the MAC associated with this 240 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
241 * mii_bus is enabled */ 241 * mii_bus is enabled */
242 return au1000_mdio_read(dev, phy_addr, regnum); 242 return au1000_mdio_read(dev, phy_addr, regnum);
243} 243}
@@ -247,7 +247,7 @@ static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
247{ 247{
248 struct net_device *const dev = bus->priv; 248 struct net_device *const dev = bus->priv;
249 249
250 enable_mac(dev, 0); /* make sure the MAC associated with this 250 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
251 * mii_bus is enabled */ 251 * mii_bus is enabled */
252 au1000_mdio_write(dev, phy_addr, regnum, value); 252 au1000_mdio_write(dev, phy_addr, regnum, value);
253 return 0; 253 return 0;
@@ -257,12 +257,12 @@ static int au1000_mdiobus_reset(struct mii_bus *bus)
257{ 257{
258 struct net_device *const dev = bus->priv; 258 struct net_device *const dev = bus->priv;
259 259
260 enable_mac(dev, 0); /* make sure the MAC associated with this 260 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
261 * mii_bus is enabled */ 261 * mii_bus is enabled */
262 return 0; 262 return 0;
263} 263}
264 264
265static void hard_stop(struct net_device *dev) 265static void au1000_hard_stop(struct net_device *dev)
266{ 266{
267 struct au1000_private *aup = netdev_priv(dev); 267 struct au1000_private *aup = netdev_priv(dev);
268 268
@@ -273,7 +273,7 @@ static void hard_stop(struct net_device *dev)
273 au_sync_delay(10); 273 au_sync_delay(10);
274} 274}
275 275
276static void enable_rx_tx(struct net_device *dev) 276static void au1000_enable_rx_tx(struct net_device *dev)
277{ 277{
278 struct au1000_private *aup = netdev_priv(dev); 278 struct au1000_private *aup = netdev_priv(dev);
279 279
@@ -320,7 +320,7 @@ au1000_adjust_link(struct net_device *dev)
320 // duplex mode changed 320 // duplex mode changed
321 321
322 /* switching duplex mode requires to disable rx and tx! */ 322 /* switching duplex mode requires to disable rx and tx! */
323 hard_stop(dev); 323 au1000_hard_stop(dev);
324 324
325 if (DUPLEX_FULL == phydev->duplex) 325 if (DUPLEX_FULL == phydev->duplex)
326 aup->mac->control = ((aup->mac->control 326 aup->mac->control = ((aup->mac->control
@@ -332,7 +332,7 @@ au1000_adjust_link(struct net_device *dev)
332 | MAC_DISABLE_RX_OWN); 332 | MAC_DISABLE_RX_OWN);
333 au_sync_delay(1); 333 au_sync_delay(1);
334 334
335 enable_rx_tx(dev); 335 au1000_enable_rx_tx(dev);
336 aup->old_duplex = phydev->duplex; 336 aup->old_duplex = phydev->duplex;
337 337
338 status_change = 1; 338 status_change = 1;
@@ -363,7 +363,7 @@ au1000_adjust_link(struct net_device *dev)
363 } 363 }
364} 364}
365 365
366static int mii_probe (struct net_device *dev) 366static int au1000_mii_probe (struct net_device *dev)
367{ 367{
368 struct au1000_private *const aup = netdev_priv(dev); 368 struct au1000_private *const aup = netdev_priv(dev);
369 struct phy_device *phydev = NULL; 369 struct phy_device *phydev = NULL;
@@ -463,7 +463,7 @@ static int mii_probe (struct net_device *dev)
463 * has the virtual and dma address of a buffer suitable for 463 * has the virtual and dma address of a buffer suitable for
464 * both, receive and transmit operations. 464 * both, receive and transmit operations.
465 */ 465 */
466static db_dest_t *GetFreeDB(struct au1000_private *aup) 466static db_dest_t *au1000_GetFreeDB(struct au1000_private *aup)
467{ 467{
468 db_dest_t *pDB; 468 db_dest_t *pDB;
469 pDB = aup->pDBfree; 469 pDB = aup->pDBfree;
@@ -474,7 +474,7 @@ static db_dest_t *GetFreeDB(struct au1000_private *aup)
474 return pDB; 474 return pDB;
475} 475}
476 476
477void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB) 477void au1000_ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
478{ 478{
479 db_dest_t *pDBfree = aup->pDBfree; 479 db_dest_t *pDBfree = aup->pDBfree;
480 if (pDBfree) 480 if (pDBfree)
@@ -482,12 +482,12 @@ void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
482 aup->pDBfree = pDB; 482 aup->pDBfree = pDB;
483} 483}
484 484
485static void reset_mac_unlocked(struct net_device *dev) 485static void au1000_reset_mac_unlocked(struct net_device *dev)
486{ 486{
487 struct au1000_private *const aup = netdev_priv(dev); 487 struct au1000_private *const aup = netdev_priv(dev);
488 int i; 488 int i;
489 489
490 hard_stop(dev); 490 au1000_hard_stop(dev);
491 491
492 *aup->enable = MAC_EN_CLOCK_ENABLE; 492 *aup->enable = MAC_EN_CLOCK_ENABLE;
493 au_sync_delay(2); 493 au_sync_delay(2);
@@ -508,7 +508,7 @@ static void reset_mac_unlocked(struct net_device *dev)
508 508
509} 509}
510 510
511static void reset_mac(struct net_device *dev) 511static void au1000_reset_mac(struct net_device *dev)
512{ 512{
513 struct au1000_private *const aup = netdev_priv(dev); 513 struct au1000_private *const aup = netdev_priv(dev);
514 unsigned long flags; 514 unsigned long flags;
@@ -519,7 +519,7 @@ static void reset_mac(struct net_device *dev)
519 519
520 spin_lock_irqsave(&aup->lock, flags); 520 spin_lock_irqsave(&aup->lock, flags);
521 521
522 reset_mac_unlocked (dev); 522 au1000_reset_mac_unlocked (dev);
523 523
524 spin_unlock_irqrestore(&aup->lock, flags); 524 spin_unlock_irqrestore(&aup->lock, flags);
525} 525}
@@ -530,7 +530,7 @@ static void reset_mac(struct net_device *dev)
530 * these are not descriptors sitting in memory. 530 * these are not descriptors sitting in memory.
531 */ 531 */
532static void 532static void
533setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base) 533au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
534{ 534{
535 int i; 535 int i;
536 536
@@ -611,7 +611,7 @@ static int au1000_init(struct net_device *dev)
611 printk("%s: au1000_init\n", dev->name); 611 printk("%s: au1000_init\n", dev->name);
612 612
613 /* bring the device out of reset */ 613 /* bring the device out of reset */
614 enable_mac(dev, 1); 614 au1000_enable_mac(dev, 1);
615 615
616 spin_lock_irqsave(&aup->lock, flags); 616 spin_lock_irqsave(&aup->lock, flags);
617 617
@@ -650,7 +650,7 @@ static int au1000_init(struct net_device *dev)
650 return 0; 650 return 0;
651} 651}
652 652
653static inline void update_rx_stats(struct net_device *dev, u32 status) 653static inline void au1000_update_rx_stats(struct net_device *dev, u32 status)
654{ 654{
655 struct net_device_stats *ps = &dev->stats; 655 struct net_device_stats *ps = &dev->stats;
656 656
@@ -694,7 +694,7 @@ static int au1000_rx(struct net_device *dev)
694 while (buff_stat & RX_T_DONE) { 694 while (buff_stat & RX_T_DONE) {
695 status = prxd->status; 695 status = prxd->status;
696 pDB = aup->rx_db_inuse[aup->rx_head]; 696 pDB = aup->rx_db_inuse[aup->rx_head];
697 update_rx_stats(dev, status); 697 au1000_update_rx_stats(dev, status);
698 if (!(status & RX_ERROR)) { 698 if (!(status & RX_ERROR)) {
699 699
700 /* good frame */ 700 /* good frame */
@@ -748,7 +748,7 @@ static int au1000_rx(struct net_device *dev)
748 return 0; 748 return 0;
749} 749}
750 750
751static void update_tx_stats(struct net_device *dev, u32 status) 751static void au1000_update_tx_stats(struct net_device *dev, u32 status)
752{ 752{
753 struct au1000_private *aup = netdev_priv(dev); 753 struct au1000_private *aup = netdev_priv(dev);
754 struct net_device_stats *ps = &dev->stats; 754 struct net_device_stats *ps = &dev->stats;
@@ -784,7 +784,7 @@ static void au1000_tx_ack(struct net_device *dev)
784 ptxd = aup->tx_dma_ring[aup->tx_tail]; 784 ptxd = aup->tx_dma_ring[aup->tx_tail];
785 785
786 while (ptxd->buff_stat & TX_T_DONE) { 786 while (ptxd->buff_stat & TX_T_DONE) {
787 update_tx_stats(dev, ptxd->status); 787 au1000_update_tx_stats(dev, ptxd->status);
788 ptxd->buff_stat &= ~TX_T_DONE; 788 ptxd->buff_stat &= ~TX_T_DONE;
789 ptxd->len = 0; 789 ptxd->len = 0;
790 au_sync(); 790 au_sync();
@@ -861,7 +861,7 @@ static int au1000_close(struct net_device *dev)
861 861
862 spin_lock_irqsave(&aup->lock, flags); 862 spin_lock_irqsave(&aup->lock, flags);
863 863
864 reset_mac_unlocked (dev); 864 au1000_reset_mac_unlocked (dev);
865 865
866 /* stop the device */ 866 /* stop the device */
867 netif_stop_queue(dev); 867 netif_stop_queue(dev);
@@ -899,7 +899,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
899 return NETDEV_TX_BUSY; 899 return NETDEV_TX_BUSY;
900 } 900 }
901 else if (buff_stat & TX_T_DONE) { 901 else if (buff_stat & TX_T_DONE) {
902 update_tx_stats(dev, ptxd->status); 902 au1000_update_tx_stats(dev, ptxd->status);
903 ptxd->len = 0; 903 ptxd->len = 0;
904 } 904 }
905 905
@@ -937,7 +937,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
937static void au1000_tx_timeout(struct net_device *dev) 937static void au1000_tx_timeout(struct net_device *dev)
938{ 938{
939 printk(KERN_ERR "%s: au1000_tx_timeout: dev=%p\n", dev->name, dev); 939 printk(KERN_ERR "%s: au1000_tx_timeout: dev=%p\n", dev->name, dev);
940 reset_mac(dev); 940 au1000_reset_mac(dev);
941 au1000_init(dev); 941 au1000_init(dev);
942 dev->trans_start = jiffies; 942 dev->trans_start = jiffies;
943 netif_wake_queue(dev); 943 netif_wake_queue(dev);
@@ -1089,9 +1089,9 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1089 /* Use the hard coded MAC addresses */ 1089 /* Use the hard coded MAC addresses */
1090 } 1090 }
1091 1091
1092 setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1092 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
1093 } else if (pdev->id == 1) 1093 } else if (pdev->id == 1)
1094 setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1094 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
1095 1095
1096 /* 1096 /*
1097 * Assign to the Ethernet ports two consecutive MAC addresses 1097 * Assign to the Ethernet ports two consecutive MAC addresses
@@ -1153,7 +1153,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1153 goto err_mdiobus_reg; 1153 goto err_mdiobus_reg;
1154 } 1154 }
1155 1155
1156 if (mii_probe(dev) != 0) 1156 if (au1000_mii_probe(dev) != 0)
1157 goto err_out; 1157 goto err_out;
1158 1158
1159 pDBfree = NULL; 1159 pDBfree = NULL;
@@ -1169,7 +1169,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1169 aup->pDBfree = pDBfree; 1169 aup->pDBfree = pDBfree;
1170 1170
1171 for (i = 0; i < NUM_RX_DMA; i++) { 1171 for (i = 0; i < NUM_RX_DMA; i++) {
1172 pDB = GetFreeDB(aup); 1172 pDB = au1000_GetFreeDB(aup);
1173 if (!pDB) { 1173 if (!pDB) {
1174 goto err_out; 1174 goto err_out;
1175 } 1175 }
@@ -1177,7 +1177,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1177 aup->rx_db_inuse[i] = pDB; 1177 aup->rx_db_inuse[i] = pDB;
1178 } 1178 }
1179 for (i = 0; i < NUM_TX_DMA; i++) { 1179 for (i = 0; i < NUM_TX_DMA; i++) {
1180 pDB = GetFreeDB(aup); 1180 pDB = au1000_GetFreeDB(aup);
1181 if (!pDB) { 1181 if (!pDB) {
1182 goto err_out; 1182 goto err_out;
1183 } 1183 }
@@ -1196,7 +1196,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1196 * The boot code uses the ethernet controller, so reset it to start 1196 * The boot code uses the ethernet controller, so reset it to start
1197 * fresh. au1000_init() expects that the device is in reset state. 1197 * fresh. au1000_init() expects that the device is in reset state.
1198 */ 1198 */
1199 reset_mac(dev); 1199 au1000_reset_mac(dev);
1200 1200
1201 err = register_netdev(dev); 1201 err = register_netdev(dev);
1202 if (err) { 1202 if (err) {
@@ -1218,15 +1218,15 @@ err_out:
1218 1218
1219 /* here we should have a valid dev plus aup-> register addresses 1219 /* here we should have a valid dev plus aup-> register addresses
1220 * so we can reset the mac properly.*/ 1220 * so we can reset the mac properly.*/
1221 reset_mac(dev); 1221 au1000_reset_mac(dev);
1222 1222
1223 for (i = 0; i < NUM_RX_DMA; i++) { 1223 for (i = 0; i < NUM_RX_DMA; i++) {
1224 if (aup->rx_db_inuse[i]) 1224 if (aup->rx_db_inuse[i])
1225 ReleaseDB(aup, aup->rx_db_inuse[i]); 1225 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
1226 } 1226 }
1227 for (i = 0; i < NUM_TX_DMA; i++) { 1227 for (i = 0; i < NUM_TX_DMA; i++) {
1228 if (aup->tx_db_inuse[i]) 1228 if (aup->tx_db_inuse[i])
1229 ReleaseDB(aup, aup->tx_db_inuse[i]); 1229 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
1230 } 1230 }
1231err_mdiobus_reg: 1231err_mdiobus_reg:
1232 mdiobus_free(aup->mii_bus); 1232 mdiobus_free(aup->mii_bus);
@@ -1262,11 +1262,11 @@ static int __devexit au1000_remove(struct platform_device *pdev)
1262 1262
1263 for (i = 0; i < NUM_RX_DMA; i++) 1263 for (i = 0; i < NUM_RX_DMA; i++)
1264 if (aup->rx_db_inuse[i]) 1264 if (aup->rx_db_inuse[i])
1265 ReleaseDB(aup, aup->rx_db_inuse[i]); 1265 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
1266 1266
1267 for (i = 0; i < NUM_TX_DMA; i++) 1267 for (i = 0; i < NUM_TX_DMA; i++)
1268 if (aup->tx_db_inuse[i]) 1268 if (aup->tx_db_inuse[i])
1269 ReleaseDB(aup, aup->tx_db_inuse[i]); 1269 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
1270 1270
1271 dma_free_noncoherent(NULL, MAX_BUF_SIZE * 1271 dma_free_noncoherent(NULL, MAX_BUF_SIZE *
1272 (NUM_TX_BUFFS + NUM_RX_BUFFS), 1272 (NUM_TX_BUFFS + NUM_RX_BUFFS),