Skip to content

Commit 6075100

Browse files
juhosglinvjw
authored andcommitted
rt2x00: rt2800lib: fix band selection and LNA PE control for RT3593 PCIe cards
The band selection and PE control code for the RT3593 chipsets only handles USB based devices currently. Due to this limitation RT3593 based PCIe cards are not working correctly. On PCIe cards band selection is controlled via GPIO #8 which is identical to the USB devices. The LNA PE control is slightly different, all LNA PEs are controlled by GPIO #4. Update the code to configure the GPIO_CTRL register correctly on PCIe devices. Cc: Steven Liu <[email protected]> Cc: JasonYS Cheng <[email protected]> Signed-off-by: Gabor Juhos <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 3001f0d commit 6075100

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

drivers/net/wireless/rt2x00/rt2800lib.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,29 +3315,37 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
33153315
rt2800_rfcsr_write(rt2x00dev, 8, 0x80);
33163316

33173317
if (rt2x00_rt(rt2x00dev, RT3593)) {
3318-
if (rt2x00_is_usb(rt2x00dev)) {
3319-
rt2800_register_read(rt2x00dev, GPIO_CTRL, &reg);
3318+
rt2800_register_read(rt2x00dev, GPIO_CTRL, &reg);
33203319

3321-
/* Band selection. GPIO #8 controls all paths */
3320+
/* Band selection */
3321+
if (rt2x00_is_usb(rt2x00dev) ||
3322+
rt2x00_is_pcie(rt2x00dev)) {
3323+
/* GPIO #8 controls all paths */
33223324
rt2x00_set_field32(&reg, GPIO_CTRL_DIR8, 0);
33233325
if (rf->channel <= 14)
33243326
rt2x00_set_field32(&reg, GPIO_CTRL_VAL8, 1);
33253327
else
33263328
rt2x00_set_field32(&reg, GPIO_CTRL_VAL8, 0);
3329+
}
33273330

3331+
/* LNA PE control. */
3332+
if (rt2x00_is_usb(rt2x00dev)) {
3333+
/* GPIO #4 controls PE0 and PE1,
3334+
* GPIO #7 controls PE2
3335+
*/
33283336
rt2x00_set_field32(&reg, GPIO_CTRL_DIR4, 0);
33293337
rt2x00_set_field32(&reg, GPIO_CTRL_DIR7, 0);
33303338

3331-
/* LNA PE control.
3332-
* GPIO #4 controls PE0 and PE1,
3333-
* GPIO #7 controls PE2
3334-
*/
33353339
rt2x00_set_field32(&reg, GPIO_CTRL_VAL4, 1);
33363340
rt2x00_set_field32(&reg, GPIO_CTRL_VAL7, 1);
3337-
3338-
rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
3341+
} else if (rt2x00_is_pcie(rt2x00dev)) {
3342+
/* GPIO #4 controls PE0, PE1 and PE2 */
3343+
rt2x00_set_field32(&reg, GPIO_CTRL_DIR4, 0);
3344+
rt2x00_set_field32(&reg, GPIO_CTRL_VAL4, 1);
33393345
}
33403346

3347+
rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
3348+
33413349
/* AGC init */
33423350
if (rf->channel <= 14)
33433351
reg = 0x1c + 2 * rt2x00dev->lna_gain;

0 commit comments

Comments
 (0)