From patchwork Mon Mar 26 05:39:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10307173 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 F1B72600F6 for ; Mon, 26 Mar 2018 05:39:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F15012946B for ; Mon, 26 Mar 2018 05:39:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5E602946E; Mon, 26 Mar 2018 05:39:47 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B49E2946B for ; Mon, 26 Mar 2018 05:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=FwS7giqhUI+EH3vY5CAl3EV2cGou9QB5ZZ8jdGjNxow=; b=iiC ZdYkSh9BgP7OqDBbn1vfeI+oLSb07LQiYWB/XB+CjPwdOPdVbvvNDNZ2mQLAj9onODslX5IhkeRoD Ty/ye7+w8Zs0IIUpozKAdCnxIQZ14u8eY/llR/nbyASi60Zetx8ppYLOYGPy3tEoyoKjAsjU6mKPJ bATVSaC5MMb2tWzM7oNSoOs6XQ+c/lYcLMrUOD9DGo0Xyp/N1987mncKjvsdIAV6XofG2s0vlXOCl r9BC8FkvXRgs+csJhLpFHzagvhciMYv43w5z807xCp3osCfHhWukwTj9ERjwqZSVSJSeyID1asd9p TyhcgVqhK0XyX+QW4jmF6waP3Meqkxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0Kr7-0003l2-VS; Mon, 26 Mar 2018 05:39:41 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0Kr3-0003eB-Ur for ath10k@lists.infradead.org; Mon, 26 Mar 2018 05:39:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 78D3D60AE0; Mon, 26 Mar 2018 05:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522042767; bh=CI9JyRyf72JmhLxZl0U3+3xSZ411gWOL5bDewbgVPXw=; h=From:To:Cc:Subject:Date:From; b=hl9H0Au1+7jR4oxdP6arIBOlbckRIF2GrkQjf0s6YJzMpkz5sl4tPCFAHP5UcN/Ji VjJPcQ2aPY21lQlKwbLAtjg36a3btVC/qgTTSiCeTxdJkN5rkhXlh1Ae5nMQJoW9xq vWnr9vu6V8+cDD5KzsVhFiFP7tzK6zmTr/17CI9M= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 79FF460588; Mon, 26 Mar 2018 05:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522042766; bh=CI9JyRyf72JmhLxZl0U3+3xSZ411gWOL5bDewbgVPXw=; h=From:To:Cc:Subject:Date:From; b=fHQvtfnlNt9g+verrhPLAYcODWtfPd7Ccvye3yTXbnBCr3fYLkZDgSAulSXFiXXo6 7w1mz8jxFdpRKNr4fDpfPLQGIg+h8FlNjBrB7+TUV8Cwh+ZCfxd+Gxfta+AHGklUeE 7PEjaX8Pi95UENmxSSXW5DYMob4CKOsI+hC8S5zw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 79FF460588 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org, bjorn.andersson@linaro.org Subject: [PATCH 03/12] ath10k: Add ath10k QMI client driver Date: Mon, 26 Mar 2018 11:09:21 +0530 Message-Id: <1522042761-25716-1-git-send-email-govinds@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180325_223938_028330_388DA690 X-CRM114-Status: GOOD ( 17.92 ) 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: Govind Singh , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add QMI client driver for Q6 integrated WLAN connectivity subsystem. This module is responsible for communicating WLAN control messages to FW over QUALCOMM MSM Interface (QMI). Signed-off-by: Govind Singh --- drivers/net/wireless/ath/ath10k/Kconfig | 2 +- drivers/net/wireless/ath/ath10k/Makefile | 4 + drivers/net/wireless/ath/ath10k/qmi.c | 121 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/qmi.h | 24 ++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/ath/ath10k/qmi.c create mode 100644 drivers/net/wireless/ath/ath10k/qmi.h diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig index 84f071a..9978ad5e 100644 --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig @@ -42,7 +42,7 @@ config ATH10K_USB config ATH10K_SNOC tristate "Qualcomm ath10k SNOC support (EXPERIMENTAL)" - depends on ATH10K && ARCH_QCOM + depends on ATH10K && ARCH_QCOM && QCOM_QMI_HELPERS ---help--- This module adds support for integrated WCN3990 chip connected to system NOC(SNOC). Currently work in progress and will not diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile index 44d60a6..1730d1d 100644 --- a/drivers/net/wireless/ath/ath10k/Makefile +++ b/drivers/net/wireless/ath/ath10k/Makefile @@ -38,5 +38,9 @@ ath10k_usb-y += usb.o obj-$(CONFIG_ATH10K_SNOC) += ath10k_snoc.o ath10k_snoc-y += snoc.o +obj-$(CONFIG_ATH10K_SNOC) += ath10k_qmi.o +ath10k_qmi-y += qmi.o \ + qmi_svc_v01.o + # for tracing framework to find trace.h CFLAGS_trace.o := -I$(src) diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c new file mode 100644 index 0000000..2235182 --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/qmi.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qmi.h" +#include "qmi_svc_v01.h" + +static struct ath10k_qmi *qmi; + +static int ath10k_qmi_new_server(struct qmi_handle *qmi_hdl, + struct qmi_service *service) +{ + return 0; +} + +static void ath10k_qmi_del_server(struct qmi_handle *qmi_hdl, + struct qmi_service *service) +{ +} + +static struct qmi_ops ath10k_qmi_ops = { + .new_server = ath10k_qmi_new_server, + .del_server = ath10k_qmi_del_server, +}; + +static int ath10k_qmi_probe(struct platform_device *pdev) +{ + int ret; + + qmi = devm_kzalloc(&pdev->dev, sizeof(*qmi), + GFP_KERNEL); + if (!qmi) + return -ENOMEM; + + qmi->pdev = pdev; + platform_set_drvdata(pdev, qmi); + ret = qmi_handle_init(&qmi->qmi_hdl, + WLFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_MSG_LEN, + &ath10k_qmi_ops, NULL); + if (ret < 0) + goto err; + + ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01, + WLFW_SERVICE_VERS_V01, 0); + if (ret < 0) + goto err; + + pr_debug("qmi client driver probed successfully\n"); + + return 0; + +err: + return ret; +} + +static int ath10k_qmi_remove(struct platform_device *pdev) +{ + struct ath10k_qmi *qmi = platform_get_drvdata(pdev); + + qmi_handle_release(&qmi->qmi_hdl); + + return 0; +} + +static const struct of_device_id ath10k_qmi_dt_match[] = { + {.compatible = "qcom,ath10k-qmi"}, + {} +}; + +MODULE_DEVICE_TABLE(of, ath10k_qmi_dt_match); + +static struct platform_driver ath10k_qmi_clinet = { + .probe = ath10k_qmi_probe, + .remove = ath10k_qmi_remove, + .driver = { + .name = "ath10k QMI client", + .owner = THIS_MODULE, + .of_match_table = ath10k_qmi_dt_match, + }, +}; + +static int __init ath10k_qmi_init(void) +{ + return platform_driver_register(&ath10k_qmi_clinet); +} + +static void __exit ath10k_qmi_exit(void) +{ + platform_driver_unregister(&ath10k_qmi_clinet); +} + +module_init(ath10k_qmi_init); +module_exit(ath10k_qmi_exit); + +MODULE_AUTHOR("Qualcomm"); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_DESCRIPTION("ath10k QMI client driver"); diff --git a/drivers/net/wireless/ath/ath10k/qmi.h b/drivers/net/wireless/ath/ath10k/qmi.h new file mode 100644 index 0000000..ad256ef --- /dev/null +++ b/drivers/net/wireless/ath/ath10k/qmi.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _QMI_H_ +#define _QMI_H_ + +struct ath10k_qmi { + struct platform_device *pdev; + struct qmi_handle qmi_hdl; + struct sockaddr_qrtr sq; +}; +#endif /* _QMI_H_ */