Re: [PATCH 1/3] sky2: revert to access PCI config via device space

2007-12-01 Thread Jeff Garzik

Stephen Hemminger wrote:

Using the hardware window into PCI config space is more reliable
and smaller/faster than using the pci_config routines. It avoids issues
with MMCONFIG etc.

Reverts: 167f53d05fccb47b6eeadac7f6705b3f2f042d03

Please apply for 2.6.24

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>


applied 1-3


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] sky2: revert to access PCI config via device space

2007-11-27 Thread Stephen Hemminger
Using the hardware window into PCI config space is more reliable
and smaller/faster than using the pci_config routines. It avoids issues
with MMCONFIG etc.

Reverts: 167f53d05fccb47b6eeadac7f6705b3f2f042d03

Please apply for 2.6.24

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>

--- a/drivers/net/sky2.c2007-11-26 14:02:14.0 -0800
+++ b/drivers/net/sky2.c2007-11-26 14:02:31.0 -0800
@@ -240,22 +240,21 @@ static void sky2_power_on(struct sky2_hw
sky2_write8(hw, B2_Y2_CLK_GATE, 0);
 
if (hw->flags & SKY2_HW_ADV_POWER_CTL) {
-   struct pci_dev *pdev = hw->pdev;
u32 reg;
 
-   pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
+   sky2_pci_write32(hw, PCI_DEV_REG3, 0);
 
-   pci_read_config_dword(pdev, PCI_DEV_REG4, ®);
+   reg = sky2_pci_read32(hw, PCI_DEV_REG4);
/* set all bits to 0 except bits 15..12 and 8 */
reg &= P_ASPM_CONTROL_MSK;
-   pci_write_config_dword(pdev, PCI_DEV_REG4, reg);
+   sky2_pci_write32(hw, PCI_DEV_REG4, reg);
 
-   pci_read_config_dword(pdev, PCI_DEV_REG5, ®);
+   reg = sky2_pci_read32(hw, PCI_DEV_REG5);
/* set all bits to 0 except bits 28 & 27 */
reg &= P_CTL_TIM_VMAIN_AV_MSK;
-   pci_write_config_dword(pdev, PCI_DEV_REG5, reg);
+   sky2_pci_write32(hw, PCI_DEV_REG5, reg);
 
-   pci_write_config_dword(pdev, PCI_CFG_REG_1, 0);
+   sky2_pci_write32(hw, PCI_CFG_REG_1, 0);
 
/* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */
reg = sky2_read32(hw, B2_GP_IO);
@@ -619,12 +618,11 @@ static void sky2_phy_init(struct sky2_hw
 
 static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
 {
-   struct pci_dev *pdev = hw->pdev;
u32 reg1;
static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
 
-   pci_read_config_dword(pdev, PCI_DEV_REG1, ®1);
+   reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
/* Turn on/off phy power saving */
if (onoff)
reg1 &= ~phy_power[port];
@@ -634,8 +632,8 @@ static void sky2_phy_power(struct sky2_h
if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
reg1 |= coma_mode[port];
 
-   pci_write_config_dword(pdev, PCI_DEV_REG1, reg1);
-   pci_read_config_dword(pdev, PCI_DEV_REG1, ®1);
+   sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
+   reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
 
udelay(100);
 }
@@ -704,9 +702,9 @@ static void sky2_wol_init(struct sky2_po
sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
 
/* Turn on legacy PCI-Express PME mode */
-   pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1);
+   reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
reg1 |= PCI_Y2_PME_LEGACY;
-   pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1);
+   sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
 
/* block receiver */
sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
@@ -1322,9 +1320,10 @@ static int sky2_up(struct net_device *de
(cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
u16 cmd;
 
-   pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd);
+   cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
cmd &= ~PCI_X_CMD_MAX_SPLIT;
-   pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd);
+   sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
+
}
 
if (netif_msg_ifup(sky2))
@@ -2422,12 +2421,12 @@ static void sky2_hw_intr(struct sky2_hw 
if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
u16 pci_err;
 
-   pci_read_config_word(pdev, PCI_STATUS, &pci_err);
+   pci_err = sky2_pci_read16(hw, PCI_STATUS);
if (net_ratelimit())
dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
pci_err);
 
-   pci_write_config_word(pdev, PCI_STATUS,
+   sky2_pci_write16(hw, PCI_STATUS,
  pci_err | PCI_STATUS_ERROR_BITS);
}
 
@@ -2699,13 +2698,10 @@ static inline u32 sky2_clk2us(const stru
 
 static int __devinit sky2_init(struct sky2_hw *hw)
 {
-   int rc;
u8 t8;
 
/* Enable all clocks and check for bad PCI access */
-   rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0);
-   if (rc)
-   return rc;
+   sky2_pci_write32(hw, PCI_DEV_REG3, 0);
 
sky2_write8(hw, B0_CTST, CS_RST_CLR);
 
@@ -2802,9 +2798,9 @@ static void sky2_reset(struct sky2_hw *h
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
 
/* clear PCI errors, if any */
-   pci_read_config_wo