aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1/atl1_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/atl1/atl1_hw.c')
-rw-r--r--drivers/net/atl1/atl1_hw.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 69482e0d849b..ef886bdeac13 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -2,20 +2,20 @@
2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
3 * Copyright(c) 2006 Chris Snook <csnook@redhat.com> 3 * Copyright(c) 2006 Chris Snook <csnook@redhat.com>
4 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> 4 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com>
5 * 5 *
6 * Derived from Intel e1000 driver 6 * Derived from Intel e1000 driver
7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free 10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option) 11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version. 12 * any later version.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details. 17 * more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License along with 19 * You should have received a copy of the GNU General Public License along with
20 * this program; if not, write to the Free Software Foundation, Inc., 59 20 * this program; if not, write to the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -38,12 +38,13 @@
38 */ 38 */
39s32 atl1_reset_hw(struct atl1_hw *hw) 39s32 atl1_reset_hw(struct atl1_hw *hw)
40{ 40{
41 struct pci_dev *pdev = hw->back->pdev;
41 u32 icr; 42 u32 icr;
42 int i; 43 int i;
43 44
44 /* 45 /*
45 * Clear Interrupt mask to stop board from generating 46 * Clear Interrupt mask to stop board from generating
46 * interrupts & Clear any pending interrupt events 47 * interrupts & Clear any pending interrupt events
47 */ 48 */
48 /* 49 /*
49 * iowrite32(0, hw->hw_addr + REG_IMR); 50 * iowrite32(0, hw->hw_addr + REG_IMR);
@@ -74,7 +75,7 @@ s32 atl1_reset_hw(struct atl1_hw *hw)
74 } 75 }
75 76
76 if (icr) { 77 if (icr) {
77 printk (KERN_DEBUG "icr = %x\n", icr); 78 dev_dbg(&pdev->dev, "ICR = 0x%x\n", icr);
78 return icr; 79 return icr;
79 } 80 }
80 81
@@ -136,8 +137,8 @@ s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data)
136 int i; 137 int i;
137 138
138 val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | 139 val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT |
139 MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << 140 MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 <<
140 MDIO_CLK_SEL_SHIFT; 141 MDIO_CLK_SEL_SHIFT;
141 iowrite32(val, hw->hw_addr + REG_MDIO_CTRL); 142 iowrite32(val, hw->hw_addr + REG_MDIO_CTRL);
142 ioread32(hw->hw_addr + REG_MDIO_CTRL); 143 ioread32(hw->hw_addr + REG_MDIO_CTRL);
143 144
@@ -204,7 +205,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 *buf)
204 205
205/* 206/*
206 * get_permanent_address 207 * get_permanent_address
207 * return 0 if get valid mac address, 208 * return 0 if get valid mac address,
208 */ 209 */
209static int atl1_get_permanent_address(struct atl1_hw *hw) 210static int atl1_get_permanent_address(struct atl1_hw *hw)
210{ 211{
@@ -301,7 +302,7 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
301} 302}
302 303
303/* 304/*
304 * Reads the adapter's MAC address from the EEPROM 305 * Reads the adapter's MAC address from the EEPROM
305 * hw - Struct containing variables accessed by shared code 306 * hw - Struct containing variables accessed by shared code
306 */ 307 */
307s32 atl1_read_mac_addr(struct atl1_hw *hw) 308s32 atl1_read_mac_addr(struct atl1_hw *hw)
@@ -437,6 +438,7 @@ s32 atl1_phy_enter_power_saving(struct atl1_hw *hw)
437 */ 438 */
438static s32 atl1_phy_reset(struct atl1_hw *hw) 439static s32 atl1_phy_reset(struct atl1_hw *hw)
439{ 440{
441 struct pci_dev *pdev = hw->back->pdev;
440 s32 ret_val; 442 s32 ret_val;
441 u16 phy_data; 443 u16 phy_data;
442 444
@@ -468,8 +470,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
468 u32 val; 470 u32 val;
469 int i; 471 int i;
470 /* pcie serdes link may be down! */ 472 /* pcie serdes link may be down! */
471 printk(KERN_DEBUG "%s: autoneg caused pcie phy link down\n", 473 dev_dbg(&pdev->dev, "pcie phy link down\n");
472 atl1_driver_name);
473 474
474 for (i = 0; i < 25; i++) { 475 for (i = 0; i < 25; i++) {
475 msleep(1); 476 msleep(1);
@@ -479,9 +480,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw)
479 } 480 }
480 481
481 if ((val & (MDIO_START | MDIO_BUSY)) != 0) { 482 if ((val & (MDIO_START | MDIO_BUSY)) != 0) {
482 printk(KERN_WARNING 483 dev_warn(&pdev->dev, "pcie link down at least 25ms\n");
483 "%s: pcie link down at least for 25ms\n",
484 atl1_driver_name);
485 return ret_val; 484 return ret_val;
486 } 485 }
487 } 486 }
@@ -571,6 +570,7 @@ s32 atl1_phy_setup_autoneg_adv(struct atl1_hw *hw)
571 */ 570 */
572static s32 atl1_setup_link(struct atl1_hw *hw) 571static s32 atl1_setup_link(struct atl1_hw *hw)
573{ 572{
573 struct pci_dev *pdev = hw->back->pdev;
574 s32 ret_val; 574 s32 ret_val;
575 575
576 /* 576 /*
@@ -581,15 +581,13 @@ static s32 atl1_setup_link(struct atl1_hw *hw)
581 */ 581 */
582 ret_val = atl1_phy_setup_autoneg_adv(hw); 582 ret_val = atl1_phy_setup_autoneg_adv(hw);
583 if (ret_val) { 583 if (ret_val) {
584 printk(KERN_DEBUG "%s: error setting up autonegotiation\n", 584 dev_dbg(&pdev->dev, "error setting up autonegotiation\n");
585 atl1_driver_name);
586 return ret_val; 585 return ret_val;
587 } 586 }
588 /* SW.Reset , En-Auto-Neg if needed */ 587 /* SW.Reset , En-Auto-Neg if needed */
589 ret_val = atl1_phy_reset(hw); 588 ret_val = atl1_phy_reset(hw);
590 if (ret_val) { 589 if (ret_val) {
591 printk(KERN_DEBUG "%s: error resetting the phy\n", 590 dev_dbg(&pdev->dev, "error resetting phy\n");
592 atl1_driver_name);
593 return ret_val; 591 return ret_val;
594 } 592 }
595 hw->phy_configured = true; 593 hw->phy_configured = true;
@@ -631,7 +629,7 @@ static void atl1_init_flash_opcode(struct atl1_hw *hw)
631 * Performs basic configuration of the adapter. 629 * Performs basic configuration of the adapter.
632 * hw - Struct containing variables accessed by shared code 630 * hw - Struct containing variables accessed by shared code
633 * Assumes that the controller has previously been reset and is in a 631 * Assumes that the controller has previously been reset and is in a
634 * post-reset uninitialized state. Initializes multicast table, 632 * post-reset uninitialized state. Initializes multicast table,
635 * and Calls routines to setup link 633 * and Calls routines to setup link
636 * Leaves the transmit and receive units disabled and uninitialized. 634 * Leaves the transmit and receive units disabled and uninitialized.
637 */ 635 */
@@ -669,6 +667,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
669 */ 667 */
670s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex) 668s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex)
671{ 669{
670 struct pci_dev *pdev = hw->back->pdev;
672 s32 ret_val; 671 s32 ret_val;
673 u16 phy_data; 672 u16 phy_data;
674 673
@@ -691,8 +690,7 @@ s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex)
691 *speed = SPEED_10; 690 *speed = SPEED_10;
692 break; 691 break;
693 default: 692 default:
694 printk(KERN_DEBUG "%s: error getting speed\n", 693 dev_dbg(&pdev->dev, "error getting speed\n");
695 atl1_driver_name);
696 return ATL1_ERR_PHY_SPEED; 694 return ATL1_ERR_PHY_SPEED;
697 break; 695 break;
698 } 696 }