From patchwork Fri Feb 20 14:50:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 5856761 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0226DBF440 for ; Fri, 20 Feb 2015 14:50:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F4BE2039C for ; Fri, 20 Feb 2015 14:50:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0281420383 for ; Fri, 20 Feb 2015 14:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbbBTOuZ (ORCPT ); Fri, 20 Feb 2015 09:50:25 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34740 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbbBTOuY (ORCPT ); Fri, 20 Feb 2015 09:50:24 -0500 Received: by pabrd3 with SMTP id rd3so8582094pab.1 for ; Fri, 20 Feb 2015 06:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=U3oJkZ5QQgvfIWnaea3Tjk5RxwqAYlw1WmKZMkAwiG8=; b=Uydy0mBdN/sszrbLpPEQVN97XEZFoWuSWeCi3uOKxVFQpr9+AefdKFEVog0Z9Ppzx1 s41suxZJz2s+7aayP+bfYcujWk8/9X7fKaz2JXFaFCfr0VHKrC0Jm2yNjhGAtLKhCuCr lKv0rfzjs3ejmGG+eyp89v9on8zkPs+5wkUfseAxTgrSxf0XyHZds2Rf+WoGC5WGx9qU +Bcbs0RZKqlfYGlXJcgEDHXrlaVjGKViiiXwn9f/rjIuHeK2zDIvMP/t6hjQ4mI3OTRf gQA4sffoOd/e29LyGoUwaKwmPAyuBySEnmuWexg/5f/Nogvy8yqLxeiaNI6KHg+B6om8 OGKw== X-Received: by 10.70.138.105 with SMTP id qp9mr17469966pdb.64.1424443824155; Fri, 20 Feb 2015 06:50:24 -0800 (PST) Received: from localhost.localdomain ([112.153.155.138]) by mx.google.com with ESMTPSA id gv2sm2652798pbc.8.2015.02.20.06.50.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Feb 2015 06:50:22 -0800 (PST) From: Taehee Yoo To: Larry.Finger@lwfinger.net Cc: linux-wireless@vger.kernel.org, Taehee Yoo Subject: [PATCH] rtlwifi: rtl8192cu: Fix some beacon issue Date: Fri, 20 Feb 2015 23:50:13 +0900 Message-Id: <1424443813-13634-1-git-send-email-ap420073@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sometimes rtl8192cu is not sending beacon frame. This patch fix this issue. Signed-off-by: Taehee Yoo --- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 40 +++++++++++++--------------- drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | 1 + 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index fe4b699..5ad5429 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c @@ -1323,39 +1323,40 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw, enum led_ctl_mode ledaction = LED_CTL_NO_LINK; bt_msr &= 0xfc; - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xFF); - if (type == NL80211_IFTYPE_UNSPECIFIED || type == - NL80211_IFTYPE_STATION) { - _rtl92cu_stop_tx_beacon(hw); - _rtl92cu_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || type == NL80211_IFTYPE_AP) { - _rtl92cu_resume_tx_beacon(hw); - _rtl92cu_disable_bcn_sub_func(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS:No such media status(%x)\n", - type); - } + bt_msr |= type; + rtl_write_byte(rtlpriv, REG_BCN_CTRL, + rtl_read_byte(rtlpriv, REG_BCN_CTRL)|BIT(4)); + rtl_write_byte(rtlpriv, MSR, bt_msr); + rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(0)); + switch (type) { case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; ledaction = LED_CTL_LINK; + _rtl92cu_stop_tx_beacon(hw); + rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x19); RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to NO LINK!\n"); break; case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; + _rtl92cu_resume_tx_beacon(hw); + rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x1a); RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to Ad Hoc!\n"); break; case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; ledaction = LED_CTL_LINK; + _rtl92cu_stop_tx_beacon(hw); + rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x19); RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to STA!\n"); break; case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; + _rtl92cu_resume_tx_beacon(hw); + rtl_write_dword(rtlpriv, REG_BCN_CTRL, 0x12); + rtl_write_word(rtlpriv, REG_BCNTCFG, 0x00); + rtl_write_byte(rtlpriv, REG_BCN_CTRL, + (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION + | EN_TXBCN_RPT|EN_MBSSID)); RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to AP!\n"); break; @@ -1364,12 +1365,7 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw, "Network type %d not supported!\n", type); goto error_out; } - rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & MSR_MASK) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); return 0; error_out: return 1; diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c index 133e395..7a00e92 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c @@ -647,6 +647,7 @@ void rtl92c_init_beacon_parameters(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_hal *rtlhal = rtl_hal(rtlpriv); + rtl_write_word(rtlpriv, REG_BCN_CTRL, 0x1010); rtl_write_word(rtlpriv, REG_TBTT_PROHIBIT, 0x6404);/* ms */ rtl_write_byte(rtlpriv, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME);/*ms*/ rtl_write_byte(rtlpriv, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME);