On Mon, 2008-06-23 at 20:39 -0400, Dale Walsh wrote:
> I have been trying to modify antenna and antenna gain values and it
> appears that the wrong data is being modified.
I confirm it's still a problem with the current version in git.
> SPROM(0x04, Subsytem product ID) = 0x0453
But you are not using the latest version, because I fixed that typo.
Anyway, as I understand it, the original ssb-sprom as committed to the
git repository assumed that the A gain comes first at and the BG gain is
second.
The later changes for SPROM revision 4 assumed that the BG gain is
first, and the A gain is second. But those changes broke support for
older SPROM revisions. Also, the use of "sprom[offset + 1]" meant that
the incorrect offset would be printed. And the worst thing is that
modify_value() would modify wrong values for SPROM revision 4.
I actually don't know if the antenna gain order was changed in SPROM 4.
I just assume it from the history of the changes.
This patch should restore the original behavior for the old SPROM, and
it shouldn't break SPROM4 more than it's already broken.
diff --git a/ssb_sprom/ssb_sprom.c b/ssb_sprom/ssb_sprom.c
index ee56d38..9f182ef 100644
--- a/ssb_sprom/ssb_sprom.c
+++ b/ssb_sprom/ssb_sprom.c
@@ -293,10 +293,16 @@ static int modify_value(uint8_t *sprom,
sprom[SPROM_BOARDREV + 1] |= (1 << 5);
break;
case VALUE_ANTGA:
- sprom[SPROM_ANTENNA_GAIN + 0] = (v & 0xFF);
+ if (sprom_rev == 4)
+ sprom[SPROM4_ANTENNA_GAIN + 1] = (v & 0xFF);
+ else
+ sprom[SPROM_ANTENNA_GAIN] = (v & 0xFF);
break;
case VALUE_ANTGBG:
- sprom[SPROM_ANTENNA_GAIN + 1] = (v & 0xFF);
+ if (sprom_rev == 4)
+ sprom[SPROM4_ANTENNA_GAIN] = (v & 0xFF);
+ else
+ sprom[SPROM_ANTENNA_GAIN + 1] = (v & 0xFF);
break;
case VALUE_PA0B0:
sprom[SPROM_PA0B0 + 0] = (v & 0x00FF);
@@ -577,14 +583,14 @@ static void display_value(const uint8_t *sprom,
offset = SPROM_ANTENNA_GAIN;
} else {
desc = "Antenna 1 Gain";
- offset = SPROM4_ANTENNA_GAIN;
+ offset = SPROM4_ANTENNA_GAIN + 1;
}
- value = sprom[offset + 1];
+ value = sprom[offset];
break;
case VALUE_ANTGBG:
if (sprom_rev != 4) {
desc = "B/G PHY antenna gain";
- offset = SPROM_ANTENNA_GAIN;
+ offset = SPROM_ANTENNA_GAIN + 1;
} else {
desc = "Antenna 0 Gain";
offset = SPROM4_ANTENNA_GAIN;
--
Regards,
Pavel Roskin
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev