From patchwork Tue May 7 20:03:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xose Vazquez Perez X-Patchwork-Id: 2536401 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 270CE3FC5A for ; Tue, 7 May 2013 20:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700Ab3EGUEn (ORCPT ); Tue, 7 May 2013 16:04:43 -0400 Received: from mail-we0-f181.google.com ([74.125.82.181]:60936 "EHLO mail-we0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311Ab3EGUEm (ORCPT ); Tue, 7 May 2013 16:04:42 -0400 Received: by mail-we0-f181.google.com with SMTP id q55so967908wes.12 for ; Tue, 07 May 2013 13:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=nLwtV3YLRA0sN+5/JvAvukJgAOmoQ0cOI/GyvvJHD7E=; b=cndV9g2+AZNT6wlSXzCD0RP0uuryFQHENoRxif0FVUq2jowWSSXczHcrulk3OLN4GC VZnr38TGTjqOvJRKtU/wxCzf0fVmhZkANWHNdLTsN6O4ON5Kt2Y2ruYaxUWHN4Ju5bYG fkerdgcfiQl8jOkv6bTuJTszx7ve/kxc3Yn5ZrLlqp7HHTHWQHaIrLEGDsgKt4OyjbDy FG9IoVHJboJOjoCycJaZfpDx3g2f3aYfC/xHvRSLAIycuULVEOdfRkm3spDBg+bYEJNe hIK/6tz+zgmvuVy6sTFFGqscRiEqg6jSuBUhcz+Xol9pI7PqCMyyMM7++29X9jxeLsii Ph4Q== X-Received: by 10.194.61.10 with SMTP id l10mr5814021wjr.32.1367957081422; Tue, 07 May 2013 13:04:41 -0700 (PDT) Received: from localhost (212-166-224-199.red-acceso.airtel.net. [212.166.224.199]) by mx.google.com with ESMTPSA id v6sm5346623wiy.11.2013.05.07.13.04.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 07 May 2013 13:04:40 -0700 (PDT) From: Xose Vazquez Perez Cc: Xose Vazquez Perez , Ivo van Doorn , Gertjan van Wingerde , Helmut Schaa , "John W. Linville" , users@rt2x00.serialmonkey.com, linux-wireless@vger.kernel.org Subject: [PATCH 3.10-rc] wireless: rt2x00: rt2800: fix hardware antenna diversity for RT5370G Date: Tue, 7 May 2013 22:03:30 +0200 Message-Id: <1367957010-9496-1-git-send-email-xose.vazquez@gmail.com> X-Mailer: git-send-email 1.7.11.7 To: unlisted-recipients:; (no To-header on input) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org RT5370G has hardware RX antenna diversity like RT5390R. based on 2012_03_22_RT5572_Linux_STA_v2.6.0.0_DPO Cc: Ivo van Doorn Cc: Gertjan van Wingerde Cc: Helmut Schaa Cc: John W. Linville Cc: users@rt2x00.serialmonkey.com Cc: linux-wireless@vger.kernel.org Tested-by: wnewbie72@gmail.com Signed-off-by: Xose Vazquez Perez --- drivers/net/wireless/rt2x00/rt2800.h | 3 ++- drivers/net/wireless/rt2x00/rt2800lib.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index a7630d5..6e84eee 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h @@ -89,7 +89,8 @@ #define REV_RT3090E 0x0211 #define REV_RT3390E 0x0211 #define REV_RT5390F 0x0502 -#define REV_RT5390R 0x1502 +#define REV_RT5370G 0x0503 /* hardware RX antenna diversity */ +#define REV_RT5390R 0x1502 /* hardware RX antenna diversity */ #define REV_RT5592C 0x0221 #define DEFAULT_RSSI_OFFSET 120 diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index b52d70c..e202ec7 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -4311,8 +4311,9 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); } - /* This chip has hardware antenna diversity*/ - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { + /* These chips have hardware RX antenna diversity */ + if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R) || + rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5370G)) { rt2800_bbp_write(rt2x00dev, 150, 0); /* Disable Antenna Software OFDM */ rt2800_bbp_write(rt2x00dev, 151, 0); /* Disable Antenna Software CCK */ rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */ @@ -5554,7 +5555,8 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) rt2x00dev->default_ant.rx = ANTENNA_A; } - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { + if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R) || + rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5370G)) { rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; /* Unused */ rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; /* Unused */ }