aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bnx2.c50
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/niu.c9
-rw-r--r--drivers/net/niu.h2
-rw-r--r--drivers/net/tg3.c2
-rw-r--r--drivers/net/veth.c53
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h2
-rw-r--r--drivers/net/wireless/ath5k/base.c20
-rw-r--r--drivers/net/wireless/ath5k/hw.c8
-rw-r--r--drivers/net/wireless/p54usb.c2
-rw-r--r--drivers/net/wireless/rtl8180_dev.c4
-rw-r--r--drivers/net/wireless/rtl8187_dev.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c12
-rw-r--r--drivers/ssb/Kconfig6
-rw-r--r--drivers/ssb/Makefile1
-rw-r--r--drivers/ssb/driver_chipcommon.c65
-rw-r--r--drivers/ssb/driver_extif.c25
-rw-r--r--drivers/ssb/driver_pcicore.c45
-rw-r--r--drivers/ssb/embedded.c132
-rw-r--r--drivers/ssb/main.c4
20 files changed, 371 insertions, 76 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 471c7f3e8a4a..15853be4680a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.7.3" 59#define DRV_MODULE_VERSION "1.7.4"
60#define DRV_MODULE_RELDATE "January 29, 2008" 60#define DRV_MODULE_RELDATE "February 18, 2008"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -1273,14 +1273,20 @@ bnx2_set_link(struct bnx2 *bp)
1273 1273
1274 if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) && 1274 if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) &&
1275 (CHIP_NUM(bp) == CHIP_NUM_5706)) { 1275 (CHIP_NUM(bp) == CHIP_NUM_5706)) {
1276 u32 val; 1276 u32 val, an_dbg;
1277 1277
1278 if (bp->phy_flags & BNX2_PHY_FLAG_FORCED_DOWN) { 1278 if (bp->phy_flags & BNX2_PHY_FLAG_FORCED_DOWN) {
1279 bnx2_5706s_force_link_dn(bp, 0); 1279 bnx2_5706s_force_link_dn(bp, 0);
1280 bp->phy_flags &= ~BNX2_PHY_FLAG_FORCED_DOWN; 1280 bp->phy_flags &= ~BNX2_PHY_FLAG_FORCED_DOWN;
1281 } 1281 }
1282 val = REG_RD(bp, BNX2_EMAC_STATUS); 1282 val = REG_RD(bp, BNX2_EMAC_STATUS);
1283 if (val & BNX2_EMAC_STATUS_LINK) 1283
1284 bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_AN_DBG);
1285 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
1286 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
1287
1288 if ((val & BNX2_EMAC_STATUS_LINK) &&
1289 !(an_dbg & MISC_SHDW_AN_DBG_NOSYNC))
1284 bmsr |= BMSR_LSTATUS; 1290 bmsr |= BMSR_LSTATUS;
1285 else 1291 else
1286 bmsr &= ~BMSR_LSTATUS; 1292 bmsr &= ~BMSR_LSTATUS;
@@ -5356,11 +5362,15 @@ bnx2_test_intr(struct bnx2 *bp)
5356 return -ENODEV; 5362 return -ENODEV;
5357} 5363}
5358 5364
5365/* Determining link for parallel detection. */
5359static int 5366static int
5360bnx2_5706_serdes_has_link(struct bnx2 *bp) 5367bnx2_5706_serdes_has_link(struct bnx2 *bp)
5361{ 5368{
5362 u32 mode_ctl, an_dbg, exp; 5369 u32 mode_ctl, an_dbg, exp;
5363 5370
5371 if (bp->phy_flags & BNX2_PHY_FLAG_NO_PARALLEL)
5372 return 0;
5373
5364 bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_MODE_CTL); 5374 bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_MODE_CTL);
5365 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &mode_ctl); 5375 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &mode_ctl);
5366 5376
@@ -5390,13 +5400,6 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
5390 int check_link = 1; 5400 int check_link = 1;
5391 5401
5392 spin_lock(&bp->phy_lock); 5402 spin_lock(&bp->phy_lock);
5393 if (bp->phy_flags & BNX2_PHY_FLAG_FORCED_DOWN) {
5394 bnx2_5706s_force_link_dn(bp, 0);
5395 bp->phy_flags &= ~BNX2_PHY_FLAG_FORCED_DOWN;
5396 spin_unlock(&bp->phy_lock);
5397 return;
5398 }
5399
5400 if (bp->serdes_an_pending) { 5403 if (bp->serdes_an_pending) {
5401 bp->serdes_an_pending--; 5404 bp->serdes_an_pending--;
5402 check_link = 0; 5405 check_link = 0;
@@ -5420,7 +5423,6 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
5420 (bp->phy_flags & BNX2_PHY_FLAG_PARALLEL_DETECT)) { 5423 (bp->phy_flags & BNX2_PHY_FLAG_PARALLEL_DETECT)) {
5421 u32 phy2; 5424 u32 phy2;
5422 5425
5423 check_link = 0;
5424 bnx2_write_phy(bp, 0x17, 0x0f01); 5426 bnx2_write_phy(bp, 0x17, 0x0f01);
5425 bnx2_read_phy(bp, 0x15, &phy2); 5427 bnx2_read_phy(bp, 0x15, &phy2);
5426 if (phy2 & 0x20) { 5428 if (phy2 & 0x20) {
@@ -5435,17 +5437,21 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
5435 } else 5437 } else
5436 bp->current_interval = bp->timer_interval; 5438 bp->current_interval = bp->timer_interval;
5437 5439
5438 if (bp->link_up && (bp->autoneg & AUTONEG_SPEED) && check_link) { 5440 if (check_link) {
5439 u32 val; 5441 u32 val;
5440 5442
5441 bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_AN_DBG); 5443 bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_AN_DBG);
5442 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &val); 5444 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &val);
5443 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &val); 5445 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &val);
5444 5446
5445 if (val & MISC_SHDW_AN_DBG_NOSYNC) { 5447 if (bp->link_up && (val & MISC_SHDW_AN_DBG_NOSYNC)) {
5446 bnx2_5706s_force_link_dn(bp, 1); 5448 if (!(bp->phy_flags & BNX2_PHY_FLAG_FORCED_DOWN)) {
5447 bp->phy_flags |= BNX2_PHY_FLAG_FORCED_DOWN; 5449 bnx2_5706s_force_link_dn(bp, 1);
5448 } 5450 bp->phy_flags |= BNX2_PHY_FLAG_FORCED_DOWN;
5451 } else
5452 bnx2_set_link(bp);
5453 } else if (!bp->link_up && !(val & MISC_SHDW_AN_DBG_NOSYNC))
5454 bnx2_set_link(bp);
5449 } 5455 }
5450 spin_unlock(&bp->phy_lock); 5456 spin_unlock(&bp->phy_lock);
5451} 5457}
@@ -7326,7 +7332,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7326 bp->flags |= BNX2_FLAG_NO_WOL; 7332 bp->flags |= BNX2_FLAG_NO_WOL;
7327 bp->wol = 0; 7333 bp->wol = 0;
7328 } 7334 }
7329 if (CHIP_NUM(bp) != CHIP_NUM_5706) { 7335 if (CHIP_NUM(bp) == CHIP_NUM_5706) {
7336 /* Don't do parallel detect on this board because of
7337 * some board problems. The link will not go down
7338 * if we do parallel detect.
7339 */
7340 if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
7341 pdev->subsystem_device == 0x310c)
7342 bp->phy_flags |= BNX2_PHY_FLAG_NO_PARALLEL;
7343 } else {
7330 bp->phy_addr = 2; 7344 bp->phy_addr = 2;
7331 if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G) 7345 if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G)
7332 bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE; 7346 bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 3aa0364942e2..1eaf5bb3d9c2 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6673,6 +6673,7 @@ struct bnx2 {
6673#define BNX2_PHY_FLAG_DIS_EARLY_DAC 0x00000400 6673#define BNX2_PHY_FLAG_DIS_EARLY_DAC 0x00000400
6674#define BNX2_PHY_FLAG_REMOTE_PHY_CAP 0x00000800 6674#define BNX2_PHY_FLAG_REMOTE_PHY_CAP 0x00000800
6675#define BNX2_PHY_FLAG_FORCED_DOWN 0x00001000 6675#define BNX2_PHY_FLAG_FORCED_DOWN 0x00001000
6676#define BNX2_PHY_FLAG_NO_PARALLEL 0x00002000
6676 6677
6677 u32 mii_bmcr; 6678 u32 mii_bmcr;
6678 u32 mii_bmsr; 6679 u32 mii_bmsr;
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index e98ce1e4965b..d11ba61baa4f 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -1616,12 +1616,13 @@ static int niu_enable_alt_mac(struct niu *np, int index, int on)
1616 if (index >= niu_num_alt_addr(np)) 1616 if (index >= niu_num_alt_addr(np))
1617 return -EINVAL; 1617 return -EINVAL;
1618 1618
1619 if (np->flags & NIU_FLAGS_XMAC) 1619 if (np->flags & NIU_FLAGS_XMAC) {
1620 reg = XMAC_ADDR_CMPEN; 1620 reg = XMAC_ADDR_CMPEN;
1621 else 1621 mask = 1 << index;
1622 } else {
1622 reg = BMAC_ADDR_CMPEN; 1623 reg = BMAC_ADDR_CMPEN;
1623 1624 mask = 1 << (index + 1);
1624 mask = 1 << index; 1625 }
1625 1626
1626 val = nr64_mac(reg); 1627 val = nr64_mac(reg);
1627 if (on) 1628 if (on)
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 0e8626adc573..59dc05fcd371 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -499,7 +499,7 @@
499#define BMAC_ADDR2 0x00110UL 499#define BMAC_ADDR2 0x00110UL
500#define BMAC_ADDR2_ADDR2 0x000000000000ffffULL 500#define BMAC_ADDR2_ADDR2 0x000000000000ffffULL
501 501
502#define BMAC_NUM_ALT_ADDR 7 502#define BMAC_NUM_ALT_ADDR 6
503 503
504#define BMAC_ALT_ADDR0(NUM) (0x00118UL + (NUM)*0x18UL) 504#define BMAC_ALT_ADDR0(NUM) (0x00118UL + (NUM)*0x18UL)
505#define BMAC_ALT_ADDR0_ADDR0 0x000000000000ffffULL 505#define BMAC_ALT_ADDR0_ADDR0 0x000000000000ffffULL
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index db606b603884..26ffb67f1da2 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8781,7 +8781,7 @@ static int tg3_phys_id(struct net_device *dev, u32 data)
8781 return -EAGAIN; 8781 return -EAGAIN;
8782 8782
8783 if (data == 0) 8783 if (data == 0)
8784 data = 2; 8784 data = UINT_MAX / 2;
8785 8785
8786 for (i = 0; i < (data * 2); i++) { 8786 for (i = 0; i < (data * 2); i++) {
8787 if ((i % 2) == 0) 8787 if ((i % 2) == 0)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 3f67a29593bc..e2ad98bee6e7 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -244,18 +244,6 @@ static int veth_open(struct net_device *dev)
244 return 0; 244 return 0;
245} 245}
246 246
247static int veth_close(struct net_device *dev)
248{
249 struct veth_priv *priv;
250
251 if (netif_carrier_ok(dev)) {
252 priv = netdev_priv(dev);
253 netif_carrier_off(dev);
254 netif_carrier_off(priv->peer);
255 }
256 return 0;
257}
258
259static int veth_dev_init(struct net_device *dev) 247static int veth_dev_init(struct net_device *dev)
260{ 248{
261 struct veth_net_stats *stats; 249 struct veth_net_stats *stats;
@@ -286,13 +274,50 @@ static void veth_setup(struct net_device *dev)
286 dev->hard_start_xmit = veth_xmit; 274 dev->hard_start_xmit = veth_xmit;
287 dev->get_stats = veth_get_stats; 275 dev->get_stats = veth_get_stats;
288 dev->open = veth_open; 276 dev->open = veth_open;
289 dev->stop = veth_close;
290 dev->ethtool_ops = &veth_ethtool_ops; 277 dev->ethtool_ops = &veth_ethtool_ops;
291 dev->features |= NETIF_F_LLTX; 278 dev->features |= NETIF_F_LLTX;
292 dev->init = veth_dev_init; 279 dev->init = veth_dev_init;
293 dev->destructor = veth_dev_free; 280 dev->destructor = veth_dev_free;
294} 281}
295 282
283static void veth_change_state(struct net_device *dev)
284{
285 struct net_device *peer;
286 struct veth_priv *priv;
287
288 priv = netdev_priv(dev);
289 peer = priv->peer;
290
291 if (netif_carrier_ok(peer)) {
292 if (!netif_carrier_ok(dev))
293 netif_carrier_on(dev);
294 } else {
295 if (netif_carrier_ok(dev))
296 netif_carrier_off(dev);
297 }
298}
299
300static int veth_device_event(struct notifier_block *unused,
301 unsigned long event, void *ptr)
302{
303 struct net_device *dev = ptr;
304
305 if (dev->open != veth_open)
306 goto out;
307
308 switch (event) {
309 case NETDEV_CHANGE:
310 veth_change_state(dev);
311 break;
312 }
313out:
314 return NOTIFY_DONE;
315}
316
317static struct notifier_block veth_notifier_block __read_mostly = {
318 .notifier_call = veth_device_event,
319};
320
296/* 321/*
297 * netlink interface 322 * netlink interface
298 */ 323 */
@@ -454,12 +479,14 @@ static struct rtnl_link_ops veth_link_ops = {
454 479
455static __init int veth_init(void) 480static __init int veth_init(void)
456{ 481{
482 register_netdevice_notifier(&veth_notifier_block);
457 return rtnl_link_register(&veth_link_ops); 483 return rtnl_link_register(&veth_link_ops);
458} 484}
459 485
460static __exit void veth_exit(void) 486static __exit void veth_exit(void)
461{ 487{
462 rtnl_link_unregister(&veth_link_ops); 488 rtnl_link_unregister(&veth_link_ops);
489 unregister_netdevice_notifier(&veth_notifier_block);
463} 490}
464 491
465module_init(veth_init); 492module_init(veth_init);
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index c79066b38d3b..69dea3392612 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -1035,7 +1035,7 @@ struct ath5k_hw {
1035 unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int, 1035 unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int,
1036 unsigned int, unsigned int, unsigned int, unsigned int, 1036 unsigned int, unsigned int, unsigned int, unsigned int,
1037 unsigned int, unsigned int, unsigned int); 1037 unsigned int, unsigned int, unsigned int);
1038 bool (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *, 1038 int (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1039 unsigned int, unsigned int, unsigned int, unsigned int, 1039 unsigned int, unsigned int, unsigned int, unsigned int,
1040 unsigned int, unsigned int); 1040 unsigned int, unsigned int);
1041 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *); 1041 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *);
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index dfdaec020739..bef967ce34a6 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -668,7 +668,10 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
668 * return false w/o doing anything. MAC's that do 668 * return false w/o doing anything. MAC's that do
669 * support it will return true w/o doing anything. 669 * support it will return true w/o doing anything.
670 */ 670 */
671 if (ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0)) 671 ret = ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0);
672 if (ret < 0)
673 goto err;
674 if (ret > 0)
672 __set_bit(ATH_STAT_MRRETRY, sc->status); 675 __set_bit(ATH_STAT_MRRETRY, sc->status);
673 676
674 /* 677 /*
@@ -1715,6 +1718,7 @@ ath5k_tasklet_rx(unsigned long data)
1715 break; 1718 break;
1716 else if (unlikely(ret)) { 1719 else if (unlikely(ret)) {
1717 ATH5K_ERR(sc, "error in processing rx descriptor\n"); 1720 ATH5K_ERR(sc, "error in processing rx descriptor\n");
1721 spin_unlock(&sc->rxbuflock);
1718 return; 1722 return;
1719 } 1723 }
1720 1724
@@ -2126,8 +2130,9 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
2126 "updated timers based on beacon TSF\n"); 2130 "updated timers based on beacon TSF\n");
2127 2131
2128 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, 2132 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON,
2129 "bc_tsf %llx hw_tsf %llx bc_tu %u hw_tu %u nexttbtt %u\n", 2133 "bc_tsf %llx hw_tsf %llx bc_tu %u hw_tu %u nexttbtt %u\n",
2130 bc_tsf, hw_tsf, bc_tu, hw_tu, nexttbtt); 2134 (unsigned long long) bc_tsf,
2135 (unsigned long long) hw_tsf, bc_tu, hw_tu, nexttbtt);
2131 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "intval %u %s %s\n", 2136 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "intval %u %s %s\n",
2132 intval & AR5K_BEACON_PERIOD, 2137 intval & AR5K_BEACON_PERIOD,
2133 intval & AR5K_BEACON_ENA ? "AR5K_BEACON_ENA" : "", 2138 intval & AR5K_BEACON_ENA ? "AR5K_BEACON_ENA" : "",
@@ -2385,10 +2390,11 @@ ath5k_intr(int irq, void *dev_id)
2385 u64 tsf = ath5k_hw_get_tsf64(ah); 2390 u64 tsf = ath5k_hw_get_tsf64(ah);
2386 sc->nexttbtt += sc->bintval; 2391 sc->nexttbtt += sc->bintval;
2387 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, 2392 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
2388 "SWBA nexttbtt: %x hw_tu: %x " 2393 "SWBA nexttbtt: %x hw_tu: %x "
2389 "TSF: %llx\n", 2394 "TSF: %llx\n",
2390 sc->nexttbtt, 2395 sc->nexttbtt,
2391 TSF_TO_TU(tsf), tsf); 2396 TSF_TO_TU(tsf),
2397 (unsigned long long) tsf);
2392 } else { 2398 } else {
2393 ath5k_beacon_send(sc); 2399 ath5k_beacon_send(sc);
2394 } 2400 }
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 1ab57aa6e4dc..c2de2d958e8e 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -45,7 +45,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
45 unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int, 45 unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int,
46 unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, 46 unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
47 unsigned int, unsigned int); 47 unsigned int, unsigned int);
48static bool ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *, struct ath5k_desc *, 48static int ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *, struct ath5k_desc *,
49 unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, 49 unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
50 unsigned int); 50 unsigned int);
51static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *, struct ath5k_desc *); 51static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *, struct ath5k_desc *);
@@ -3743,7 +3743,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3743/* 3743/*
3744 * Initialize a 4-word multirate tx descriptor on 5212 3744 * Initialize a 4-word multirate tx descriptor on 5212
3745 */ 3745 */
3746static bool 3746static int
3747ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, 3747ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3748 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, u_int tx_tries2, 3748 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, u_int tx_tries2,
3749 unsigned int tx_rate3, u_int tx_tries3) 3749 unsigned int tx_rate3, u_int tx_tries3)
@@ -3783,10 +3783,10 @@ ath5k_hw_setup_xr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3783 3783
3784#undef _XTX_TRIES 3784#undef _XTX_TRIES
3785 3785
3786 return true; 3786 return 1;
3787 } 3787 }
3788 3788
3789 return false; 3789 return 0;
3790} 3790}
3791 3791
3792/* 3792/*
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index 60d286eb0b8b..e7d4aee8799e 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -35,6 +35,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
35 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ 35 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
36 {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */ 36 {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */
37 {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */ 37 {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */
38 {USB_DEVICE(0x083a, 0x5501)}, /* Phillips CPWUA054 */
38 {USB_DEVICE(0x0846, 0x4200)}, /* Netgear WG121 */ 39 {USB_DEVICE(0x0846, 0x4200)}, /* Netgear WG121 */
39 {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ 40 {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */
40 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ 41 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */
@@ -62,6 +63,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
62 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ 63 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */
63 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ 64 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */
64 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 65 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
66 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */
65 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 67 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
66 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 68 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
67 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 69 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index 27ebd689aa21..5e9a8ace0d81 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -135,13 +135,15 @@ static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
135 while (skb_queue_len(&ring->queue)) { 135 while (skb_queue_len(&ring->queue)) {
136 struct rtl8180_tx_desc *entry = &ring->desc[ring->idx]; 136 struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
137 struct sk_buff *skb; 137 struct sk_buff *skb;
138 struct ieee80211_tx_status status = { {0} }; 138 struct ieee80211_tx_status status;
139 struct ieee80211_tx_control *control; 139 struct ieee80211_tx_control *control;
140 u32 flags = le32_to_cpu(entry->flags); 140 u32 flags = le32_to_cpu(entry->flags);
141 141
142 if (flags & RTL8180_TX_DESC_FLAG_OWN) 142 if (flags & RTL8180_TX_DESC_FLAG_OWN)
143 return; 143 return;
144 144
145 memset(&status, 0, sizeof(status));
146
145 ring->idx = (ring->idx + 1) % ring->entries; 147 ring->idx = (ring->idx + 1) % ring->entries;
146 skb = __skb_dequeue(&ring->queue); 148 skb = __skb_dequeue(&ring->queue);
147 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf), 149 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 0d71716d750d..f44505994a0e 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -113,10 +113,12 @@ void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
113 113
114static void rtl8187_tx_cb(struct urb *urb) 114static void rtl8187_tx_cb(struct urb *urb)
115{ 115{
116 struct ieee80211_tx_status status = { {0} }; 116 struct ieee80211_tx_status status;
117 struct sk_buff *skb = (struct sk_buff *)urb->context; 117 struct sk_buff *skb = (struct sk_buff *)urb->context;
118 struct rtl8187_tx_info *info = (struct rtl8187_tx_info *)skb->cb; 118 struct rtl8187_tx_info *info = (struct rtl8187_tx_info *)skb->cb;
119 119
120 memset(&status, 0, sizeof(status));
121
120 usb_free_urb(info->urb); 122 usb_free_urb(info->urb);
121 if (info->control) 123 if (info->control)
122 memcpy(&status.control, info->control, sizeof(status.control)); 124 memcpy(&status.control, info->control, sizeof(status.control));
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 49127e4b42c2..76ef2d83919d 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -360,11 +360,14 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw)
360{ 360{
361 struct sk_buff_head *q = &zd_hw_mac(hw)->ack_wait_queue; 361 struct sk_buff_head *q = &zd_hw_mac(hw)->ack_wait_queue;
362 struct sk_buff *skb; 362 struct sk_buff *skb;
363 struct ieee80211_tx_status status = {{0}}; 363 struct ieee80211_tx_status status;
364 364
365 skb = skb_dequeue(q); 365 skb = skb_dequeue(q);
366 if (skb == NULL) 366 if (skb == NULL)
367 return; 367 return;
368
369 memset(&status, 0, sizeof(status));
370
368 tx_status(hw, skb, &status, 0); 371 tx_status(hw, skb, &status, 0);
369} 372}
370 373
@@ -389,7 +392,8 @@ void zd_mac_tx_to_dev(struct sk_buff *skb, int error)
389 if (unlikely(error || 392 if (unlikely(error ||
390 (cb->control->flags & IEEE80211_TXCTL_NO_ACK))) 393 (cb->control->flags & IEEE80211_TXCTL_NO_ACK)))
391 { 394 {
392 struct ieee80211_tx_status status = {{0}}; 395 struct ieee80211_tx_status status;
396 memset(&status, 0, sizeof(status));
393 tx_status(hw, skb, &status, !error); 397 tx_status(hw, skb, &status, !error);
394 } else { 398 } else {
395 struct sk_buff_head *q = 399 struct sk_buff_head *q =
@@ -603,7 +607,9 @@ static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr,
603 tx_hdr = (struct ieee80211_hdr *)skb->data; 607 tx_hdr = (struct ieee80211_hdr *)skb->data;
604 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1))) 608 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1)))
605 { 609 {
606 struct ieee80211_tx_status status = {{0}}; 610 struct ieee80211_tx_status status;
611
612 memset(&status, 0, sizeof(status));
607 status.flags = IEEE80211_TX_STATUS_ACK; 613 status.flags = IEEE80211_TX_STATUS_ACK;
608 status.ack_signal = stats->ssi; 614 status.ack_signal = stats->ssi;
609 __skb_unlink(skb, q); 615 __skb_unlink(skb, q);
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index d976660cb7f0..78fd33125e02 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -105,6 +105,12 @@ config SSB_DRIVER_MIPS
105 105
106 If unsure, say N 106 If unsure, say N
107 107
108# Assumption: We are on embedded, if we compile the MIPS core.
109config SSB_EMBEDDED
110 bool
111 depends on SSB_DRIVER_MIPS
112 default y
113
108config SSB_DRIVER_EXTIF 114config SSB_DRIVER_EXTIF
109 bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)" 115 bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)"
110 depends on SSB_DRIVER_MIPS && EXPERIMENTAL 116 depends on SSB_DRIVER_MIPS && EXPERIMENTAL
diff --git a/drivers/ssb/Makefile b/drivers/ssb/Makefile
index 7be397595805..e235144add7c 100644
--- a/drivers/ssb/Makefile
+++ b/drivers/ssb/Makefile
@@ -1,5 +1,6 @@
1# core 1# core
2ssb-y += main.o scan.o 2ssb-y += main.o scan.o
3ssb-$(CONFIG_SSB_EMBEDDED) += embedded.o
3 4
4# host support 5# host support
5ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o 6ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o
diff --git a/drivers/ssb/driver_chipcommon.c b/drivers/ssb/driver_chipcommon.c
index 6fbf1c53b6f2..e586321a473a 100644
--- a/drivers/ssb/driver_chipcommon.c
+++ b/drivers/ssb/driver_chipcommon.c
@@ -39,12 +39,14 @@ static inline void chipco_write32(struct ssb_chipcommon *cc,
39 ssb_write32(cc->dev, offset, value); 39 ssb_write32(cc->dev, offset, value);
40} 40}
41 41
42static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset, 42static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
43 u32 mask, u32 value) 43 u32 mask, u32 value)
44{ 44{
45 value &= mask; 45 value &= mask;
46 value |= chipco_read32(cc, offset) & ~mask; 46 value |= chipco_read32(cc, offset) & ~mask;
47 chipco_write32(cc, offset, value); 47 chipco_write32(cc, offset, value);
48
49 return value;
48} 50}
49 51
50void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, 52void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
@@ -356,14 +358,29 @@ u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask)
356 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask; 358 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
357} 359}
358 360
359void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value) 361u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
362{
363 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
364}
365
366u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
367{
368 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
369}
370
371u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
372{
373 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
374}
375
376u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
360{ 377{
361 chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value); 378 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
362} 379}
363 380
364void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value) 381u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value)
365{ 382{
366 chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value); 383 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
367} 384}
368 385
369#ifdef CONFIG_SSB_SERIAL 386#ifdef CONFIG_SSB_SERIAL
@@ -376,6 +393,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
376 unsigned int irq; 393 unsigned int irq;
377 u32 baud_base, div; 394 u32 baud_base, div;
378 u32 i, n; 395 u32 i, n;
396 unsigned int ccrev = cc->dev->id.revision;
379 397
380 plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT); 398 plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT);
381 irq = ssb_mips_irq(cc->dev); 399 irq = ssb_mips_irq(cc->dev);
@@ -387,14 +405,39 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
387 chipco_read32(cc, SSB_CHIPCO_CLOCK_M2)); 405 chipco_read32(cc, SSB_CHIPCO_CLOCK_M2));
388 div = 1; 406 div = 1;
389 } else { 407 } else {
390 if (cc->dev->id.revision >= 11) { 408 if (ccrev == 20) {
409 /* BCM5354 uses constant 25MHz clock */
410 baud_base = 25000000;
411 div = 48;
412 /* Set the override bit so we don't divide it */
413 chipco_write32(cc, SSB_CHIPCO_CORECTL,
414 chipco_read32(cc, SSB_CHIPCO_CORECTL)
415 | SSB_CHIPCO_CORECTL_UARTCLK0);
416 } else if ((ccrev >= 11) && (ccrev != 15)) {
391 /* Fixed ALP clock */ 417 /* Fixed ALP clock */
392 baud_base = 20000000; 418 baud_base = 20000000;
419 if (cc->capabilities & SSB_CHIPCO_CAP_PMU) {
420 /* FIXME: baud_base is different for devices with a PMU */
421 SSB_WARN_ON(1);
422 }
393 div = 1; 423 div = 1;
424 if (ccrev >= 21) {
425 /* Turn off UART clock before switching clocksource. */
426 chipco_write32(cc, SSB_CHIPCO_CORECTL,
427 chipco_read32(cc, SSB_CHIPCO_CORECTL)
428 & ~SSB_CHIPCO_CORECTL_UARTCLKEN);
429 }
394 /* Set the override bit so we don't divide it */ 430 /* Set the override bit so we don't divide it */
395 chipco_write32(cc, SSB_CHIPCO_CORECTL, 431 chipco_write32(cc, SSB_CHIPCO_CORECTL,
396 SSB_CHIPCO_CORECTL_UARTCLK0); 432 chipco_read32(cc, SSB_CHIPCO_CORECTL)
397 } else if (cc->dev->id.revision >= 3) { 433 | SSB_CHIPCO_CORECTL_UARTCLK0);
434 if (ccrev >= 21) {
435 /* Re-enable the UART clock. */
436 chipco_write32(cc, SSB_CHIPCO_CORECTL,
437 chipco_read32(cc, SSB_CHIPCO_CORECTL)
438 | SSB_CHIPCO_CORECTL_UARTCLKEN);
439 }
440 } else if (ccrev >= 3) {
398 /* Internal backplane clock */ 441 /* Internal backplane clock */
399 baud_base = ssb_clockspeed(bus); 442 baud_base = ssb_clockspeed(bus);
400 div = chipco_read32(cc, SSB_CHIPCO_CLKDIV) 443 div = chipco_read32(cc, SSB_CHIPCO_CLKDIV)
@@ -406,7 +449,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
406 } 449 }
407 450
408 /* Clock source depends on strapping if UartClkOverride is unset */ 451 /* Clock source depends on strapping if UartClkOverride is unset */
409 if ((cc->dev->id.revision > 0) && 452 if ((ccrev > 0) &&
410 !(chipco_read32(cc, SSB_CHIPCO_CORECTL) & SSB_CHIPCO_CORECTL_UARTCLK0)) { 453 !(chipco_read32(cc, SSB_CHIPCO_CORECTL) & SSB_CHIPCO_CORECTL_UARTCLK0)) {
411 if ((cc->capabilities & SSB_CHIPCO_CAP_UARTCLK) == 454 if ((cc->capabilities & SSB_CHIPCO_CAP_UARTCLK) ==
412 SSB_CHIPCO_CAP_UARTCLK_INT) { 455 SSB_CHIPCO_CAP_UARTCLK_INT) {
@@ -428,7 +471,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
428 cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE); 471 cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE);
429 uart_regs = cc_mmio + SSB_CHIPCO_UART0_DATA; 472 uart_regs = cc_mmio + SSB_CHIPCO_UART0_DATA;
430 /* Offset changed at after rev 0 */ 473 /* Offset changed at after rev 0 */
431 if (cc->dev->id.revision == 0) 474 if (ccrev == 0)
432 uart_regs += (i * 8); 475 uart_regs += (i * 8);
433 else 476 else
434 uart_regs += (i * 256); 477 uart_regs += (i * 256);
diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c
index fe55eb8b038a..c3e1d3e6d610 100644
--- a/drivers/ssb/driver_extif.c
+++ b/drivers/ssb/driver_extif.c
@@ -27,12 +27,14 @@ static inline void extif_write32(struct ssb_extif *extif, u16 offset, u32 value)
27 ssb_write32(extif->dev, offset, value); 27 ssb_write32(extif->dev, offset, value);
28} 28}
29 29
30static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset, 30static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
31 u32 mask, u32 value) 31 u32 mask, u32 value)
32{ 32{
33 value &= mask; 33 value &= mask;
34 value |= extif_read32(extif, offset) & ~mask; 34 value |= extif_read32(extif, offset) & ~mask;
35 extif_write32(extif, offset, value); 35 extif_write32(extif, offset, value);
36
37 return value;
36} 38}
37 39
38#ifdef CONFIG_SSB_SERIAL 40#ifdef CONFIG_SSB_SERIAL
@@ -110,20 +112,35 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
110 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB); 112 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
111} 113}
112 114
115void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
116 u32 ticks)
117{
118 extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
119}
120
113u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) 121u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
114{ 122{
115 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask; 123 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
116} 124}
117 125
118void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value) 126u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
119{ 127{
120 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0), 128 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
121 mask, value); 129 mask, value);
122} 130}
123 131
124void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value) 132u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
125{ 133{
126 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0), 134 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
127 mask, value); 135 mask, value);
128} 136}
129 137
138u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
139{
140 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
141}
142
143u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
144{
145 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
146}
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 2faaa906d5d6..6d99a9880055 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -11,6 +11,7 @@
11#include <linux/ssb/ssb.h> 11#include <linux/ssb/ssb.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/ssb/ssb_embedded.h>
14 15
15#include "ssb_private.h" 16#include "ssb_private.h"
16 17
@@ -27,6 +28,18 @@ void pcicore_write32(struct ssb_pcicore *pc, u16 offset, u32 value)
27 ssb_write32(pc->dev, offset, value); 28 ssb_write32(pc->dev, offset, value);
28} 29}
29 30
31static inline
32u16 pcicore_read16(struct ssb_pcicore *pc, u16 offset)
33{
34 return ssb_read16(pc->dev, offset);
35}
36
37static inline
38void pcicore_write16(struct ssb_pcicore *pc, u16 offset, u16 value)
39{
40 ssb_write16(pc->dev, offset, value);
41}
42
30/************************************************** 43/**************************************************
31 * Code for hostmode operation. 44 * Code for hostmode operation.
32 **************************************************/ 45 **************************************************/
@@ -66,6 +79,7 @@ int pcibios_plat_dev_init(struct pci_dev *d)
66 base = &ssb_pcicore_pcibus_iobase; 79 base = &ssb_pcicore_pcibus_iobase;
67 else 80 else
68 base = &ssb_pcicore_pcibus_membase; 81 base = &ssb_pcicore_pcibus_membase;
82 res->flags |= IORESOURCE_PCI_FIXED;
69 if (res->end) { 83 if (res->end) {
70 size = res->end - res->start + 1; 84 size = res->end - res->start + 1;
71 if (*base & (size - 1)) 85 if (*base & (size - 1))
@@ -88,10 +102,12 @@ int pcibios_plat_dev_init(struct pci_dev *d)
88 102
89static void __init ssb_fixup_pcibridge(struct pci_dev *dev) 103static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
90{ 104{
105 u8 lat;
106
91 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0) 107 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
92 return; 108 return;
93 109
94 ssb_printk(KERN_INFO "PCI: fixing up bridge\n"); 110 ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev));
95 111
96 /* Enable PCI bridge bus mastering and memory space */ 112 /* Enable PCI bridge bus mastering and memory space */
97 pci_set_master(dev); 113 pci_set_master(dev);
@@ -101,7 +117,10 @@ static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
101 pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3); 117 pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
102 118
103 /* Make sure our latency is high enough to handle the devices behind us */ 119 /* Make sure our latency is high enough to handle the devices behind us */
104 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8); 120 lat = 168;
121 ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n",
122 pci_name(dev), lat);
123 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
105} 124}
106DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge); 125DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
107 126
@@ -117,8 +136,10 @@ static u32 get_cfgspace_addr(struct ssb_pcicore *pc,
117 u32 addr = 0; 136 u32 addr = 0;
118 u32 tmp; 137 u32 tmp;
119 138
120 if (unlikely(pc->cardbusmode && dev > 1)) 139 /* We do only have one cardbus device behind the bridge. */
140 if (pc->cardbusmode && (dev >= 1))
121 goto out; 141 goto out;
142
122 if (bus == 0) { 143 if (bus == 0) {
123 /* Type 0 transaction */ 144 /* Type 0 transaction */
124 if (unlikely(dev >= SSB_PCI_SLOT_MAX)) 145 if (unlikely(dev >= SSB_PCI_SLOT_MAX))
@@ -279,14 +300,14 @@ static struct resource ssb_pcicore_mem_resource = {
279 .name = "SSB PCIcore external memory", 300 .name = "SSB PCIcore external memory",
280 .start = SSB_PCI_DMA, 301 .start = SSB_PCI_DMA,
281 .end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1, 302 .end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1,
282 .flags = IORESOURCE_MEM, 303 .flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED,
283}; 304};
284 305
285static struct resource ssb_pcicore_io_resource = { 306static struct resource ssb_pcicore_io_resource = {
286 .name = "SSB PCIcore external I/O", 307 .name = "SSB PCIcore external I/O",
287 .start = 0x100, 308 .start = 0x100,
288 .end = 0x7FF, 309 .end = 0x7FF,
289 .flags = IORESOURCE_IO, 310 .flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED,
290}; 311};
291 312
292static struct pci_controller ssb_pcicore_controller = { 313static struct pci_controller ssb_pcicore_controller = {
@@ -318,7 +339,16 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
318 pcicore_write32(pc, SSB_PCICORE_ARBCTL, val); 339 pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
319 udelay(1); /* Assertion time demanded by the PCI standard */ 340 udelay(1); /* Assertion time demanded by the PCI standard */
320 341
321 /*TODO cardbus mode */ 342 if (pc->dev->bus->has_cardbus_slot) {
343 ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n");
344 pc->cardbusmode = 1;
345 /* GPIO 1 resets the bridge */
346 ssb_gpio_out(pc->dev->bus, 1, 1);
347 ssb_gpio_outen(pc->dev->bus, 1, 1);
348 pcicore_write16(pc, SSB_PCICORE_SPROM(0),
349 pcicore_read16(pc, SSB_PCICORE_SPROM(0))
350 | 0x0400);
351 }
322 352
323 /* 64MB I/O window */ 353 /* 64MB I/O window */
324 pcicore_write32(pc, SSB_PCICORE_SBTOPCI0, 354 pcicore_write32(pc, SSB_PCICORE_SBTOPCI0,
@@ -344,7 +374,8 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
344 /* Ok, ready to run, register it to the system. 374 /* Ok, ready to run, register it to the system.
345 * The following needs change, if we want to port hostmode 375 * The following needs change, if we want to port hostmode
346 * to non-MIPS platform. */ 376 * to non-MIPS platform. */
347 set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000)); 377 ssb_pcicore_controller.io_map_base = (unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000);
378 set_io_port_base(ssb_pcicore_controller.io_map_base);
348 /* Give some time to the PCI controller to configure itself with the new 379 /* Give some time to the PCI controller to configure itself with the new
349 * values. Not waiting at this point causes crashes of the machine. */ 380 * values. Not waiting at this point causes crashes of the machine. */
350 mdelay(10); 381 mdelay(10);
diff --git a/drivers/ssb/embedded.c b/drivers/ssb/embedded.c
new file mode 100644
index 000000000000..d3ade821555c
--- /dev/null
+++ b/drivers/ssb/embedded.c
@@ -0,0 +1,132 @@
1/*
2 * Sonics Silicon Backplane
3 * Embedded systems support code
4 *
5 * Copyright 2005-2008, Broadcom Corporation
6 * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de>
7 *
8 * Licensed under the GNU/GPL. See COPYING for details.
9 */
10
11#include <linux/ssb/ssb.h>
12#include <linux/ssb/ssb_embedded.h>
13
14#include "ssb_private.h"
15
16
17int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
18{
19 if (ssb_chipco_available(&bus->chipco)) {
20 ssb_chipco_watchdog_timer_set(&bus->chipco, ticks);
21 return 0;
22 }
23 if (ssb_extif_available(&bus->extif)) {
24 ssb_extif_watchdog_timer_set(&bus->extif, ticks);
25 return 0;
26 }
27 return -ENODEV;
28}
29
30u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
31{
32 unsigned long flags;
33 u32 res = 0;
34
35 spin_lock_irqsave(&bus->gpio_lock, flags);
36 if (ssb_chipco_available(&bus->chipco))
37 res = ssb_chipco_gpio_in(&bus->chipco, mask);
38 else if (ssb_extif_available(&bus->extif))
39 res = ssb_extif_gpio_in(&bus->extif, mask);
40 else
41 SSB_WARN_ON(1);
42 spin_unlock_irqrestore(&bus->gpio_lock, flags);
43
44 return res;
45}
46EXPORT_SYMBOL(ssb_gpio_in);
47
48u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value)
49{
50 unsigned long flags;
51 u32 res = 0;
52
53 spin_lock_irqsave(&bus->gpio_lock, flags);
54 if (ssb_chipco_available(&bus->chipco))
55 res = ssb_chipco_gpio_out(&bus->chipco, mask, value);
56 else if (ssb_extif_available(&bus->extif))
57 res = ssb_extif_gpio_out(&bus->extif, mask, value);
58 else
59 SSB_WARN_ON(1);
60 spin_unlock_irqrestore(&bus->gpio_lock, flags);
61
62 return res;
63}
64EXPORT_SYMBOL(ssb_gpio_out);
65
66u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value)
67{
68 unsigned long flags;
69 u32 res = 0;
70
71 spin_lock_irqsave(&bus->gpio_lock, flags);
72 if (ssb_chipco_available(&bus->chipco))
73 res = ssb_chipco_gpio_outen(&bus->chipco, mask, value);
74 else if (ssb_extif_available(&bus->extif))
75 res = ssb_extif_gpio_outen(&bus->extif, mask, value);
76 else
77 SSB_WARN_ON(1);
78 spin_unlock_irqrestore(&bus->gpio_lock, flags);
79
80 return res;
81}
82EXPORT_SYMBOL(ssb_gpio_outen);
83
84u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value)
85{
86 unsigned long flags;
87 u32 res = 0;
88
89 spin_lock_irqsave(&bus->gpio_lock, flags);
90 if (ssb_chipco_available(&bus->chipco))
91 res = ssb_chipco_gpio_control(&bus->chipco, mask, value);
92 spin_unlock_irqrestore(&bus->gpio_lock, flags);
93
94 return res;
95}
96EXPORT_SYMBOL(ssb_gpio_control);
97
98u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value)
99{
100 unsigned long flags;
101 u32 res = 0;
102
103 spin_lock_irqsave(&bus->gpio_lock, flags);
104 if (ssb_chipco_available(&bus->chipco))
105 res = ssb_chipco_gpio_intmask(&bus->chipco, mask, value);
106 else if (ssb_extif_available(&bus->extif))
107 res = ssb_extif_gpio_intmask(&bus->extif, mask, value);
108 else
109 SSB_WARN_ON(1);
110 spin_unlock_irqrestore(&bus->gpio_lock, flags);
111
112 return res;
113}
114EXPORT_SYMBOL(ssb_gpio_intmask);
115
116u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value)
117{
118 unsigned long flags;
119 u32 res = 0;
120
121 spin_lock_irqsave(&bus->gpio_lock, flags);
122 if (ssb_chipco_available(&bus->chipco))
123 res = ssb_chipco_gpio_polarity(&bus->chipco, mask, value);
124 else if (ssb_extif_available(&bus->extif))
125 res = ssb_extif_gpio_polarity(&bus->extif, mask, value);
126 else
127 SSB_WARN_ON(1);
128 spin_unlock_irqrestore(&bus->gpio_lock, flags);
129
130 return res;
131}
132EXPORT_SYMBOL(ssb_gpio_polarity);
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 9028ed5715a1..bedb2b4ee9d2 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -557,6 +557,7 @@ static int ssb_fetch_invariants(struct ssb_bus *bus,
557 goto out; 557 goto out;
558 memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo)); 558 memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo));
559 memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom)); 559 memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom));
560 bus->has_cardbus_slot = iv.has_cardbus_slot;
560out: 561out:
561 return err; 562 return err;
562} 563}
@@ -569,6 +570,9 @@ static int ssb_bus_register(struct ssb_bus *bus,
569 570
570 spin_lock_init(&bus->bar_lock); 571 spin_lock_init(&bus->bar_lock);
571 INIT_LIST_HEAD(&bus->list); 572 INIT_LIST_HEAD(&bus->list);
573#ifdef CONFIG_SSB_EMBEDDED
574 spin_lock_init(&bus->gpio_lock);
575#endif
572 576
573 /* Powerup the bus */ 577 /* Powerup the bus */
574 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1); 578 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);