aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2007-12-22 15:56:30 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:15 -0500
commitf3dd3fcc2c79b950801641075b33b86acc372d9b (patch)
tree2b2416fd2a41629b9837255abcf12f8501f9a2f5 /drivers/net/wireless/b43/main.c
parent9db1f6d725921c413cc344beda5e7e7d011b02e7 (diff)
b43: Fix chip access validation for new devices
This fixes chip access validation for newer devices (4318 and up, I think) This patch fixes probing of a PCMCIA based 4318 device. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index f4c14272332b..6b3013c2d96d 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2408,32 +2408,42 @@ static void b43_periodic_tasks_setup(struct b43_wldev *dev)
2408 queue_delayed_work(dev->wl->hw->workqueue, work, 0); 2408 queue_delayed_work(dev->wl->hw->workqueue, work, 0);
2409} 2409}
2410 2410
2411/* Validate access to the chip (SHM) */ 2411/* Check if communication with the device works correctly. */
2412static int b43_validate_chipaccess(struct b43_wldev *dev) 2412static int b43_validate_chipaccess(struct b43_wldev *dev)
2413{ 2413{
2414 u32 value; 2414 u32 v, backup;
2415 u32 shm_backup;
2416 2415
2417 shm_backup = b43_shm_read32(dev, B43_SHM_SHARED, 0); 2416 backup = b43_shm_read32(dev, B43_SHM_SHARED, 0);
2418 b43_shm_write32(dev, B43_SHM_SHARED, 0, 0xAA5555AA); 2417
2419 if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0xAA5555AA) 2418 /* Check for read/write and endianness problems. */
2420 goto error;
2421 b43_shm_write32(dev, B43_SHM_SHARED, 0, 0x55AAAA55); 2419 b43_shm_write32(dev, B43_SHM_SHARED, 0, 0x55AAAA55);
2422 if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0x55AAAA55) 2420 if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0x55AAAA55)
2423 goto error; 2421 goto error;
2424 b43_shm_write32(dev, B43_SHM_SHARED, 0, shm_backup); 2422 b43_shm_write32(dev, B43_SHM_SHARED, 0, 0xAA5555AA);
2425 2423 if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0xAA5555AA)
2426 value = b43_read32(dev, B43_MMIO_MACCTL);
2427 if ((value | B43_MACCTL_GMODE) !=
2428 (B43_MACCTL_GMODE | B43_MACCTL_IHR_ENABLED))
2429 goto error; 2424 goto error;
2430 2425
2431 value = b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); 2426 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup);
2432 if (value) 2427
2428 if ((dev->dev->id.revision >= 3) && (dev->dev->id.revision <= 10)) {
2429 /* The 32bit register shadows the two 16bit registers
2430 * with update sideeffects. Validate this. */
2431 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA);
2432 b43_write32(dev, B43_MMIO_TSF_CFP_START, 0xCCCCBBBB);
2433 if (b43_read16(dev, B43_MMIO_TSF_CFP_START_LOW) != 0xBBBB)
2434 goto error;
2435 if (b43_read16(dev, B43_MMIO_TSF_CFP_START_HIGH) != 0xCCCC)
2436 goto error;
2437 }
2438 b43_write32(dev, B43_MMIO_TSF_CFP_START, 0);
2439
2440 v = b43_read32(dev, B43_MMIO_MACCTL);
2441 v |= B43_MACCTL_GMODE;
2442 if (v != (B43_MACCTL_GMODE | B43_MACCTL_IHR_ENABLED))
2433 goto error; 2443 goto error;
2434 2444
2435 return 0; 2445 return 0;
2436 error: 2446error:
2437 b43err(dev->wl, "Failed to validate the chipaccess\n"); 2447 b43err(dev->wl, "Failed to validate the chipaccess\n");
2438 return -ENODEV; 2448 return -ENODEV;
2439} 2449}