sky2: update for 2.6.24-rc2
Subsystems (2)
cover sky2: update for 2.6.24-rc2
These patch fix problems that fix some bugs/regressions in sky2 on 2.6.24-rc1.
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 1/7 sky2: enable PCI config writes
On some boards, PCI configuration space access is turned off by default. The 2.6.24 driver doesn't turn it on, and should have.
drivers/net/sky2.c +3 -0
@@ -2791,6 +2791,9 @@ static void sky2_reset(struct sky2_hw *hsky2_write8 (hw,B0_CTST ,CS_RST_SET );sky2_write8 (hw,B0_CTST ,CS_RST_CLR ); +/* allow writes to PCI config */ +sky2_write8 (hw,B2_TST_CTRL1 ,TST_CFG_WRITE_ON ); +/* clear PCI errors, if any */ pci_read_config_word (pdev,PCI_STATUS , &status); status |=PCI_STATUS_ERROR_BITS ;
Signature · 1 line
Stephen Hemminger <[email protected]>
Re: [PATCH 1/7] sky2: enable PCI config writes
applied 1-7
PATCH 2/7 sky2: status ring race fix
In reply to Stephen HemmingerThe D-Link PCI-X board (and maybe others) can lie about status ring entries. It seems it will update the register for last status index before completing the DMA for the ring entry. To avoid reading stale data, zap the old entry and check.
drivers/net/sky2.c +9 -3
@@ -2247,20 +2247,26 @@ static int sky2_status_intr(struct sky2_ do { struct sky2_port *sky2; struct sky2_status_le *le = hw->st_le + hw->st_idx; - unsigned port = le->css & CSS_LINK_BIT; + unsigned port; struct net_device *dev; struct sk_buff *skb; u32 status; u16 length; + u8 opcode = le->opcode; + + if (!(opcode & HW_OWNER)) + break; hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE); + port = le->css & CSS_LINK_BIT; dev = hw->dev[port]; sky2 = netdev_priv(dev); length = le16_to_cpu(le->length); status = le32_to_cpu(le->status); - switch (le->opcode & ~HW_OWNER) { + le->opcode = 0; + switch (opcode & ~HW_OWNER) { case OP_RXSTAT: ++rx[port]; skb = sky2_receive(dev, length, status);
@@ -2353,7 +2359,7 @@ static int sky2_status_intr(struct sky2_default :if (net_ratelimit ()) printk(KERN_WARNING PFX -"unknown status opcode 0x%x\n" , le->opcode); +"unknown status opcode 0x%x\n" , opcode); } }while (hw->st_idx != idx);
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 3/7 sky2: longer PHY delay
In reply to Stephen HemmingerIncrese phy delay and handle I/O errors.
drivers/net/sky2.c +25 -10
@@ -156,7 +156,7 @@ static const char *yukon2_name[] = {static void sky2_set_multicast (struct net_device *dev); -/* Access to external PHY */ +/* Access to PHY via serial interconnect */ static int gm_phy_write (struct sky2_hw *hw,unsigned port,u16 reg,u16 val) {int i;
@@ -166,13 +166,22 @@ static int gm_phy_write(struct sky2_hw * GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg));for (i =0 ; i <PHY_RETRIES ; i++) { -if (!(gma_read16 (hw, port,GM_SMI_CTRL ) &GM_SMI_CT_BUSY )) +u16 ctrl =gma_read16 (hw, port,GM_SMI_CTRL ); +if (ctrl ==0xffff ) + goto io_error; + +if (!(ctrl &GM_SMI_CT_BUSY ))return 0 ; -udelay (1 ); + +udelay (10 ); } - printk(KERN_WARNING PFX "%s: phy write timeout\n", hw->dev[port]->name); +dev_warn (&hw->pdev->dev,"%s: phy write timeout\n" , hw->dev[port]->name);return -ETIMEDOUT ; + +io_error: +dev_err (&hw->pdev->dev,"%s: phy I/O error\n" , hw->dev[port]->name); +return -EIO ; }static int __gm_phy_read (struct sky2_hw *hw,unsigned port,u16 reg,u16 *val)
@@ -183,23 +192,29 @@ static int __gm_phy_read(struct sky2_hw | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD);for (i =0 ; i <PHY_RETRIES ; i++) { -if (gma_read16 (hw, port,GM_SMI_CTRL ) &GM_SMI_CT_RD_VAL ) { +u16 ctrl =gma_read16 (hw, port,GM_SMI_CTRL ); +if (ctrl ==0xffff ) + goto io_error; + +if (ctrl &GM_SMI_CT_RD_VAL ) { *val =gma_read16 (hw, port,GM_SMI_DATA );return 0 ; } -udelay (1 ); +udelay (10 ); } +dev_warn (&hw->pdev->dev,"%s: phy read timeout\n" , hw->dev[port]->name);return -ETIMEDOUT ; +io_error: +dev_err (&hw->pdev->dev,"%s: phy I/O error\n" , hw->dev[port]->name); +return -EIO ; } -static u16 gm_phy_read (struct sky2_hw *hw,unsigned port,u16 reg) +static inline u16 gm_phy_read (struct sky2_hw *hw,unsigned port,u16 reg) {u16 v; - -if (__gm_phy_read (hw, port, reg, &v) !=0 ) - printk(KERN_WARNING PFX "%s: phy read timeout\n", hw->dev[port]->name); +__gm_phy_read (hw, port, reg, &v);return v; }
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 4/7 sky2: dont change LED after autoneg
In reply to Stephen HemmingerDon't need to change LED's after auto negotiation, the chip sets them correctly.
drivers/net/sky2.c +0 -23
@@ -1820,29 +1820,6 @@ static void sky2_link_up(struct sky2_porsky2_write8 (hw,SK_REG (port,LNK_LED_REG ),LINKLED_ON |LINKLED_BLINK_OFF |LINKLED_LINKSYNC_OFF ); -if (hw->flags &SKY2_HW_NEWER_PHY ) { -u16 pg =gm_phy_read (hw, port,PHY_MARV_EXT_ADR ); -u16 led =PHY_M_LEDC_LOS_CTRL (1 );/* link active */ - -switch (sky2->speed) { -case SPEED_10 : - led |=PHY_M_LEDC_INIT_CTRL (7 ); -break ; - -case SPEED_100 : - led |=PHY_M_LEDC_STA1_CTRL (7 ); -break ; - -case SPEED_1000 : - led |=PHY_M_LEDC_STA0_CTRL (7 ); -break ; - } - -gm_phy_write (hw, port,PHY_MARV_EXT_ADR ,3 ); -gm_phy_write (hw, port,PHY_MARV_PHY_CTRL , led); -gm_phy_write (hw, port,PHY_MARV_EXT_ADR , pg); - } -if (netif_msg_link (sky2)) printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex, flow control %s\n",
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 5/7 sky2: remove unneeded mask update
In reply to Stephen HemmingerThe IRQ's is already masked on shutdown, and on startup avoid touching PHY until after phy_init().
drivers/net/sky2.c +0 -2
@@ -288,8 +288,6 @@ static void sky2_gmac_reset(struct sky2_/* disable all GMAC IRQ's */ sky2_write8 (hw,SK_REG (port,GMAC_IRQ_MSK ),0 ); -/* disable PHY IRQs */ -gm_phy_write (hw, port,PHY_MARV_INT_MASK ,0 );gma_write16 (hw, port,GM_MC_ADDR_H1 ,0 );/* clear MC hash */ gma_write16 (hw, port,GM_MC_ADDR_H2 ,0 );
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 6/7 sky2: handle advanced error recovery config issues
In reply to Stephen HemmingerThe PCI AER support may not work for a couple of reasons. It may not be configured into the kernel or there may be a BIOS bug that prevents MMCONFIG from working. If MMCONFIG doesn't work then the PCI registers that control AER will not be accessible via pci_read_config functions; luckly there is another window to access PCI space in the device, so use that.
drivers/net/sky2.c +28 -6
@@ -2435,13 +2435,26 @@ static void sky2_hw_intr(struct sky2_hwif (status &Y2_IS_PCI_EXP ) {/* PCI-Express uncorrectable Error occurred */ -int pos =pci_find_aer_capability (hw->pdev); +int aer =pci_find_aer_capability (hw->pdev);u32 err; -pci_read_config_dword (pdev, pos +PCI_ERR_UNCOR_STATUS , &err); +if (aer) { +pci_read_config_dword (pdev, aer +PCI_ERR_UNCOR_STATUS , + &err); +pci_cleanup_aer_uncorrect_error_status (pdev); + }else { +/* Either AER not configured, or not working +* because of bad MMCONFIG, so just do recover +* manually. +*/ + err =sky2_read32 (hw,Y2_CFG_AER +PCI_ERR_UNCOR_STATUS ); +sky2_write32 (hw,Y2_CFG_AER +PCI_ERR_UNCOR_STATUS , +0xfffffffful ); + } +if (net_ratelimit ())dev_err (&pdev->dev,"PCI Express error (0x%x)\n" , err); -pci_cleanup_aer_uncorrect_error_status (pdev); + }if (status &Y2_HWE_L1_MASK )
@@ -2799,9 +2812,18 @@ static void sky2_reset(struct sky2_hw *h cap =pci_find_capability (pdev,PCI_CAP_ID_EXP );if (cap) { -/* Check for advanced error reporting */ -pci_cleanup_aer_uncorrect_error_status (pdev); -pci_cleanup_aer_correct_error_status (pdev); +if (pci_find_aer_capability (pdev)) { +/* Check for advanced error reporting */ +pci_cleanup_aer_uncorrect_error_status (pdev); +pci_cleanup_aer_correct_error_status (pdev); + }else { +dev_warn (&pdev->dev, +"PCI Express Advanced Error Reporting" +" not configured or MMCONFIG problem?\n" ); + +sky2_write32 (hw,Y2_CFG_AER +PCI_ERR_UNCOR_STATUS , +0xfffffffful ); + }/* If error bit is stuck on ignore it */ if (sky2_read32 (hw,B0_HWE_ISRC ) &Y2_IS_PCI_EXP )
drivers/net/sky2.h +2 -1
@@ -247,7 +247,8 @@ enum csr_regs {B3_PA_CTRL =0x01f0 ,B3_PA_TEST =0x01f2 , - Y2_CFG_SPC = 0x1c00, +Y2_CFG_SPC =0x1c00 ,/* PCI config space region */ + Y2_CFG_AER = 0x1d00, /* PCI Advanced Error Report region */ };/* B0_CTST 16 bit Control/Status register */
Signature · 1 line
Stephen Hemminger <[email protected]>
PATCH 7/7 sky2: version 1.20
In reply to Stephen HemmingerVersion update to 1.20
drivers/net/sky2.c +1 -1
@@ -52,7 +52,7 @@#include "sky2.h" #define DRV_NAME "sky2" -#define DRV_VERSION "1.19" +#define DRV_VERSION "1.20"#define PFX DRV_NAME " "/*
Signature · 1 line
Stephen Hemminger <[email protected]>