From patchwork Tue Aug 7 17:52:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 10559029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 631CD13BB for ; Tue, 7 Aug 2018 17:53:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488DB2A3EA for ; Tue, 7 Aug 2018 17:53:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BB982A6C3; Tue, 7 Aug 2018 17:53:25 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham 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 E354D2A3EA for ; Tue, 7 Aug 2018 17:53:22 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=7IXk3kSq5SI2BTZjCl4FQ9z4BE34JvhhgkcWkEj8wNU=; b=FJyEs2jmlcbi1l goGslVM8jpBW4JNFGRRhV/8SOM/8cL5vnpGaT6keiwVdFhfCoERop8HjHYgdQkWjFpnn4rl1xAFiC pmDGXrtQQsVbP2JHWj4bdFkxH4GPZBxT0VNQPFhrK42bE8aMYlSu9FUgA0jpwYa5qDpGdKrNAtHAH eBW7YiZhCyV6H6/SFpS+HN6NBwLVOE8/+/KyKRxn5y1H1mjm4SjH3lAzBaKb9t9SkZXj3SGB18dhc 8mEMzmJYUE32O7WtZuaAYevVgNPBrpBWVzwzjMDFdrFEwX4dYS76vvhcS0nEYYytqkDTfSEjZ0jDf 9N9yVZH7sa3AHp1azjsg==; 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 1fn6Ab-00053d-K4 for patchwork-linux-mediatek@patchwork.kernel.org; Tue, 07 Aug 2018 17:53:21 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fn6AV-0004wp-DJ; Tue, 07 Aug 2018 17:53:19 +0000 X-UUID: 48a94bda62924b4f852bab17b12409e3-20180808 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 150385665; Wed, 08 Aug 2018 01:52:53 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 8 Aug 2018 01:52:51 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Wed, 8 Aug 2018 01:52:51 +0800 From: To: , , , Subject: [PATCH v10 0/3] add support for Bluetooth on MT7622 SoC Date: Wed, 8 Aug 2018 01:52:46 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180807_105315_795571_07305212 X-CRM114-Status: GOOD ( 18.68 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Sean Wang , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Wang v10 and changes since v9: - Add a fixup that is __be16 is required instead of dlen1 + dlen2 in STP header. - Align a few one-line comments style as they're made in v9 - Fix two warnings catched by checkpatch.pl WARNING:TYPO_SPELLING: 'specifc' may be misspelled - perhaps 'specific'? at 248: FILE: drivers/bluetooth/btmtkuart.c:186: WARNING:MEMORY_BARRIER: memory barrier without comment at 260: FILE: drivers/bluetooth/btmtkuart.c:198: v9 and changes since v8: - Marcel Holtmann helps to add v9, which includes did a bunch of cosmetic minor cleanup, spelling correction and added __hci_cmd_send and its event synchronization scheme. For details, they can be found in [1]. [1] http://lists.infradead.org/pipermail/linux-mediatek/2018-August/014587.html v8 and changes since v7: - add updates per these suggestions mentioned in [1][2] - remove the hack atomic_inc(&hdev->cmd_cnt) mentioned in [2] because it should be better to be considered in the core [1] http://lists.infradead.org/pipermail/linux-mediatek/2018-August/014516.html [2] http://lists.infradead.org/pipermail/linux-mediatek/2018-August/014518.html v7 and changes since v6: - drop already applied patches - move clk_* and pm_* operation to ->open and ->close - label this driver as BT_MTKUART - make code style aligned with the other drivers and code better to read as these suggestions and fixes are mentioned in [1] [1] http://lists.infradead.org/pipermail/linux-mediatek/2018-July/014458.html v6 and changes since v5: - make btmtkuart become a separate driver. - drop already applied patches and the patch for btuart driver - refine comments in driver allowing people know that mtk extra header + length doesn't indicate a full H:4 frame, things can fragment. - enhance dt-binding document with removing mistaken added " and improve English sentence. - remove unnecessary '\n' with bt_dev_err. - refine code style. - set hdev->manufacturer as mtk id. v5 and changes since v4: - add Reviewed-by Tag from Ulf Hansson for patch 2 - remove default y in Kconfig for btmtkuart selection to avoid overkill for users which would like to have less an amount on stuff in kernel. - list header declarations in alphabetical order and add a proper blank line within. - remove unused macro. - use sizeof to calculate structure size instead of an aextra macro to hardcode. - use struct hci_dev * as input paraments for mtk_hci_wmt_sync and mtk_setup_fw for that can be reused in mtk bluetooth with other interfaces. - remove unused local variabled in mtk_btuart_recv. - remove superfluous :8 for dlen2 in struct mtk_stp_hdr definition. - give a reasonable naming for these labels and add a pm_runtime_put_noidle() in the path undoing failing pm_runtime_get_sync(). - Turn __u8 into u8 in struct mtk_stp_hdr. Really thanks for these reviews by Johan Hovold and Andy Shevchenko v4 and changes since v3: - refine patch 2 based on commit 919b7308fcc4 to allow that dev_pm_domain_attach() will return better error codes. v3 and changes since v2 * all changes happen on patch 6 - fix up SPDX license style for btmtkuart.h. - change firmware download from in ACL data to in HCI commands and then remove unused mtk_acl_wmt_sync and related code. - add a workaround replacing bad vendor event id 0xe4 with 0xff every vendor should use. - add a sanity check for mtk_hci_wmt_sync to verifying if input parameters are valid. - add an atomic_inc(&bdev->hdev->cmd_cnt) for __hci_cmd_sync_ev. - be changed to use firmware with a header called mt7622pr2h.bin. v2 and changes since v1 - Dropped patches already being applied - Rewirte the whole driver using btuart [1], and add slight extension of btuart to fit into btmtkuart driver. Beware that [1] is also pulled into one part of the series for avoiding any breakage when the patchset is being compiled. [1] btuart https://www.spinics.net/lists/linux-bluetooth/msg74918.html v1: Hi, This patchset introduces built-in Bluetooth support on MT7622 SoC. And, it should be simple to make an extension to support other MediaTek SoCs with adjusting a few of changes on the initialization sequence of the device. Before the main driver is being introduced, a few of things about power-domain management should be re-worked for serdev core and MediaTek SCPSYS to allow the Bluetooth to properly power up. Patch 2: add a generic way attaching power domain to serdev Patch 3 and 4: add cleanups with reuse APIs from Linux core Patch 5: fix a limitation about power enablement Bluetooth depends on Patch 1, 6 and 7: the major part of adding Bluetooth support to MT7622 Sean Sean Wang (3): dt-bindings: net: bluetooth: Add mediatek-bluetooth Bluetooth: mediatek: Add protocol support for MediaTek serial devices MAINTAINERS: add an entry for MediaTek Bluetooth driver .../devicetree/bindings/net/mediatek-bluetooth.txt | 35 ++ MAINTAINERS | 8 + drivers/bluetooth/Kconfig | 11 + drivers/bluetooth/Makefile | 1 + drivers/bluetooth/btmtkuart.c | 629 +++++++++++++++++++++ 5 files changed, 684 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mediatek-bluetooth.txt create mode 100644 drivers/bluetooth/btmtkuart.c