[PATCH] zd1211rw: Fix E2P_PHY_REG patching

Due to conflicting/confusing defines in the vendor driver, we were
reading E2P_PHY_REG from the wrong location.

CR157 patching was slightly incorrect in that the vendor driver only
patches in an 8-bit value, whereas we were patching 24 bits.

Additionally, CR157 patching was happening on both zd1211 and zd1211b,
but this should only happen on zd1211.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Ulrich Kunitz <kune@deine-taler.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by Daniel Drake and committed by John W. Linville 92b3e2e9 ae6ead46

+4 -9
+3 -8
drivers/net/wireless/zd1211rw/zd_chip.c
··· 592 592 return r; 593 593 } 594 594 595 - /* CR157 can be optionally patched by the EEPROM */ 595 + /* CR157 can be optionally patched by the EEPROM for original ZD1211 */ 596 596 static int patch_cr157(struct zd_chip *chip) 597 597 { 598 598 int r; 599 - u32 value; 599 + u16 value; 600 600 601 601 if (!chip->patch_cr157) 602 602 return 0; 603 603 604 - r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); 604 + r = zd_ioread16_locked(chip, &value, E2P_PHY_REG); 605 605 if (r) 606 606 return r; 607 607 ··· 791 791 goto out; 792 792 793 793 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 794 - if (r) 795 - goto unlock; 796 - 797 - r = patch_cr157(chip); 798 - unlock: 799 794 t = zd_chip_unlock_phy_regs(chip); 800 795 if (t && !r) 801 796 r = t;
+1 -1
drivers/net/wireless/zd1211rw/zd_chip.h
··· 641 641 * also only 11 channels. */ 642 642 #define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) 643 643 644 - #define E2P_PHY_REG E2P_DATA(0x1a) 645 644 #define E2P_DEVICE_VER E2P_DATA(0x20) 645 + #define E2P_PHY_REG E2P_DATA(0x25) 646 646 #define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) 647 647 #define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) 648 648 #define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c)