From patchwork Tue Sep 19 12:33:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 9958797 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFCC760208 for ; Tue, 19 Sep 2017 12:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C96F28E4F for ; Tue, 19 Sep 2017 12:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8166C28E52; Tue, 19 Sep 2017 12:33:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED93A28E4F for ; Tue, 19 Sep 2017 12:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751411AbdISMd2 (ORCPT ); Tue, 19 Sep 2017 08:33:28 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:44297 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbdISMd1 (ORCPT ); Tue, 19 Sep 2017 08:33:27 -0400 Received: by mail-wm0-f52.google.com with SMTP id 189so18278971wmh.1 for ; Tue, 19 Sep 2017 05:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=a9xFaROSBFLC32nVpgJAX3ezaLYNGYpa7+dVaz+kIko=; b=A+aO6C1w90BslMC+W7fm0xr9I4fVye4z/kkjkwL/NqIonnAeKm9ViWMx2iMhqp19Bc 2q6BJNWkcZbM/puZyQ1gVjNAbgsKgM1Zms1dF0yDGG5EbM3Iar9nepE5PaerOib70s+1 wQj8mURBbTsa4sUeloBb0aYRUlg1mqOYBZSDo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=a9xFaROSBFLC32nVpgJAX3ezaLYNGYpa7+dVaz+kIko=; b=Sk0VyhO0phJN0MfF3V48udO9mKSdggfo7vd8EQ2SaGAVkIaSpksQtImO7ftL2aZe8y K+cdy391IlJR+Yxv/Oju3e0t1rbNbbRGUgynseZ12luFgJNI6Rjx4czNj+PcHILGeerh OSX9FpBmaES2pBUtwUFKY8tTCB4RHy5yKFc3vdW3XvAziiQd8XN7LjwD6+FaSTiHryZO DZvF1g0F8P9X5o8XKybp55wQj6Qw4w4Z3iFqYCKe1AdlKNkrIle/qPzDgtib9Pq4wiGO R2lvxEVCiGx6AlqUetQRkmZromnURjafTw5p60QS/pRnFUQgFCuRax4xV+KRzmxelUTQ D+bw== X-Gm-Message-State: AHPjjUj74oIgBGZnqkElUSrwMNhGTY8RFDN4nhnKcHfgcRBhYr/U4q99 hMNON7Z5+KIQldbD7+RsSYYVXQ== X-Google-Smtp-Source: AOwi7QDTZWvHY+SjXYmSFUWIYzKJM1FViZE5EKgOvJUVGHlLHv3cBdOskgCYNmyXQxBPSBdI0NeGbQ== X-Received: by 10.28.91.75 with SMTP id p72mr961474wmb.89.1505824406123; Tue, 19 Sep 2017 05:33:26 -0700 (PDT) Received: from localhost.localdomain ([2a01:cb19:8345:1d00:add2:471c:7cb:4ccd]) by smtp.gmail.com with ESMTPSA id r6sm9998858wrg.40.2017.09.19.05.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 05:33:25 -0700 (PDT) From: Loic Poulain To: k.eugene.e@gmail.com, kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org, Loic Poulain Subject: [PATCH] wcn36xx: Disable 5GHz for wcn3620 Date: Tue, 19 Sep 2017 14:33:23 +0200 Message-Id: <1505824403-26798-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wcn3620 can only operate on 2.4GHz band due to RF limitation. If wcn36xx digital block is associated with an external IRIS RF module, retrieve the id and disable 5GHz band in case of wcn3620 id. Signed-off-by: Loic Poulain --- drivers/net/wireless/ath/wcn36xx/main.c | 12 +++++++++++- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index a9220b4..c3bc248 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1089,7 +1089,8 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn) BIT(NL80211_IFTYPE_MESH_POINT); wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wcn_band_2ghz; - wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = &wcn_band_5ghz; + if (wcn->rf_id != RF_IRIS_WCN3620) + wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = &wcn_band_5ghz; wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS; wcn->hw->wiphy->max_scan_ie_len = WCN36XX_MAX_SCAN_IE_LEN; @@ -1119,6 +1120,7 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn, struct platform_device *pdev) { struct device_node *mmio_node; + struct device_node *iris_node; struct resource *res; int index; int ret; @@ -1181,6 +1183,14 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn, goto unmap_ccu; } + /* External RF module */ + iris_node = of_find_node_by_name(mmio_node, "iris"); + if (iris_node) { + if (of_device_is_compatible(iris_node, "qcom,wcn3620")) + wcn->rf_id = RF_IRIS_WCN3620; + of_node_put(iris_node); + } + of_node_put(mmio_node); return 0; diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index b52b4da9..0643477 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -94,6 +94,9 @@ enum wcn36xx_ampdu_state { #define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags) #define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power) +#define RF_UNKNOWN 0x0000 +#define RF_IRIS_WCN3620 0x3620 + static inline void buff_to_be(u32 *buf, size_t len) { int i; @@ -238,6 +241,9 @@ struct wcn36xx { struct sk_buff *tx_ack_skb; + /* RF module */ + unsigned rf_id; + #ifdef CONFIG_WCN36XX_DEBUGFS /* Debug file system entry */ struct wcn36xx_dfs_entry dfs;