diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-12-22 15:56:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:15 -0500 |
commit | f3dd3fcc2c79b950801641075b33b86acc372d9b (patch) | |
tree | 2b2416fd2a41629b9837255abcf12f8501f9a2f5 /drivers/net/wireless/b43 | |
parent | 9db1f6d725921c413cc344beda5e7e7d011b02e7 (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')
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 40 |
2 files changed, 30 insertions, 15 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 813b2409f0c3..bcaa60924381 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -50,6 +50,9 @@ | |||
50 | #define B43_MMIO_XMITSTAT_1 0x174 | 50 | #define B43_MMIO_XMITSTAT_1 0x174 |
51 | #define B43_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */ | 51 | #define B43_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */ |
52 | #define B43_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */ | 52 | #define B43_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */ |
53 | #define B43_MMIO_TSF_CFP_REP 0x188 | ||
54 | #define B43_MMIO_TSF_CFP_START 0x18C | ||
55 | #define B43_MMIO_TSF_CFP_MAXDUR 0x190 | ||
53 | 56 | ||
54 | /* 32-bit DMA */ | 57 | /* 32-bit DMA */ |
55 | #define B43_MMIO_DMA32_BASE0 0x200 | 58 | #define B43_MMIO_DMA32_BASE0 0x200 |
@@ -88,6 +91,8 @@ | |||
88 | #define B43_MMIO_RADIO_HWENABLED_LO 0x49A | 91 | #define B43_MMIO_RADIO_HWENABLED_LO 0x49A |
89 | #define B43_MMIO_GPIO_CONTROL 0x49C | 92 | #define B43_MMIO_GPIO_CONTROL 0x49C |
90 | #define B43_MMIO_GPIO_MASK 0x49E | 93 | #define B43_MMIO_GPIO_MASK 0x49E |
94 | #define B43_MMIO_TSF_CFP_START_LOW 0x604 | ||
95 | #define B43_MMIO_TSF_CFP_START_HIGH 0x606 | ||
91 | #define B43_MMIO_TSF_0 0x632 /* core rev < 3 only */ | 96 | #define B43_MMIO_TSF_0 0x632 /* core rev < 3 only */ |
92 | #define B43_MMIO_TSF_1 0x634 /* core rev < 3 only */ | 97 | #define B43_MMIO_TSF_1 0x634 /* core rev < 3 only */ |
93 | #define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ | 98 | #define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ |
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. */ |
2412 | static int b43_validate_chipaccess(struct b43_wldev *dev) | 2412 | static 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: | 2446 | error: |
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 | } |