aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 992410376f63..deff38e715d6 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -143,7 +143,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs,
143static int wol_supported(const struct skge_hw *hw) 143static int wol_supported(const struct skge_hw *hw)
144{ 144{
145 return !((hw->chip_id == CHIP_ID_GENESIS || 145 return !((hw->chip_id == CHIP_ID_GENESIS ||
146 (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0))); 146 (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0)));
147} 147}
148 148
149static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 149static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -1774,7 +1774,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1774 1774
1775 /* WA code for COMA mode -- set PHY reset */ 1775 /* WA code for COMA mode -- set PHY reset */
1776 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1776 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1777 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1777 hw->chip_rev == CHIP_REV_YU_LITE_A3)
1778 skge_write32(hw, B2_GP_IO, 1778 skge_write32(hw, B2_GP_IO,
1779 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); 1779 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9));
1780 1780
@@ -1784,7 +1784,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1784 1784
1785 /* WA code for COMA mode -- clear PHY reset */ 1785 /* WA code for COMA mode -- clear PHY reset */
1786 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1786 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1787 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1787 hw->chip_rev == CHIP_REV_YU_LITE_A3)
1788 skge_write32(hw, B2_GP_IO, 1788 skge_write32(hw, B2_GP_IO,
1789 (skge_read32(hw, B2_GP_IO) | GP_DIR_9) 1789 (skge_read32(hw, B2_GP_IO) | GP_DIR_9)
1790 & ~GP_IO_9); 1790 & ~GP_IO_9);
@@ -1879,7 +1879,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1879 skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); 1879 skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK);
1880 reg = GMF_OPER_ON | GMF_RX_F_FL_ON; 1880 reg = GMF_OPER_ON | GMF_RX_F_FL_ON;
1881 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1881 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1882 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1882 hw->chip_rev == CHIP_REV_YU_LITE_A3)
1883 reg &= ~GMF_RX_F_FL_ON; 1883 reg &= ~GMF_RX_F_FL_ON;
1884 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); 1884 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
1885 skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); 1885 skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg);
@@ -1896,7 +1896,7 @@ static void yukon_stop(struct skge_port *skge)
1896 int port = skge->port; 1896 int port = skge->port;
1897 1897
1898 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1898 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1899 chip_rev(hw) == CHIP_REV_YU_LITE_A3) { 1899 hw->chip_rev == CHIP_REV_YU_LITE_A3) {
1900 skge_write32(hw, B2_GP_IO, 1900 skge_write32(hw, B2_GP_IO,
1901 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); 1901 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9);
1902 } 1902 }
@@ -2178,7 +2178,7 @@ static int skge_up(struct net_device *dev)
2178 yukon_mac_init(hw, port); 2178 yukon_mac_init(hw, port);
2179 2179
2180 /* Configure RAMbuffers */ 2180 /* Configure RAMbuffers */
2181 chunk = hw->ram_size / (isdualport(hw) ? 4 : 2); 2181 chunk = hw->ram_size / ((hw->ports + 1)*2);
2182 ram_addr = hw->ram_offset + 2 * chunk * port; 2182 ram_addr = hw->ram_offset + 2 * chunk * port;
2183 2183
2184 skge_ramset(hw, rxqaddr[port], ram_addr, chunk); 2184 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
@@ -2322,7 +2322,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2322 * does. Looks like hardware is wrong? 2322 * does. Looks like hardware is wrong?
2323 */ 2323 */
2324 if (ip->protocol == IPPROTO_UDP 2324 if (ip->protocol == IPPROTO_UDP
2325 && chip_rev(hw) == 0 && hw->chip_id == CHIP_ID_YUKON) 2325 && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON)
2326 control = BMU_TCP_CHECK; 2326 control = BMU_TCP_CHECK;
2327 else 2327 else
2328 control = BMU_UDP_CHECK; 2328 control = BMU_UDP_CHECK;
@@ -2684,7 +2684,7 @@ static void skge_mac_parity(struct skge_hw *hw, int port)
2684 else 2684 else
2685 /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */ 2685 /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */
2686 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), 2686 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T),
2687 (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0) 2687 (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0)
2688 ? GMF_CLI_TX_FC : GMF_CLI_TX_PE); 2688 ? GMF_CLI_TX_FC : GMF_CLI_TX_PE);
2689} 2689}
2690 2690
@@ -2919,8 +2919,8 @@ static const char *skge_board_name(const struct skge_hw *hw)
2919static int skge_reset(struct skge_hw *hw) 2919static int skge_reset(struct skge_hw *hw)
2920{ 2920{
2921 u16 ctst; 2921 u16 ctst;
2922 u8 t8; 2922 u8 t8, mac_cfg;
2923 int i, ports; 2923 int i;
2924 2924
2925 ctst = skge_read16(hw, B0_CTST); 2925 ctst = skge_read16(hw, B0_CTST);
2926 2926
@@ -2975,8 +2975,9 @@ static int skge_reset(struct skge_hw *hw)
2975 return -EOPNOTSUPP; 2975 return -EOPNOTSUPP;
2976 } 2976 }
2977 2977
2978 hw->mac_cfg = skge_read8(hw, B2_MAC_CFG); 2978 mac_cfg = skge_read8(hw, B2_MAC_CFG);
2979 ports = isdualport(hw) ? 2 : 1; 2979 hw->ports = (mac_cfg & CFG_SNG_MAC) ? 1 : 2;
2980 hw->chip_rev = (mac_cfg & CFG_CHIP_R_MSK) >> 4;
2980 2981
2981 /* read the adapters RAM size */ 2982 /* read the adapters RAM size */
2982 t8 = skge_read8(hw, B2_E_0); 2983 t8 = skge_read8(hw, B2_E_0);
@@ -2999,7 +3000,7 @@ static int skge_reset(struct skge_hw *hw)
2999 /* switch power to VCC (WA for VAUX problem) */ 3000 /* switch power to VCC (WA for VAUX problem) */
3000 skge_write8(hw, B0_POWER_CTRL, 3001 skge_write8(hw, B0_POWER_CTRL,
3001 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); 3002 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON);
3002 for (i = 0; i < ports; i++) { 3003 for (i = 0; i < hw->ports; i++) {
3003 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); 3004 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
3004 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); 3005 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR);
3005 } 3006 }
@@ -3011,7 +3012,7 @@ static int skge_reset(struct skge_hw *hw)
3011 skge_write8(hw, B0_LED, LED_STAT_ON); 3012 skge_write8(hw, B0_LED, LED_STAT_ON);
3012 3013
3013 /* enable the Tx Arbiters */ 3014 /* enable the Tx Arbiters */
3014 for (i = 0; i < ports; i++) 3015 for (i = 0; i < hw->ports; i++)
3015 skge_write8(hw, SK_REG(i, TXA_CTRL), TXA_ENA_ARB); 3016 skge_write8(hw, SK_REG(i, TXA_CTRL), TXA_ENA_ARB);
3016 3017
3017 /* Initialize ram interface */ 3018 /* Initialize ram interface */
@@ -3040,7 +3041,7 @@ static int skge_reset(struct skge_hw *hw)
3040 skge_write32(hw, B2_IRQM_CTRL, TIM_START); 3041 skge_write32(hw, B2_IRQM_CTRL, TIM_START);
3041 3042
3042 hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1; 3043 hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1;
3043 if (isdualport(hw)) 3044 if (hw->ports > 1)
3044 hw->intr_mask |= IS_PORT_2; 3045 hw->intr_mask |= IS_PORT_2;
3045 skge_write32(hw, B0_IMSK, hw->intr_mask); 3046 skge_write32(hw, B0_IMSK, hw->intr_mask);
3046 3047
@@ -3048,7 +3049,7 @@ static int skge_reset(struct skge_hw *hw)
3048 skge_write8(hw, GMAC_IRQ_MSK, 0); 3049 skge_write8(hw, GMAC_IRQ_MSK, 0);
3049 3050
3050 spin_lock_bh(&hw->phy_lock); 3051 spin_lock_bh(&hw->phy_lock);
3051 for (i = 0; i < ports; i++) { 3052 for (i = 0; i < hw->ports; i++) {
3052 if (hw->chip_id == CHIP_ID_GENESIS) 3053 if (hw->chip_id == CHIP_ID_GENESIS)
3053 genesis_reset(hw, i); 3054 genesis_reset(hw, i);
3054 else 3055 else
@@ -3060,7 +3061,8 @@ static int skge_reset(struct skge_hw *hw)
3060} 3061}
3061 3062
3062/* Initialize network device */ 3063/* Initialize network device */
3063static struct net_device *skge_devinit(struct skge_hw *hw, int port) 3064static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3065 int highmem)
3064{ 3066{
3065 struct skge_port *skge; 3067 struct skge_port *skge;
3066 struct net_device *dev = alloc_etherdev(sizeof(*skge)); 3068 struct net_device *dev = alloc_etherdev(sizeof(*skge));
@@ -3093,6 +3095,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port)
3093#endif 3095#endif
3094 dev->irq = hw->pdev->irq; 3096 dev->irq = hw->pdev->irq;
3095 dev->features = NETIF_F_LLTX; 3097 dev->features = NETIF_F_LLTX;
3098 if (highmem)
3099 dev->features |= NETIF_F_HIGHDMA;
3096 3100
3097 skge = netdev_priv(dev); 3101 skge = netdev_priv(dev);
3098 skge->netdev = dev; 3102 skge->netdev = dev;
@@ -3221,14 +3225,11 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3221 3225
3222 printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", 3226 printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n",
3223 pci_resource_start(pdev, 0), pdev->irq, 3227 pci_resource_start(pdev, 0), pdev->irq,
3224 skge_board_name(hw), chip_rev(hw)); 3228 skge_board_name(hw), hw->chip_rev);
3225 3229
3226 if ((dev = skge_devinit(hw, 0)) == NULL) 3230 if ((dev = skge_devinit(hw, 0, using_dac)) == NULL)
3227 goto err_out_led_off; 3231 goto err_out_led_off;
3228 3232
3229 if (using_dac)
3230 dev->features |= NETIF_F_HIGHDMA;
3231
3232 if ((err = register_netdev(dev))) { 3233 if ((err = register_netdev(dev))) {
3233 printk(KERN_ERR PFX "%s: cannot register net device\n", 3234 printk(KERN_ERR PFX "%s: cannot register net device\n",
3234 pci_name(pdev)); 3235 pci_name(pdev));
@@ -3237,10 +3238,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3237 3238
3238 skge_show_addr(dev); 3239 skge_show_addr(dev);
3239 3240
3240 if (isdualport(hw) && (dev1 = skge_devinit(hw, 1))) { 3241 if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) {
3241 if (using_dac)
3242 dev1->features |= NETIF_F_HIGHDMA;
3243
3244 if (register_netdev(dev1) == 0) 3242 if (register_netdev(dev1) == 0)
3245 skge_show_addr(dev1); 3243 skge_show_addr(dev1);
3246 else { 3244 else {