Skip to contentSkip to conversation

wifi: b43: HT-PHY: read 32-bit table entries low half first

PATCH New Rosen Penev 1 participant 1 message Oct 22 B43 wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: b43: HT-PHY: read 32-bit table entries low half first

From: Erik Conijn <[email protected]>

The PHY latches a 32-bit table entry on the access to the low data register, as b43's N-PHY table code and Broadcom's wlc_phy_read_table assume. The HT-PHY code read the high half first and got the stale high half of the previous access: TX gain table entry 0x1a/0xc0 0x10f90040 read back as 0x10190040, so b43_phy_ht_tx_power_fix() programmed a corrupted radio gain word.

Fixes 1a9313923718 ("b43: HT-PHY: prepare place for HT-PHY tables")
---
 drivers/net/wireless/broadcom/b43/tables_phy_ht.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/b43/tables_phy_ht.c +5 -6
index 1acf2df66e5e..a6db39c644e3 100644
@@ -622,9 +622,9 @@ u32 b43_httab_read(struct b43_wldev *dev, u32 offset)
 		break;
 	case B43_HTTAB_32BIT:
 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
-		value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI);
-		value <<= 16;
-		value |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
+		/* the low half latches the entry: read it first */
+		value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
+		value |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI) << 16;
 		break;
 	default:
 		B43_WARN_ON(1);
@@ -658,9 +658,8 @@ void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset,
 			data += 2;
 			break;
 		case B43_HTTAB_32BIT:
-			*((u32 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI);
-			*((u32 *)data) <<= 16;
-			*((u32 *)data) |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
+			*((u32 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
+			*((u32 *)data) |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI) << 16;
 			data += 4;
 			break;
 		default:
Signature · 1 line
2.56.0