From patchwork Wed Jul 18 12:13:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luciano Coelho X-Patchwork-Id: 1210731 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 9B2323FD4F for ; Wed, 18 Jul 2012 12:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754059Ab2GRMOE (ORCPT ); Wed, 18 Jul 2012 08:14:04 -0400 Received: from na3sys009aog108.obsmtp.com ([74.125.149.199]:33164 "EHLO na3sys009aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018Ab2GRMN4 (ORCPT ); Wed, 18 Jul 2012 08:13:56 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]) (using TLSv1) by na3sys009aob108.postini.com ([74.125.148.12]) with SMTP ID DSNKUAaog8tNmaWX5zCSTaYGC2iB+IcaaCrp@postini.com; Wed, 18 Jul 2012 05:13:56 PDT Received: by lbol5 with SMTP id l5so2178860lbo.34 for ; Wed, 18 Jul 2012 05:13:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=L7YScwJjmCvBe5+tRBXrmpPhrFtiRR2/nwZKDbbIvdA=; b=RRVZwummIpfC/D2HIwcZtmDwND1lCjMBLPNg8v+qvVbClrwq3/GfGF1QC8st32/VdQ sR+SryfRF9QNqCFONihglQgcZpwuNG/t/thyNiwRae3k5F/sW/lcnk3L0urCpfFADXud Coo3/4iwFVPFG8Kvdf2nYCIYDi59eqH7MPK1AEBcc09ywEcHP3rbW/5KcAszKeFOjaRF Zasm9mZePOq9MAaL5mBo1BI150gR2arfMBvpNBaanArZ+VY5kxrviuIyAq12UUQOSCZn QumApyx+NGD2XfNNYlQnjJyM7CQvcjH3V8eCAvbX3nH6ZFXQLWVZw9tiSu6Pw0YLH9pS 3n+w== Received: by 10.112.86.132 with SMTP id p4mr1657084lbz.22.1342613633900; Wed, 18 Jul 2012 05:13:53 -0700 (PDT) Received: from cumari.Elisa (a88-113-65-16.elisa-laajakaista.fi. [88.113.65.16]) by mx.google.com with ESMTPS id gv8sm21679270lab.14.2012.07.18.05.13.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 05:13:53 -0700 (PDT) From: Luciano Coelho To: linux-wireless@vger.kernel.org Cc: coelho@ti.com, arik@wizery.com Subject: [PATCH 08/14] wlcore: add plt_mode including new PLT_FEM_DETECT Date: Wed, 18 Jul 2012 15:13:27 +0300 Message-Id: <1342613613-917-9-git-send-email-coelho@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342613613-917-1-git-send-email-coelho@ti.com> References: <1342613613-917-1-git-send-email-coelho@ti.com> X-Gm-Message-State: ALoCoQlZ33ItS/O70E3F7Amdv4pkJhtNE6zGrf84KVzMaSq7fqGq2SymnTlZY61TdJRs0wjVUedY Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yair Shapira add wl->plt_mode that is used to indicate different plt working modes: this will be used to implement calibrator side auto fem detection where driver asks firmware to detect the wlan fem radio type and returns it to calibrator. this is not implemented yet and plt_modes: PLT_ON and PLT_FEM_DETECT currently behave the same. Signed-off-by: Yair Shapira Signed-off-by: Luciano Coelho --- drivers/net/wireless/ti/wlcore/main.c | 21 ++++++++++++++++++--- drivers/net/wireless/ti/wlcore/testmode.c | 7 ++++--- drivers/net/wireless/ti/wlcore/wlcore.h | 1 + drivers/net/wireless/ti/wlcore/wlcore_i.h | 8 +++++++- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 05c3912..7254860 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -1064,10 +1064,17 @@ out: return ret; } -int wl1271_plt_start(struct wl1271 *wl) +int wl1271_plt_start(struct wl1271 *wl, const enum plt_mode plt_mode) { int retries = WL1271_BOOT_RETRIES; struct wiphy *wiphy = wl->hw->wiphy; + + static const char* const PLT_MODE[] = { + "PLT_OFF", + "PLT_ON", + "PLT_FEM_DETECT" + }; + int ret; mutex_lock(&wl->mutex); @@ -1081,6 +1088,10 @@ int wl1271_plt_start(struct wl1271 *wl) goto out; } + /* Indicate to lower levels that we are now in PLT mode */ + wl->plt = true; + wl->plt_mode = plt_mode; + while (retries) { retries--; ret = wl12xx_chip_wakeup(wl, true); @@ -1091,9 +1102,9 @@ int wl1271_plt_start(struct wl1271 *wl) if (ret < 0) goto power_off; - wl->plt = true; wl->state = WL1271_STATE_ON; - wl1271_notice("firmware booted in PLT mode (%s)", + wl1271_notice("firmware booted in PLT mode %s (%s)", + PLT_MODE[plt_mode], wl->chip.fw_ver_str); /* update hw/fw version info in wiphy struct */ @@ -1107,6 +1118,9 @@ power_off: wl1271_power_off(wl); } + wl->plt = false; + wl->plt_mode = PLT_OFF; + wl1271_error("firmware boot in PLT mode failed despite %d retries", WL1271_BOOT_RETRIES); out: @@ -1159,6 +1173,7 @@ int wl1271_plt_stop(struct wl1271 *wl) wl->sleep_auth = WL1271_PSM_ILLEGAL; wl->state = WL1271_STATE_OFF; wl->plt = false; + wl->plt_mode = PLT_OFF; wl->rx_counter = 0; mutex_unlock(&wl->mutex); diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c index d6f57e2..a204c93 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ b/drivers/net/wireless/ti/wlcore/testmode.c @@ -258,11 +258,12 @@ static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) val = nla_get_u32(tb[WL1271_TM_ATTR_PLT_MODE]); switch (val) { - case 0: + case PLT_OFF: ret = wl1271_plt_stop(wl); break; - case 1: - ret = wl1271_plt_start(wl); + case PLT_ON: + case PLT_FEM_DETECT: + ret = wl1271_plt_start(wl, val); break; default: ret = -EINVAL; diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 27ccc27..4f8b419 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -156,6 +156,7 @@ struct wl1271 { enum wl1271_state state; enum wl12xx_fw_type fw_type; bool plt; + enum plt_mode plt_mode; u8 last_vif_count; struct mutex mutex; diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h index 0187eef..c050563 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h @@ -293,6 +293,12 @@ enum rx_filter_action { FILTER_FW_HANDLE = 2 }; +enum plt_mode { + PLT_OFF = 0, + PLT_ON = 1, + PLT_FEM_DETECT = 2, +}; + struct wl12xx_rx_filter_field { __le16 offset; u8 len; @@ -459,7 +465,7 @@ struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif) #define wl12xx_for_each_wlvif_ap(wl, wlvif) \ wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_AP_BSS) -int wl1271_plt_start(struct wl1271 *wl); +int wl1271_plt_start(struct wl1271 *wl, const enum plt_mode plt_mode); int wl1271_plt_stop(struct wl1271 *wl); int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif); void wl12xx_queue_recovery_work(struct wl1271 *wl);