aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Buesch <mbuesch@freenet.de>2006-03-19 11:18:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-03-27 11:19:41 -0500
commit6ab5b8e670c4bb7ac0035ec3c6d6a161fae12009 (patch)
tree312fd463ba50aa480a2b3c8215951fe7e664c318 /drivers
parent714eece7c7c300bbc5e8285890e7374958ca37f4 (diff)
[PATCH] bcm43xx: merge all iwmode code into the set_iwmode function.
Signed-off-by: Michael Buesch <mbuesch@freenet.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c65
1 files changed, 29 insertions, 36 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index eb8fca8279f4..a85176325e92 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2292,50 +2292,60 @@ void bcm43xx_set_iwmode(struct bcm43xx_private *bcm,
2292 int iw_mode) 2292 int iw_mode)
2293{ 2293{
2294 unsigned long flags; 2294 unsigned long flags;
2295 struct net_device *net_dev = bcm->net_dev;
2295 u32 status; 2296 u32 status;
2297 u16 value;
2296 2298
2297 spin_lock_irqsave(&bcm->ieee->lock, flags); 2299 spin_lock_irqsave(&bcm->ieee->lock, flags);
2298 bcm->ieee->iw_mode = iw_mode; 2300 bcm->ieee->iw_mode = iw_mode;
2299 spin_unlock_irqrestore(&bcm->ieee->lock, flags); 2301 spin_unlock_irqrestore(&bcm->ieee->lock, flags);
2300 if (iw_mode == IW_MODE_MONITOR) 2302 if (iw_mode == IW_MODE_MONITOR)
2301 bcm->net_dev->type = ARPHRD_IEEE80211; 2303 net_dev->type = ARPHRD_IEEE80211;
2302 else 2304 else
2303 bcm->net_dev->type = ARPHRD_ETHER; 2305 net_dev->type = ARPHRD_ETHER;
2304 2306
2305 if (!bcm->initialized)
2306 return;
2307
2308 bcm43xx_mac_suspend(bcm);
2309 status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); 2307 status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
2310 /* Reset status to infrastructured mode */ 2308 /* Reset status to infrastructured mode */
2311 status &= ~(BCM43xx_SBF_MODE_AP | BCM43xx_SBF_MODE_MONITOR); 2309 status &= ~(BCM43xx_SBF_MODE_AP | BCM43xx_SBF_MODE_MONITOR);
2312 /*FIXME: We actually set promiscuous mode as well, until we don't 2310 status &= ~BCM43xx_SBF_MODE_PROMISC;
2313 * get the HW mac filter working */ 2311 status |= BCM43xx_SBF_MODE_NOTADHOC;
2314 status |= BCM43xx_SBF_MODE_NOTADHOC | BCM43xx_SBF_MODE_PROMISC; 2312
2313/* FIXME: Always enable promisc mode, until we get the MAC filters working correctly. */
2314status |= BCM43xx_SBF_MODE_PROMISC;
2315 2315
2316 switch (iw_mode) { 2316 switch (iw_mode) {
2317 case IW_MODE_MONITOR: 2317 case IW_MODE_MONITOR:
2318 status |= (BCM43xx_SBF_MODE_PROMISC | 2318 status |= BCM43xx_SBF_MODE_MONITOR;
2319 BCM43xx_SBF_MODE_MONITOR); 2319 status |= BCM43xx_SBF_MODE_PROMISC;
2320 break; 2320 break;
2321 case IW_MODE_ADHOC: 2321 case IW_MODE_ADHOC:
2322 status &= ~BCM43xx_SBF_MODE_NOTADHOC; 2322 status &= ~BCM43xx_SBF_MODE_NOTADHOC;
2323 break; 2323 break;
2324 case IW_MODE_MASTER: 2324 case IW_MODE_MASTER:
2325 status |= BCM43xx_SBF_MODE_AP;
2326 break;
2325 case IW_MODE_SECOND: 2327 case IW_MODE_SECOND:
2326 case IW_MODE_REPEAT: 2328 case IW_MODE_REPEAT:
2327 /* TODO: No AP/Repeater mode for now :-/ */ 2329 TODO(); /* TODO */
2328 TODO();
2329 break; 2330 break;
2330 case IW_MODE_INFRA: 2331 case IW_MODE_INFRA:
2331 /* nothing to be done here... */ 2332 /* nothing to be done here... */
2332 break; 2333 break;
2333 default: 2334 default:
2334 printk(KERN_ERR PFX "Unknown iwmode %d\n", iw_mode); 2335 dprintk(KERN_ERR PFX "Unknown mode in set_iwmode: %d\n", iw_mode);
2335 } 2336 }
2336 2337 if (net_dev->flags & IFF_PROMISC)
2338 status |= BCM43xx_SBF_MODE_PROMISC;
2337 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, status); 2339 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, status);
2338 bcm43xx_mac_enable(bcm); 2340
2341 value = 0x0002;
2342 if (iw_mode != IW_MODE_ADHOC && iw_mode != IW_MODE_MASTER) {
2343 if (bcm->chip_id == 0x4306 && bcm->chip_rev == 3)
2344 value = 0x0064;
2345 else
2346 value = 0x0032;
2347 }
2348 bcm43xx_write16(bcm, 0x0612, value);
2339} 2349}
2340 2350
2341/* This is the opposite of bcm43xx_chip_init() */ 2351/* This is the opposite of bcm43xx_chip_init() */
@@ -2357,7 +2367,6 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
2357 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 2367 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
2358 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 2368 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
2359 int err; 2369 int err;
2360 int iw_mode = bcm->ieee->iw_mode;
2361 int tmp; 2370 int tmp;
2362 u32 value32; 2371 u32 value32;
2363 u16 value16; 2372 u16 value16;
@@ -2411,20 +2420,9 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
2411 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); 2420 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
2412 value32 |= BCM43xx_SBF_MODE_NOTADHOC; 2421 value32 |= BCM43xx_SBF_MODE_NOTADHOC;
2413 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32); 2422 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
2414 /*FIXME: For now, use promiscuous mode at all times; otherwise we don't
2415 get broadcast or multicast packets */
2416 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
2417 value32 |= BCM43xx_SBF_MODE_PROMISC;
2418 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
2419 2423
2420 if (iw_mode == IW_MODE_MONITOR) {
2421 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
2422 value32 |= BCM43xx_SBF_MODE_PROMISC;
2423 value32 |= BCM43xx_SBF_MODE_MONITOR;
2424 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
2425 }
2426 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); 2424 value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
2427 value32 |= 0x100000; //FIXME: What's this? Is this correct? 2425 value32 |= 0x100000;
2428 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32); 2426 bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
2429 2427
2430 if (bcm43xx_using_pio(bcm)) { 2428 if (bcm43xx_using_pio(bcm)) {
@@ -2439,13 +2437,8 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
2439 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */ 2437 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */
2440 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0074, 0x0000); 2438 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0074, 0x0000);
2441 2439
2442 if (iw_mode != IW_MODE_ADHOC && iw_mode != IW_MODE_MASTER) { 2440 /* Initially set the wireless operation mode. */
2443 if ((bcm->chip_id == 0x4306) && (bcm->chip_rev == 3)) 2441 bcm43xx_set_iwmode(bcm, bcm->ieee->iw_mode);
2444 bcm43xx_write16(bcm, 0x0612, 0x0064);
2445 else
2446 bcm43xx_write16(bcm, 0x0612, 0x0032);
2447 } else
2448 bcm43xx_write16(bcm, 0x0612, 0x0002);
2449 2442
2450 if (bcm->current_core->rev < 3) { 2443 if (bcm->current_core->rev < 3) {
2451 bcm43xx_write16(bcm, 0x060E, 0x0000); 2444 bcm43xx_write16(bcm, 0x060E, 0x0000);