aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 67ecd66f26d6..16616f5440d0 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -10,8 +10,7 @@
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 13 * the Free Software Foundation; either version 2 of the License.
14 * (at your option) any later version.
15 * 14 *
16 * This program is distributed in the hope that it will be useful, 15 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -699,16 +698,10 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
699 698
700} 699}
701 700
702/* Assign Ram Buffer allocation. 701/* Assign Ram Buffer allocation in units of 64bit (8 bytes) */
703 * start and end are in units of 4k bytes 702static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
704 * ram registers are in units of 64bit words
705 */
706static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
707{ 703{
708 u32 start, end; 704 pr_debug(PFX "q %d %#x %#x\n", q, start, end);
709
710 start = startk * 4096/8;
711 end = (endk * 4096/8) - 1;
712 705
713 sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); 706 sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
714 sky2_write32(hw, RB_ADDR(q, RB_START), start); 707 sky2_write32(hw, RB_ADDR(q, RB_START), start);
@@ -717,7 +710,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
717 sky2_write32(hw, RB_ADDR(q, RB_RP), start); 710 sky2_write32(hw, RB_ADDR(q, RB_RP), start);
718 711
719 if (q == Q_R1 || q == Q_R2) { 712 if (q == Q_R1 || q == Q_R2) {
720 u32 space = (endk - startk) * 4096/8; 713 u32 space = end - start + 1;
721 u32 tp = space - space/4; 714 u32 tp = space - space/4;
722 715
723 /* On receive queue's set the thresholds 716 /* On receive queue's set the thresholds
@@ -1199,19 +1192,16 @@ static int sky2_up(struct net_device *dev)
1199 1192
1200 sky2_mac_init(hw, port); 1193 sky2_mac_init(hw, port);
1201 1194
1202 /* Determine available ram buffer space (in 4K blocks). 1195 /* Determine available ram buffer space in qwords. */
1203 * Note: not sure about the FE setting below yet 1196 ramsize = sky2_read8(hw, B2_E_0) * 4096/8;
1204 */
1205 if (hw->chip_id == CHIP_ID_YUKON_FE)
1206 ramsize = 4;
1207 else
1208 ramsize = sky2_read8(hw, B2_E_0);
1209 1197
1210 /* Give transmitter one third (rounded up) */ 1198 if (ramsize > 6*1024/8)
1211 rxspace = ramsize - (ramsize + 2) / 3; 1199 rxspace = ramsize - (ramsize + 2) / 3;
1200 else
1201 rxspace = ramsize / 2;
1212 1202
1213 sky2_ramset(hw, rxqaddr[port], 0, rxspace); 1203 sky2_ramset(hw, rxqaddr[port], 0, rxspace-1);
1214 sky2_ramset(hw, txqaddr[port], rxspace, ramsize); 1204 sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1);
1215 1205
1216 /* Make sure SyncQ is disabled */ 1206 /* Make sure SyncQ is disabled */
1217 sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL), 1207 sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
@@ -3248,7 +3238,11 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3248 dev->poll = sky2_poll; 3238 dev->poll = sky2_poll;
3249 dev->weight = NAPI_WEIGHT; 3239 dev->weight = NAPI_WEIGHT;
3250#ifdef CONFIG_NET_POLL_CONTROLLER 3240#ifdef CONFIG_NET_POLL_CONTROLLER
3251 dev->poll_controller = sky2_netpoll; 3241 /* Network console (only works on port 0)
3242 * because netpoll makes assumptions about NAPI
3243 */
3244 if (port == 0)
3245 dev->poll_controller = sky2_netpoll;
3252#endif 3246#endif
3253 3247
3254 sky2 = netdev_priv(dev); 3248 sky2 = netdev_priv(dev);