From patchwork Fri Jan 13 21:35:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9516531 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 4952660761 for ; Fri, 13 Jan 2017 21:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A28A28584 for ; Fri, 13 Jan 2017 21:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ECBE2863F; Fri, 13 Jan 2017 21:35:41 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 C8C8928584 for ; Fri, 13 Jan 2017 21:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751477AbdAMVfi (ORCPT ); Fri, 13 Jan 2017 16:35:38 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35083 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbdAMVfb (ORCPT ); Fri, 13 Jan 2017 16:35:31 -0500 Received: by mail-lf0-f68.google.com with SMTP id v186so7072221lfa.2 for ; Fri, 13 Jan 2017 13:35:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XTW6dSb8dN4XsVOF7YK1fwdWAEfhXZtSlTIk1zwIaaw=; b=ZKBBZ1dN7vL+8TX0d+bhzYNgAji2FwtOwibQniCI+Odudb7ipVTkJIT2VnUYWsYtY4 azIuhIg/El4vukUdU+aHHMgFjHRaT7AaqktrsoKf4+LjCVLEBgMSn4F8F7JQNhneLl1K /wDX/oD09zqQ+0Wv5kq/5zYffJI4hwZ0wgqj8JmwtXOyj8t1vOf0sr9VCspQG+U70i2V vj6+syGizbxBd4cmxHT17r4Kto3voIleHmkuW+wfu3XE0NeMXf/Whsh4iPuj2KhDtd2y Y4pqNiL557/Rsmq4p0A6MXd2aiu5BUIAeUaTptbtaWaukX+tgsEHLQElqJ/4JrkpzGey aeFQ== 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:in-reply-to :references; bh=XTW6dSb8dN4XsVOF7YK1fwdWAEfhXZtSlTIk1zwIaaw=; b=UIx5Bv316FIokfZikRxl6P7ewAH+svUSZF+9IwJda4B/YbsGKxRKnzgLyzy/eRjCfq CgVKJr1HAwnYCSJh4uZsdTwVRHyGeO/Fa/kgjfK1v3W7SUoglP4tIY4mNv2HQqK+9Xk5 FkI9ZbN43rKWAr0Wo39DjMW+Kxe/yqaZmu24F89+pe7p9Tg3ol4bmjz1GJwWQ8uNlLEf lIYQAtHt2Pe2f1ntGFwZp6Owbqw6gBDSWT27X4X1vvWom/JWN6rGa5Or+DNFlmaCuduV LCX4ufHfqqCzm3DUtog7ZwN8SrOBhrXRW3uWqxqdHeP8EP5v4gkMmnDvKkU6vTrXrh+D 89IA== X-Gm-Message-State: AIkVDXIWpXpqFoSRbRENSz7UyNtKKcPq/RaGwWQElOWzw8RtUPbTis37Ih5tyzlxKy5BPQ== X-Received: by 10.25.16.158 with SMTP id 30mr889282lfq.119.1484343329246; Fri, 13 Jan 2017 13:35:29 -0800 (PST) Received: from erik-mate-1604.lan (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id 66sm4437411lfy.42.2017.01.13.13.35.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jan 2017 13:35:28 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC 08/10] ath10k: add start_once support Date: Fri, 13 Jan 2017 22:35:07 +0100 Message-Id: <1484343309-6327-9-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484343309-6327-1-git-send-email-erik.stromdahl@gmail.com> References: <1484343309-6327-1-git-send-email-erik.stromdahl@gmail.com> 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 Add possibility to configure the driver to only start target once. This can reduce startup time of SDIO devices significantly since loading the firmware can take a substantial amount of time. The patch is also necessary for high latency devices in general since it does not seem to be possible to rerun the BMI phase (fw upload) without power-cycling the device. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/core.c | 20 ++++++++++++++++---- drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/hw.h | 6 ++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 31a9471..250e32b 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -302,6 +302,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .max_num_peers = TARGET_QCA9377_HL_NUM_PEERS, .is_high_latency = true, .bus = ATH10K_BUS_USB, + .start_once = true, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -1841,6 +1842,9 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode, int status; u32 val; + if (ar->is_started && ar->hw_params.start_once) + return 0; + lockdep_assert_held(&ar->conf_mutex); clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags); @@ -2053,6 +2057,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode, if (status) goto err_hif_stop; + ar->is_started = true; return 0; err_hif_stop: @@ -2105,6 +2110,7 @@ void ath10k_core_stop(struct ath10k *ar) ath10k_htt_tx_stop(&ar->htt); ath10k_htt_rx_free(&ar->htt); ath10k_wmi_detach(ar); + ar->is_started = false; } EXPORT_SYMBOL(ath10k_core_stop); @@ -2202,12 +2208,18 @@ static int ath10k_core_probe_fw(struct ath10k *ar) goto err_unlock; } - ath10k_debug_print_boot_info(ar); - ath10k_core_stop(ar); + /* Leave target running if hw_params.start_once is set */ + if (ar->hw_params.start_once) { + mutex_unlock(&ar->conf_mutex); + } else { + ath10k_debug_print_boot_info(ar); + ath10k_core_stop(ar); - mutex_unlock(&ar->conf_mutex); + mutex_unlock(&ar->conf_mutex); + + ath10k_hif_power_down(ar); + } - ath10k_hif_power_down(ar); return 0; err_unlock: diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index d9d7805..800f058 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -746,6 +746,8 @@ struct ath10k { bool is_high_latency; + bool is_started; + struct { enum ath10k_bus bus; const struct ath10k_hif_ops *ops; diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 33186be..04ae66d 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -436,6 +436,12 @@ struct ath10k_hw_params { bool is_high_latency; enum ath10k_bus bus; + + /* Specifies whether or not the device should be started once. + * If set, the device will be started once by the early fw probe + * and it will not be terminated afterwards. + */ + bool start_once; }; struct htt_rx_desc;