From patchwork Fri Jan 13 21:26:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9516467 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 6D9F760761 for ; Fri, 13 Jan 2017 21:27:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E3F728780 for ; Fri, 13 Jan 2017 21:27:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 533F728787; Fri, 13 Jan 2017 21:27:23 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1234128780 for ; Fri, 13 Jan 2017 21:27:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cS9NV-0005qW-TL; Fri, 13 Jan 2017 21:27:17 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cS9NM-0005cc-Cr for ath10k@lists.infradead.org; Fri, 13 Jan 2017 21:27:11 +0000 Received: by mail-lf0-x244.google.com with SMTP id v186so7057084lfa.2 for ; Fri, 13 Jan 2017 13:26:47 -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=YKCj3KWQf0qmOkgvUWvXQNQ4kol9PfZa3uIzwSOh7/c=; b=PAKj1vs71jkCImPPIujUq1IwIeZ/NpyAuz3yacWuadIVRsPc2A48qWCapd/QxXmK+s lRAiODBUnXJztRCJJuDh3RxYjaAfbREe4PheH47JaMVAS/9Hw5N+VfEztT+mL65VoroF 5pLW2r3WLqyNXe829Zq8RAMs7VabaDlKT5pRzyQE2c/FhznMU1lVEWnRdnRorjkTG2tJ lf81Q6zrEeb7T175hMuChsd2LpbHSIao1LcESszZJc060mYZdvWmfORTtX0TMq/BeW3j g3bWue4MavX+2Kppb6S2aC3KXAxl3MPi06t3GejdislyyEL9Hl9lwaPQW0lHeYIIw6K5 P4sg== 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=YKCj3KWQf0qmOkgvUWvXQNQ4kol9PfZa3uIzwSOh7/c=; b=MVDQck/ZGOnNgoyzykzBUVkRmhQx5ATuvxxhd1NwwmwWWIRkQ+ChI7/j4cAPQK2Gkf YfQk7oqTKHMB+ii8+NQRgDGO1huzlQir8Cleufq8orJYZNwmX4IW3g0CqKvD7ev3ZPK6 mJrlq5fZMIpocsnHd4Ci6qHWgBbRO5fqlekIXQyP78CxrbKygQY+f8H8wyVNGIuyRqO6 7PW+dl0bKL5Xbt0clqZKGGxGw85kmS5sPEqwbW55egYM0vNWhj/AtuaDEODorI8uLb6j J16WGlcSqqLUmHLn8M493VCvNwY2MFKwBmqwaOezAw5YI0nR2A70pq88zeit907GzOXV P03A== X-Gm-Message-State: AIkVDXJQ0XEUDCc+5szZ093xyIPQ3Z58clNjLoDuLU+lRWbMpmHnjZmPiiWP08GadzMSMg== X-Received: by 10.46.77.197 with SMTP id c66mr8719962ljd.25.1484342806263; Fri, 13 Jan 2017 13:26:46 -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 r127sm4458010lfr.3.2017.01.13.13.26.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jan 2017 13:26:45 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v3 3/8] ath10k: htc: move htc ctrl ep connect to htc_init Date: Fri, 13 Jan 2017 22:26:06 +0100 Message-Id: <1484342771-6160-4-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484342771-6160-1-git-send-email-erik.stromdahl@gmail.com> References: <1484342771-6160-1-git-send-email-erik.stromdahl@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170113_132708_621210_C03E7988 X-CRM114-Status: GOOD ( 13.22 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves the HTC ctrl service connect from htc_wait_target to htc_init. This is done in order to make sure the htc ctrl service is setup properly before hif_start is called. The reason for this is that we want the HTC ctrl service callback to be initialized before the target sends the HTC ready message. The ready message will always be transmitted on endpoint 0 (which is always assigned to the HTC control service) so it makes more sense if HTC control has been connected before the ready message is received. Since the service to pipe mapping is done as a part of the service connect, the get_default_pipe call is redundant and was removed. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htc.c | 39 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index e72f385..f39eef6 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -584,8 +584,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) struct ath10k *ar = htc->ar; int i, status = 0; unsigned long time_left; - struct ath10k_htc_svc_conn_req conn_req; - struct ath10k_htc_svc_conn_resp conn_resp; struct ath10k_htc_msg *msg; u16 message_id; u16 credit_count; @@ -648,22 +646,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) return -ECOMM; } - /* setup our pseudo HTC control endpoint connection */ - memset(&conn_req, 0, sizeof(conn_req)); - memset(&conn_resp, 0, sizeof(conn_resp)); - conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete; - conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete; - conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS; - conn_req.service_id = ATH10K_HTC_SVC_ID_RSVD_CTRL; - - /* connect fake service */ - status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); - if (status) { - ath10k_err(ar, "could not connect to htc service (%d)\n", - status); - return status; - } - return 0; } @@ -873,8 +855,10 @@ int ath10k_htc_start(struct ath10k_htc *htc) /* registered target arrival callback from the HIF layer */ int ath10k_htc_init(struct ath10k *ar) { - struct ath10k_htc_ep *ep = NULL; + int status; struct ath10k_htc *htc = &ar->htc; + struct ath10k_htc_svc_conn_req conn_req; + struct ath10k_htc_svc_conn_resp conn_resp; spin_lock_init(&htc->tx_lock); @@ -882,10 +866,21 @@ int ath10k_htc_init(struct ath10k *ar) htc->ar = ar; - /* Get HIF default pipe for HTC message exchange */ - ep = &htc->endpoint[ATH10K_HTC_EP_0]; + /* setup our pseudo HTC control endpoint connection */ + memset(&conn_req, 0, sizeof(conn_req)); + memset(&conn_resp, 0, sizeof(conn_resp)); + conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete; + conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete; + conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS; + conn_req.service_id = ATH10K_HTC_SVC_ID_RSVD_CTRL; - ath10k_hif_get_default_pipe(ar, &ep->ul_pipe_id, &ep->dl_pipe_id); + /* connect fake service */ + status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); + if (status) { + ath10k_err(ar, "could not connect to htc service (%d)\n", + status); + return status; + } init_completion(&htc->ctl_resp);