Hello ! I have found bug in I/Q calibration procedure. Because of this bug calibration goes wrong, and card receive frames with CRC errors. In phy.c/ath5k_hw_rf511x_calibrate() i_coff = ((-iq_corr) / i_coffd) & 0x3f; but, i_coff is signed 32bit value, but when masking it with 0x3f it becomes signed positive value 0..63, but later, at boundary check it compared with (s32)-32 or (s32)31, and all correct negative values of i_coff always be greater than 31, and in card will be written not correct value (31 instead of -5, for example).
Proposed patch fix this bug, and some small differences between ath5k and Sam's HAL. --- phy.c.old 2009-04-01 13:57:01.000000000 +0400 +++ phy.c 2009-04-01 14:04:17.000000000 +0400 @@ -1291,16 +1291,17 @@ iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); + if (i_pwr && q_pwr) break; } i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7; q_coffd = q_pwr >> 7; /* No correction */ - if (i_coffd == 0 || q_coffd == 0) + if (i_coffd == 0 || q_coffd < 2) goto done; - i_coff = ((-iq_corr) / i_coffd) & 0x3f; + i_coff = ((-iq_corr) / i_coffd); /* Boundary check */ if (i_coff > 31) @@ -1308,7 +1309,7 @@ if (i_coff < -32) i_coff = -32; - q_coff = (((s32)i_pwr / q_coffd) - 128) & 0x1f; + q_coff = (((s32)i_pwr / q_coffd) - 128); /* Boundary check */ if (q_coff > 15) @@ -1318,7 +1319,7 @@ /* Commit new I/Q value */ AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE | - ((u32)q_coff) | ((u32)i_coff << AR5K_PHY_IQ_CORR_Q_I_COFF_S)); + (((u32)q_coff) & 0x1f) | (((u32)i_coff & 0x3f) << AR5K_PHY_IQ_CORR_Q_I_COFF_S)); /* Re-enable calibration -if we don't we'll commit * the same values again and again */ After applying this patch 48M and 54M data rases work more stable without lots of CRC errors. _______________________________________________ ath5k-devel mailing list ath5k-devel@lists.ath5k.org https://lists.ath5k.org/mailman/listinfo/ath5k-devel