From patchwork Fri Jan 18 17:02:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771215 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 EDE1C6C5 for ; Fri, 18 Jan 2019 17:03:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE702FDA2 for ; Fri, 18 Jan 2019 17:03:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEE212FE45; Fri, 18 Jan 2019 17:03:05 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 350322FDD7 for ; Fri, 18 Jan 2019 17:03:05 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d6kVVI5S0LYfibS2q2GMpatVA6yZaljcL/GuPBI1zZk=; b=YuM0HSZIRVQrtd b9mi/QoOa9NhgP8DzQ6z4uKUfBSDcmhcWsYbAqubVdqlKMj6+ENe/100p3G0MVDQUxICNuss6bF2H gFW6qEqJ/lIxsVikBRbLV3/+X53s8MfSr7PWixVrru+oo9QxSTRMe8U2lKEXCbbJon0+T5ASEctRE 8CAtd8wGU4t16dzCIn1X3691RC26I1SIJJBFwsEEWor1IeOmH6Hzv6UnMeLJJpS72RwAIZAGhKWl1 vExd2Wq6+OYBv0x71CevInN6UR6TTZl5M+F+WgIuxH5zTWtX6A8Ip4rCqo73drVqhWuQHzV0+G5au 41axmT7amMjUIafb88Sg==; 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 1gkXXo-0008Kt-Jf; Fri, 18 Jan 2019 17:03:00 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXZ-00087o-Sb for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:02:47 +0000 Received: by mail-pl1-x644.google.com with SMTP id a14so6589775plm.12 for ; Fri, 18 Jan 2019 09:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3GYPwFAfOQ2PBwuTZDsLKhTieI3hmQzYqkGxR2OgQSM=; b=jCYKFkpjXqGzDObfujVjSF4j6c6ARgIt8wreJEFYkmR/9xZsRwyxTyO00TYXkd0qza DYOgUwlzeUHGBXlgyET6F7DsZpjSphFI3O/88XjoMOxJ/NiLXDLONXJB5evqKMxIYRxh KukpdkTAn43/bBzOzGozLnSBakoLfKM4DU3ynL3RrQuSdPLfgPnQbyo/zBYdI7X02mT1 0eDtpaxD7DwfvC7ETKqHcyEIVCm3cmwr89aIl2JWRK7Ofly6k35jCuD79eWWvoMXAcch S99l4Dwg1lk1H5SDQ/+CkSZ5PbH2KhU4AcaXq19BB8MdCvLCW7iEYiaKPCzPSWahnFuW Oqww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3GYPwFAfOQ2PBwuTZDsLKhTieI3hmQzYqkGxR2OgQSM=; b=exmXPHQzKgRdRQvPAAQGrTaDEgWkTmqzICYM77ejgSO2OpZ/asKoHqvvNFxWsAIItm m/QPBqlL95AcQ2l54ZlAT7WBHuPvFz9CeF9KnOzOpBWm3BbuVzLNedgfgiB5YH8EaSkd GHEbBJ3b/Bt0Bzgjb/JFgp44Xg4T76Eb+WvrEGFe3CDSGab/q+a25wN2VibOTyWzyDeX vux8005TyhxL2clMah0Tf4aO6nMqDI0Av8HMY0HjZTzXUB2xvlNc49/U9Rlj1I8Z7jTa tD6lEoeP6g+1GldfsXfrVUW96DG6akKCjPUT1QoMbzj5GK8i8QMlA6qt9Aa7Tqjj5e/p tl9A== X-Gm-Message-State: AJcUukfSWCk19kV7nxJE0W2IaegFR76VS88mHIQD9slqWwvV/9y8nOBx 7GZ8+HRvDWHKlScnt6ObbSM= X-Google-Smtp-Source: ALg8bN5GYqC1evbJwdjXhHBNVtpkDQAi7VzvvBJXjFG03Ue4K5yK643MPMID0mliToQZas5hMgNhXA== X-Received: by 2002:a17:902:7791:: with SMTP id o17mr19716381pll.60.1547830964956; Fri, 18 Jan 2019 09:02:44 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:44 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 1/8] Bluetooth: Add new quirk for broken local ext features max_page Date: Fri, 18 Jan 2019 09:02:25 -0800 Message-Id: <20190118170232.16142-2-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090245_920485_1D16D0A9 X-CRM114-Status: GOOD ( 14.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands. Signed-off-by: Vasily Khoruzhick --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index c36dc1e20556..d7849f128d58 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -192,6 +192,13 @@ enum { * */ HCI_QUIRK_NON_PERSISTENT_SETUP, + + /* When this quirk is set, max_page for local extended features + * is set to 1, even if controller reports higher number. Some + * controllers (e.g. RTL8723CS) report more pages, but they + * don't actually support features declared there. + */ + HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index ac2826ce162b..9c59af7de197 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -639,7 +639,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev, if (rp->status) return; - if (hdev->max_page < rp->max_page) + if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks) && + hdev->max_page < rp->max_page) hdev->max_page = rp->max_page; if (rp->page < HCI_MAX_PAGES) From patchwork Fri Jan 18 17:02:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771219 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 79EDA13B5 for ; Fri, 18 Jan 2019 17:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D102FDA5 for ; Fri, 18 Jan 2019 17:03:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57F5A2FDB4; Fri, 18 Jan 2019 17:03:33 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 DE93B2FDA5 for ; Fri, 18 Jan 2019 17:03:32 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OxzhaiCm/AUAmJ5o3EWo5LwohWNrF4v2UavaM0gueW4=; b=q3Sfv5gWaONNd4 nMMSVvqyNZjHaLM3E7shGgFsO6tZ5Y46PISqijAq+f5eEEZt+/b3kDo76Nq2jvBniYRihLZpEdxsA M1N8yYJ0ZVlgKoRykibhEWipsT79RIGjyHKPeQ5K9Y6e/spqK0JwM/bxTnki6y3+B/KkevVDIaTcZ TI82P3pjr/Ci2fb5mpwIgRfvOShMVMLWO4yJPwQ6zpSNKd5E9k5pbD0zZdnLNM9xEXjh+v7kFnC82 SfmkfIW5Q6K6hR+yAVTg7DOb3ao42jDO4kpKyF4IJ3dD9xhylMRDgYVnWzrwTcOzQLuEALukV60pJ G9DuafqHqUKiLjGUx8Vw==; 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 1gkXYH-0000G6-6t; Fri, 18 Jan 2019 17:03:29 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXb-00088F-7L for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:02:48 +0000 Received: by mail-pl1-x642.google.com with SMTP id u18so6607993plq.7 for ; Fri, 18 Jan 2019 09:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jFEUu0iFvQYztS9g4BUdYLNIZwJ1NonHLyGxopxGJbE=; b=pywTVcO+DpWWCNXOmqzrHFpvyS521dw4vRXXY+31xsUMVGpIEiHHodTkbjeGeAkH0G ijzes2TXZ3uLqONaDqtQ5NJDGqfMmRtiOsAPToCvWtjn4XWMMm4gQID00FhBd3zgCAup dBXoawZQUh0QXLLLQ4yn2f92WW5WCswHPHT57RE56vkU4vCAaHfVS+8x5c/poaiaNANF 7CBhFFyUyrgL7uHK6Gb80GCVPLdMAj641DlRCfd7i3t5mZ8rLXlWt3nnd/M8n2dNdpIP g60WsdqC10hB4b2Eog/1WMf6/GMRYeJz6yEX5dt+jqIavBDelbv+9wvf7e+Mwky9ShKo kUiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jFEUu0iFvQYztS9g4BUdYLNIZwJ1NonHLyGxopxGJbE=; b=XrLan6nCCeTpn7YhS4yfbCg1um1GZwhfFgwyzdlcycxEXDnEwjwvelzeTc75vfBe+Y lUaGozDZm2wblokUFib+QiICWTOpXv13aXtl/99DsIC8xEOFMpDqBGYJ9t37EwauVGpa 2xUUUP3G7r9ohNL3eZhdH+mY/bdcWTkaUGRUoJBxwkp9M65efTcYd18kU1zpCGo2nXBa NDXSl1EeyU5taMx3Zsf+Ae0X/HSaG+AZmCRoUSUApe/5nBh50gDnGNmIw4gdWdzVmet7 UWcTFPjaX92Kya8BqJtjR+Vg/L3ZjTCAjbkOjskLR9lAYFqkc1Lc5FoF2cePlB3lDM24 DOtg== X-Gm-Message-State: AJcUukceKVArURVjzTQ4mizmqtag4C92mHjYbdjMk4eL7oO1Wd2SfmOa JWe8Yc3O1qM7+fjf45TEhzc= X-Google-Smtp-Source: ALg8bN4RkK6wHVXxv15RcaeOc3A+ypBDn75Lj3dSW/DHGg4PYPYfnEC+ZoHcA89/Fdvj6Pa8xVbxfA== X-Received: by 2002:a17:902:145:: with SMTP id 63mr19834028plb.256.1547830966075; Fri, 18 Jan 2019 09:02:46 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:45 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 2/8] Bluetooth: hci_h5: Add support for reset GPIO Date: Fri, 18 Jan 2019 09:02:26 -0800 Message-Id: <20190118170232.16142-3-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090247_263116_BE10FB01 X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some boards (e.g. Pine64 and Pinebook) wire a GPIO to reset pin of RTL8723BS Signed-off-by: Vasily Khoruzhick --- drivers/bluetooth/hci_h5.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 069d1c8fde73..7ead8c3d8657 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -107,6 +107,7 @@ struct h5 { const struct h5_vnd *vnd; const char *id; + struct gpio_desc *reset_gpio; struct gpio_desc *enable_gpio; struct gpio_desc *device_wake_gpio; }; @@ -833,6 +834,10 @@ static int h5_serdev_probe(struct serdev_device *serdev) if (IS_ERR(h5->device_wake_gpio)) return PTR_ERR(h5->device_wake_gpio); + h5->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(h5->reset_gpio)) + return PTR_ERR(h5->reset_gpio); + return hci_uart_register_device(&h5->serdev_hu, &h5p); } @@ -921,6 +926,9 @@ static void h5_btrtl_open(struct h5 *h5) /* The controller needs up to 500ms to wakeup */ gpiod_set_value_cansleep(h5->enable_gpio, 1); + /* Take it out of reset */ + gpiod_set_value_cansleep(h5->reset_gpio, 0); + msleep(100); gpiod_set_value_cansleep(h5->device_wake_gpio, 1); msleep(500); } @@ -928,6 +936,7 @@ static void h5_btrtl_open(struct h5 *h5) static void h5_btrtl_close(struct h5 *h5) { gpiod_set_value_cansleep(h5->device_wake_gpio, 0); + gpiod_set_value_cansleep(h5->reset_gpio, 1); gpiod_set_value_cansleep(h5->enable_gpio, 0); } From patchwork Fri Jan 18 17:02:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771221 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 847DD6C5 for ; Fri, 18 Jan 2019 17:03:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70BE228AAC for ; Fri, 18 Jan 2019 17:03:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 611A528BF3; Fri, 18 Jan 2019 17:03:48 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 F08472FDA5 for ; Fri, 18 Jan 2019 17:03: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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bGvBqgrbMyv3VUTGouMujPzclQy0eJxOFe032harC9k=; b=O94ZXLzJwa8Pse nmjggGn9h3KiVtcITXCVSLwg2MEDUokdYFMloutBjm0uq0kDtiYzBk8g+uETHFeaXytzS4slKI907 sa7B3Vv6hLfbk9Fa/wracycEahILHvr9zvzNHJKv0zVvOXeifWHIlmHsqS19GHLVu8kMN58kI5iF5 52N/8994Zn/zh/jQpMjPmWsVMyvcZ+xZ+Vuf0ukj5jPuowgUzo7+ykjpLSAPqfEAhVEBv7Ycjg7Qy VO3XLX0lsLP/kdPF8dHq+hdZVvx5spHjaMFjDQilS5UV9LF5Rx/RAvvemv4TOFeHGRFKNgcm1bJLy dCTXZoRq5tkh+uduuI0Q==; 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 1gkXYV-0000RW-46; Fri, 18 Jan 2019 17:03:43 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXb-00088d-Oz for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:02:49 +0000 Received: by mail-pf1-x444.google.com with SMTP id i12so6873555pfo.7 for ; Fri, 18 Jan 2019 09:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=d2rQCukECTJQilTnrmqyIouQcxujlVs0VqTurP7Vfgw=; b=A5QwWQtkeb+gp7/yUDs3PgOjwdsSvVocZkMnIO6pMCwJ5rIogQA2WynHjNSJybVTpv fGaNbgySGaTW9HkRagV5mvKiUc/us/gswoj0v3zFk4ck/dfgA+gPKH9HR8oPewgohIVw sXhMOVgKNLmNLYBd5aoC1exj1/60VA0sVzRrgBeKi3I9mJZyar7u1PxiRrNF38BB5aXz s9H250UhEBbnO7vq5O/91k5wbMwYdp836OntanmubH3y8xaQ9z1+qRdIPG6TwK2SD3m8 bxoVb8Ssqt8IlA8NBxcI2C6bP2kC167TgSk6tbvYj65dFeH1pK0nLPXtp/DFFVDI4h+7 ppRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d2rQCukECTJQilTnrmqyIouQcxujlVs0VqTurP7Vfgw=; b=pYg0DJ/UoiaR3dWoJwD/ibnanoz/cWdhlD7J0OpvqJlXJnAGqxIFvs8FsV8MHUKZrV 4eQkMGz5nRsEvmzZ4S/aaiTv2fTKacw3Te2W2i6AeQKUMr1xKnDZnNHl2u6oWYrGZ5Gr qgqOrFfVM/J9pc7MwU8qwg1KaoJKB/LLzMc8Z29NKmFPsT7DQzoQkspd/BHS/ShEwTy5 Lg0W/cNC33Z1OMI8CMiDSVR8ASyrbhAiPhheYaM788/vSeUVNDLtt8YXisQEs11osTEg TzWmF/edZD0LqmiHXKhn+vf3DHVk4VHe7Qx8HZkh/sl+7PyhiZzO8n/7bKkzwFDeuePU 6XJg== X-Gm-Message-State: AJcUukfmnBrFfr0y7Y8M02/mAT3Uvj8rzUDAfxMhPAtL4/sO9XzadZKx 4l+WQH7pH17t13Jr1Q7fRlc= X-Google-Smtp-Source: ALg8bN6nIPP2MNX0kxfvTje18iThnYwjws4PFr2ea4/zP2x8dsfJDv2hBo/BuhJSO8QS/crgw7j5kg== X-Received: by 2002:a62:1212:: with SMTP id a18mr20702116pfj.217.1547830967166; Fri, 18 Jan 2019 09:02:47 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:46 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 3/8] dt-bindings: net: bluetooth: Add rtl8723bs-bluetooth Date: Fri, 18 Jan 2019 09:02:27 -0800 Message-Id: <20190118170232.16142-4-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090247_806724_F9EFE08A X-CRM114-Status: GOOD ( 13.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add binding document for bluetooth part of RTL8723BS/RTL8723CS Signed-off-by: Vasily Khoruzhick --- .../bindings/net/rtl8723bs-bluetooth.txt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt diff --git a/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt new file mode 100644 index 000000000000..8357f242ae4c --- /dev/null +++ b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt @@ -0,0 +1,35 @@ +RTL8723BS/RTL8723CS Bluetooth +--------------------- + +RTL8723CS/RTL8723CS is WiFi + BT chip. WiFi part is connected over SDIO, while +BT is connected over serial. It speaks H5 protocol with few extra commands +to upload firmware and change module speed. + +Required properties: + + - compatible: should be one of the following: + * "realtek,rtl8723bs-bt" + * "realtek,rtl8723cs-bt" +Optional properties: + + - device-wake-gpios: GPIO specifier, used to wakeup the BT module (active high) + - enable-gpios: GPIO specifier, used to enable the BT module (active high) + - host-wake-gpios: GPIO specifier, used to wakeup the host processor (active high) + - firmware-postfix: firmware postfix to be used for firmware config + - reset-gpios: GPIO specifier, used to reset the BT module (active high) + +Example: + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */ + device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ + host-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + firmware-postfix="pine64"; + }; +}; From patchwork Fri Jan 18 17:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771225 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 BBB946C5 for ; Fri, 18 Jan 2019 17:04:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7FA728702 for ; Fri, 18 Jan 2019 17:04:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A22928923; Fri, 18 Jan 2019 17:04:05 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 47DB028702 for ; Fri, 18 Jan 2019 17:04:05 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ho5B0GFQeTUkiRJOLhE0Nkoe83nYsSYK+WJsXe8VDNY=; b=M70ApUSGltlI+u REQYBQHO0/jeYUdP4WY0LX8xL9zXjDB9KeRVY7SMvcM0s0hOyV5Y8SY59off+YEhy8CjDIWzi8deN 3lcy3AjGF/OWUQI93jjF7BsNxMe7d76xGc34ljmSS8LbW52IvcP8TIFBgEaHSZ9DIAHGjsaN4OQdr kbsGCtUhYJsV+jNkj9VFZaMT5bWADGmnEfexIAZuFc9wo/fxS3AAIkiPI5nmljQJU/nyhtmu1gCss v7LUsZ9h3ZtAdEWLG9eXYZqShE+rN7/lLELyYm2sfjrvZymHu0Gj6Ggv5g2wgAuJNjnmaAscRKGBo WR/UNIURpPHk1IVCiQTA==; 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 1gkXYn-0000ho-RQ; Fri, 18 Jan 2019 17:04:01 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXd-00089A-9h for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:02:53 +0000 Received: by mail-pg1-x543.google.com with SMTP id s198so6339792pgs.2 for ; Fri, 18 Jan 2019 09:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4xR1KYQugEMkmMq57G98vJgznMGv5+b9o//ihdpDFFk=; b=W8VQohhRHylK8qIeIMPsCgeUBkdi246JIFWArzeRK06r73GzduMz7oIZ78WICDUblz e45HrHe+vYK3sW75OWoVPmedz3/n6+Vpn8v4nZqU/sFVuI9JL55JT8KKHjzFcrV7blzz YmbjdI80sMz7GdsWqSWFtE+FtZvRuFkoXVJQuWqsdq21KX7zRMEi0Jlkdfi5KSbiAdZ5 nhSrAzga7K/HUkudnngpKnnNIBDANg9hpGGlO/r1GVzvFyG22T0RcaEjjwgr3xLrU9U0 J8YwgwoqIc8UnCSrfo86OKT6jg1XujU6BZrDQxu3AbIVQ4yw2KHUcRqOokW3vlXJfwnJ LJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xR1KYQugEMkmMq57G98vJgznMGv5+b9o//ihdpDFFk=; b=I0juERu9Itq6lI9wdDkm/WUtXR4tQMPsbMiIG2jrtgOPAo0cvMWZ7c5BvgsKuij3Oq H7DOFlxfIdM0F0R0F3W4lL+GK/cEMr7x97Ew0SjT0D2QaiLSk4VHTA6l7YC7S3urLt4e OGPlu3B7+DJpItPTGjmpSIDWGw98/UfV1/8B8uenI5PGbD0nfWQlHwEJHas7d+Ri0VuG V3Uy5Y4zQG1QkZsaZb2WB99hj67pbh/bzJXmYbCni+B0hZY4HPWwpcP9Q5Bg1jO66P9J LCe8UIibdYM4Zeyk2LPW3h67D/Tt2JwbSPORYkBqo32sIQuXhkKESEUqae33LN5C8V1r dZMQ== X-Gm-Message-State: AJcUukfQQbruVVKTd3LIpCP5TLX6uSEZCN7pePwgQyykEpGAMsSHFy3i IOUdouBszhifFLBGcPhNqjs= X-Google-Smtp-Source: ALg8bN7eKG9Zfd/C08iT/TSsDGBMH2LRelSemvSqKMOphpjky6CTf4WpERgIJdacBkOyODA2ZJbrBQ== X-Received: by 2002:a62:3888:: with SMTP id f130mr19784070pfa.132.1547830968387; Fri, 18 Jan 2019 09:02:48 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:47 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 4/8] Bluetooth: hci_h5: Add support for binding RTL8723BS with device tree Date: Fri, 18 Jan 2019 09:02:28 -0800 Message-Id: <20190118170232.16142-5-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090249_673614_31037680 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP RTL8723BS is often used in ARM boards, so add ability to bind it using device tree. Signed-off-by: Vasily Khoruzhick --- drivers/bluetooth/hci_h5.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 7ead8c3d8657..44f848c02c63 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -823,6 +824,11 @@ static int h5_serdev_probe(struct serdev_device *serdev) if (h5->vnd->acpi_gpio_map) devm_acpi_dev_add_driver_gpios(dev, h5->vnd->acpi_gpio_map); + } else { + h5->vnd = (const struct h5_vnd *) + of_device_get_match_data(&serdev->dev); + of_property_read_string(serdev->dev.of_node, + "firmware-postfix", &h5->id); } h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); @@ -1024,12 +1030,26 @@ static const struct dev_pm_ops h5_serdev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume) }; +static struct h5_vnd rtl8723_of_vnd = { + .setup = h5_btrtl_setup, + .open = h5_btrtl_open, + .close = h5_btrtl_close, +}; + +static const struct of_device_id h5_of_match[] = { + { .compatible = "realtek,rtl8723bs-bt", .data = &rtl8723_of_vnd }, + { .compatible = "realtek,rtl8723cs-bt", .data = &rtl8723_of_vnd }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, h5_of_match); + static struct serdev_device_driver h5_serdev_driver = { .probe = h5_serdev_probe, .remove = h5_serdev_remove, .driver = { .name = "hci_uart_h5", .acpi_match_table = ACPI_PTR(h5_acpi_match), + .of_match_table = of_match_ptr(h5_of_match), .pm = &h5_serdev_pm_ops, }, }; From patchwork Fri Jan 18 17:02:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771231 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 C19211580 for ; Fri, 18 Jan 2019 17:04:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A958E295A7 for ; Fri, 18 Jan 2019 17:04:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CA3D2963B; Fri, 18 Jan 2019 17:04:54 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 E1600295A7 for ; Fri, 18 Jan 2019 17:04:53 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NjPnYWCgH9mrFcRC+qQy0Rd4K/WMQszvjmH39O7K+68=; b=M1by0QPhkp4SSY BB1y3tHenwwYWL2XYoVJjhrQYeqWmmFzD9ujz2FsdRXPgMMxPCOcU2AYF/brhRgSV4AnxHucQzz7a X8oLoykDmLHNgJQBwWnxYHSDZ0VjZc8xmlHuPPkJXJQa9C7gI00Zy7p0vfbQXIy20woe8hwpgECS0 gx4nCIB3dqtYM+NooujlmEnkN2GoDAEx0ejQEQUlymqZRWf7rwINnvEX+gKpjVDtKvXBlw9v1vmlC VIxP/PC/qkif0sLvlbArmoeyt+BdefZsatqXC/iRzh1SYpbyq7RNevnapAomwV0NaHYBFxWbBFgLY drkrldIhAqOfPiOET9Qw==; 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 1gkXZZ-0001SN-LR; Fri, 18 Jan 2019 17:04:49 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXe-0008AA-Ko for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:03:00 +0000 Received: by mail-pg1-x544.google.com with SMTP id y4so6313018pgc.12 for ; Fri, 18 Jan 2019 09:02:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=91feE76UGzLDv98xbf/+M+OrV03hk4NRis+DfIhhRLg=; b=JufQwPGidj+4XeMbT8+fWXrsJiulNiVeTDNoN6qFArmtJ+Qfzp49nlsTEueEKjEows EnWCHul2Jm/LrjgfBD1MvUgpscr6YIdVYW9HtCUAj54Bg4uqkBcrjeL3qEMFfiU/E5jx Aga4z7o6ukg5R7ItlezMnpWBdQpeQ9czzRljtCqVttutHArYmUciuVzooedJmFae8/QY I5GyPZ8nM6GoLiiIXHGsNA/WGI1yhPKyRc0+cN/R9rH1KWd2uL0h27Pru4rjH4XF1aIG cLVDgBv6rLtd4ZHufYVMJ4PQbs9aJLgshkqCwu4p5GADTWZSXa2QipDkc8uNROHoEcM3 tCEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91feE76UGzLDv98xbf/+M+OrV03hk4NRis+DfIhhRLg=; b=bNWwwk5+yAZZzroEuufXDP174C0pnL5qpbq5LGO2UEf5M0zPPoclaOPrgGUPRhmMV/ NlcTBOv8AaSqwGKpu/4eF2BbURneygoRUUORCmKmuajR8tJG78cGxGWEy6i5Yd/xT4cM 4/cocyhXrq8MaIHnRQHzrT4et78hlffEKuU4vja3ME0Wb5UNryMaUr9kDLLC1gXTJ4Sj FMRATHpQ43P/SywJsscve0Vl1p5zSeN9ere9HMZMpS/1Y6lkT45L8RojFmW6BeGMpwB7 +IkEAaU/XGDu4tkWIZetXxP0pcoFT955H5M8pv+ArFnX42jPhQ69402vbjP6w00XL0Ck D4Qg== X-Gm-Message-State: AJcUukeBzZMeFJ0bQVSy2iQQg4BUvEOj3+rK/Pb7FKbdt2CnBIUD0eP5 9+8DTEcS5ByKPE4JmLnLTqU= X-Google-Smtp-Source: ALg8bN7owFLkYnZXsORJdxbBKuTBmya6FYdkPKijjtmFQ09x3WL2v1mqqeh6DmGWWTiGy3H5ybnwnw== X-Received: by 2002:a62:44d8:: with SMTP id m85mr20342180pfi.164.1547830969700; Fri, 18 Jan 2019 09:02:49 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:48 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 5/8] Bluetooth: btrtl: add support for the RTL8723CS Date: Fri, 18 Jan 2019 09:02:29 -0800 Message-Id: <20190118170232.16142-6-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090251_337682_7633083E X-CRM114-Status: GOOD ( 20.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Realtek RTL8723CS is SDIO WiFi chip. It also contains a Bluetooth module which is connected via UART to the host. It shares lmp subversion with 8703B, so Realtek's userspace initialization tool (rtk_hciattach) differentiates varieties of RTL8723CS (CG, VF, XX) with RTL8703B using vendor's command to read chip type. Also this chip declares support for some features it doesn't support so add a quirk to indicate that these features are broken. Signed-off-by: Vasily Khoruzhick --- drivers/bluetooth/btrtl.c | 128 ++++++++++++++++++++++++++++++++++++- drivers/bluetooth/btrtl.h | 12 ++++ drivers/bluetooth/hci_h5.c | 4 ++ 3 files changed, 141 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 41405de27d66..ec51667c4549 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -27,8 +27,12 @@ #define VERSION "0.1" +#define RTL_CHIP_8723CS_CG 3 +#define RTL_CHIP_8723CS_VF 4 +#define RTL_CHIP_8723CS_XX 5 #define RTL_EPATCH_SIGNATURE "Realtech" #define RTL_ROM_LMP_3499 0x3499 +#define RTL_ROM_LMP_8703B 0x8703 #define RTL_ROM_LMP_8723A 0x1200 #define RTL_ROM_LMP_8723B 0x8723 #define RTL_ROM_LMP_8821A 0x8821 @@ -40,6 +44,7 @@ #define IC_MATCH_FL_HCIREV (1 << 1) #define IC_MATCH_FL_HCIVER (1 << 2) #define IC_MATCH_FL_HCIBUS (1 << 3) +#define IC_MATCH_FL_CHIP_TYPE (1 << 4) #define IC_INFO(lmps, hcir) \ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV, \ .lmp_subver = (lmps), \ @@ -51,6 +56,7 @@ struct id_table { __u16 hci_rev; __u8 hci_ver; __u8 hci_bus; + __u8 chip_type; bool config_needed; bool has_rom_version; char *fw_name; @@ -98,6 +104,39 @@ static const struct id_table ic_id_table[] = { .fw_name = "rtl_bt/rtl8723b_fw.bin", .cfg_name = "rtl_bt/rtl8723b_config" }, + /* 8723CS-CG */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_CG, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_cg_config" }, + + /* 8723CS-VF */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_VF, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_vf_config" }, + + /* 8723CS-XX */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_XX, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_xx_config" }, + /* 8723D */ { IC_INFO(RTL_ROM_LMP_8723B, 0xd), .config_needed = true, @@ -154,7 +193,8 @@ static const struct id_table ic_id_table[] = { }; static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev, - u8 hci_ver, u8 hci_bus) + u8 hci_ver, u8 hci_bus, + u8 chip_type) { int i; @@ -171,6 +211,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev, if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) && (ic_id_table[i].hci_bus != hci_bus)) continue; + if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) && + (ic_id_table[i].chip_type != chip_type)) + continue; break; } @@ -232,6 +275,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev, { RTL_ROM_LMP_8723B, 1 }, { RTL_ROM_LMP_8821A, 2 }, { RTL_ROM_LMP_8761A, 3 }, + { RTL_ROM_LMP_8703B, 7 }, { RTL_ROM_LMP_8822B, 8 }, { RTL_ROM_LMP_8723B, 9 }, /* 8723D */ { RTL_ROM_LMP_8821A, 10 }, /* 8821C */ @@ -507,6 +551,48 @@ static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev) return skb; } +static bool rtl_has_chip_type(u16 lmp_subver) +{ + switch (lmp_subver) { + case RTL_ROM_LMP_8703B: + return true; + default: + break; + } + + return false; +} + +static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type) +{ + struct rtl_chip_type_evt *chip_type; + struct sk_buff *skb; + const unsigned char cmd_buf[] = {0x00, 0x94, 0xa0, 0x00, 0xb0}; + + /* Read RTL chip type command */ + skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + rtl_dev_err(hdev, "Read chip type failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + if (skb->len != sizeof(*chip_type)) { + rtl_dev_err(hdev, "RTL chip type event length mismatch"); + kfree_skb(skb); + return -EIO; + } + + chip_type = (struct rtl_chip_type_evt *)skb->data; + rtl_dev_info(hdev, "chip_type status=%x type=%x", + chip_type->status, chip_type->type); + + *type = chip_type->type & 0x0f; + + kfree_skb(skb); + return 0; +} + void btrtl_free(struct btrtl_device_info *btrtl_dev) { kfree(btrtl_dev->fw_data); @@ -523,7 +609,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, struct hci_rp_read_local_version *resp; char cfg_name[40]; u16 hci_rev, lmp_subver; - u8 hci_ver; + u8 hci_ver, chip_type = 0; int ret; btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL); @@ -548,8 +634,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, lmp_subver = le16_to_cpu(resp->lmp_subver); kfree_skb(skb); + if (rtl_has_chip_type(lmp_subver)) { + ret = rtl_read_chip_type(hdev, &chip_type); + if (ret) + goto err_free; + } + btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, - hdev->bus); + hdev->bus, chip_type); if (!btrtl_dev->ic_info) { rtl_dev_err(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x", @@ -618,6 +710,7 @@ int btrtl_download_firmware(struct hci_dev *hdev, case RTL_ROM_LMP_8821A: case RTL_ROM_LMP_8761A: case RTL_ROM_LMP_8822B: + case RTL_ROM_LMP_8703B: return btrtl_setup_rtl8723b(hdev, btrtl_dev); default: rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n"); @@ -636,7 +729,12 @@ int btrtl_setup_realtek(struct hci_dev *hdev) return PTR_ERR(btrtl_dev); ret = btrtl_download_firmware(hdev, btrtl_dev); + if (ret) + goto out_free; + btrtl_apply_quirks(hdev, btrtl_dev); + +out_free: btrtl_free(btrtl_dev); return ret; @@ -751,6 +849,24 @@ int btrtl_get_uart_settings(struct hci_dev *hdev, } EXPORT_SYMBOL_GPL(btrtl_get_uart_settings); +void btrtl_apply_quirks(struct hci_dev *hdev, + struct btrtl_device_info *btrtl_dev) +{ + switch (btrtl_dev->ic_info->lmp_subver) { + case RTL_ROM_LMP_8703B: + /* 8723CS reports two pages for local ext features, + * but it doesn't support any features from page 2 - + * it either responds with garbage or with error status + */ + set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks); + break; + default: + break; + } +} +EXPORT_SYMBOL_GPL(btrtl_apply_quirks); + MODULE_AUTHOR("Daniel Drake "); MODULE_DESCRIPTION("Bluetooth support for Realtek devices ver " VERSION); MODULE_VERSION(VERSION); @@ -760,6 +876,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin"); diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h index f5e36f3993a8..db4e4a1542b7 100644 --- a/drivers/bluetooth/btrtl.h +++ b/drivers/bluetooth/btrtl.h @@ -24,6 +24,11 @@ struct btrtl_device_info; +struct rtl_chip_type_evt { + __u8 status; + __u8 type; +} __packed; + struct rtl_download_cmd { __u8 index; __u8 data[RTL_FRAG_LEN]; @@ -69,6 +74,8 @@ int btrtl_get_uart_settings(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev, unsigned int *controller_baudrate, u32 *device_baudrate, bool *flow_control); +void btrtl_apply_quirks(struct hci_dev *hdev, + struct btrtl_device_info *btrtl_dev); #else @@ -100,6 +107,11 @@ static inline int btrtl_get_uart_settings(struct hci_dev *hdev, bool *flow_control) { return -ENOENT; + +static inline void btrtl_apply_quirks(struct hci_dev *hdev, + struct btrtl_device_info *btrtl_dev) +{ +} } #endif diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 44f848c02c63..ebd84e9d7aed 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -916,6 +916,10 @@ static int h5_btrtl_setup(struct h5 *h5) err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev); /* Give the device some time before the hci-core sends it a reset */ usleep_range(10000, 20000); + if (err) + goto out_free; + + btrtl_apply_quirks(h5->hu->hdev, btrtl_dev); out_free: btrtl_free(btrtl_dev); From patchwork Fri Jan 18 17:02:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771227 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 5845C17FB for ; Fri, 18 Jan 2019 17:04:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45392295A7 for ; Fri, 18 Jan 2019 17:04:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3982E296FA; Fri, 18 Jan 2019 17:04:21 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 DD500295A7 for ; Fri, 18 Jan 2019 17:04:20 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pMiEDjnlBf/+0YF3FxaoeGo0pcL2uxZDOFKBAtDIzZ0=; b=AQYb/qoo0Rw3tP OiN1G0TX/jXDIT4Is4nxkosg7YqwSkNpFHKBoSPXG2V5GPDS/SJCh9nW9IXnWf5ikmePa/8TF3Z4n sWiHolmvTreWjhlA1qFqKRWuGxqxfLnpV1aGZUCOikAoUxcao9odvUOkBiMgU++Qmf/0gXaEVHSXe +dzJ2GFMxEGZKRdzyB0XGCZTBSFDaBled2ssIGu1FcCd8ezDo0u0NKw26Ah4gBDyp2Hw3monJhVyN s7uY2CF3mvKmfbLg1xMzt3z64p2t9z/GmSLV43u10pkFWXzJPrKYaRj8yKHzgVJGw/T9R4M4rtNje /55qUJEqIQFNsheW2akA==; 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 1gkXZ3-0000xV-6G; Fri, 18 Jan 2019 17:04:17 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXf-0008BA-HO for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:02:55 +0000 Received: by mail-pl1-x643.google.com with SMTP id gn14so6598700plb.10 for ; Fri, 18 Jan 2019 09:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LgNmpUZNbudKQwbqSkrJvpGuDLaSJyahqxMxDXFKylA=; b=Pfpt1dQmBQJXMUNgR53emDaiSe047LELt436/GfMUtpuisKukbtTQH0u1w9sEXiywv Eep+vI+gVslOyzUUTP6WvwKlfgxcq0zxrTCy5CTP4d27qwoOeoVkZm+Nwpl6ufadeC5I VhZohwAFYa1CmsXT4ExcPCwq2ABdLO9Rv5k4uVTtOAxgz3AKy5hRWQ7Ztje51urxC0PW dCeTRbjOv3u/nkWlleEwyRK3yaVoV6q1NN8L1aSSpeLd3I2XkpWBhpK1WOk5GNMtTTeu KoBlk9mQ5+rhRzDmugWmy9f+u2fVCj4GppqeS3o3nO3/CNiSTp1LvivS98FffuU8O1dN m2sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LgNmpUZNbudKQwbqSkrJvpGuDLaSJyahqxMxDXFKylA=; b=JZuIhVJ+eSL0QFagUKixiPXlpJYmvZeTGSYJmVCHfZ58YyXN3ZyszAUXhb2KZSQtY4 bd9Lb857tod2jMCW7mtKvL3BNGYeco5FEm2wXm8Jqs9VvmvbtcrqKfzhbxda/WNaTi/k yBZFs9nhCGRorHyPGuYssw+ycfN6GgimV+wN2vIK3jVcnOw58bHzFEi9NfacM0bqZK+G UpS6CUSxnhqAdxUaPX7B8Q0zFMbFMpfva+6DALsOmTbPzyFGB9Ke2cJ4n5EIjd+7WhyF h2bA531NkbS2IwYnrSKNyBWB6CPOIX7OnYNCXOHc1oUAupD9Ap5iqFMUrRStbwWM8HPu Sk0g== X-Gm-Message-State: AJcUukdElz3fkejb4e0zUd9JO3gJsg99VEb5wAtpOsJ+PikRNZdgjMyX WjKGfDOUKHDLR5Fdja222aA= X-Google-Smtp-Source: ALg8bN6kUKgnGRWhF24o8hn5zCzZpIYRKHBoqNOOBq2Gs5dDMB3b/y5oa634RNCtCF32/+SpyIfI3A== X-Received: by 2002:a17:902:e012:: with SMTP id ca18mr19815227plb.218.1547830970874; Fri, 18 Jan 2019 09:02:50 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:50 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 6/8] arm64: allwinner: a64: enable Bluetooth On Pinebook Date: Fri, 18 Jan 2019 09:02:30 -0800 Message-Id: <20190118170232.16142-7-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090251_875264_E7A794CF X-CRM114-Status: GOOD ( 12.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Pinebook has an RTL8723CS WiFi + BT chip, BT is connected to UART1 and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO the I2C controlling signals are connected to R_I2C bus. Enable it in the device tree. Signed-off-by: Vasily Khoruzhick --- .../boot/dts/allwinner/sun50i-a64-pinebook.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts index d22736a62481..8fc55dfa7034 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts @@ -340,6 +340,20 @@ status = "okay"; }; +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723cs-bt"; + reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */ + device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */ + host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + firmware-postfix = "pinebook"; + }; +}; + &usb_otg { dr_mode = "host"; }; From patchwork Fri Jan 18 17:02:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771233 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 79D651580 for ; Fri, 18 Jan 2019 17:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66076295A7 for ; Fri, 18 Jan 2019 17:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5983129869; Fri, 18 Jan 2019 17:05:14 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 F134B295A7 for ; Fri, 18 Jan 2019 17:05:13 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AnPSmJ+QD3kqFPAYiRMj8JAPCD3zcbtIoTuoQYgntXk=; b=q+jyJmkHBr4l0F OshECehEyCNpgGo6xejo66kzcTrHHhrlFbqMolEJzEYPhQArHdR5TzEoiukzk7Ig/XYWtZPOkaQTd 3EMGcS9R/gUv+cyQTlppj4JbiIXmda7VGmMMY1/Qni4KLu4vNpoysHXABU7glQ1dIRt80F5madW+W RW244LWgPWsW5KCrwaODJ3kjPrQbuK4RfQwKqIRhG7fBYj0Mp44Qk5j/26wJAhlEoZf7Gyu4yV6V0 Y5uORgtNIe1Szhsfn7R3ck7tEIFwAlZvw2ervVFHGzd73eD7AFGzG+kQDADcDXnmvtRJ5JD04BuNN dnMZSy0MgN4tfa3WRgYg==; 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 1gkXZv-000289-Vy; Fri, 18 Jan 2019 17:05:12 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXg-0008Cb-Qc for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:03:00 +0000 Received: by mail-pg1-x541.google.com with SMTP id w7so6308764pgp.13 for ; Fri, 18 Jan 2019 09:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UMvz14KsDb0PYMBq3+E2kRoJCqEy6k0e06L9ePq+UfA=; b=ftqIRO/X/6mzz1he8iRS6VADySG/xrTgENEVo+bxqpOeBDi+0tTPC1II0ZpFXstAu0 oKvalFBRf6QPyf8UvcB3wIbjDVvQ7Fsrlkbsiv+LBiGdHkbANXaxxVccLVk6NAkPHtvw GwEPPSy4Xu++rppn4Q3+B5J4OJ2wAgGwnw8FN0z0IgRYUHWZMCm/5T2HvVUk5cn5RIl4 kSnwQQ45Pyl8bpFFnvweymF47YaIM/L76reqUY5Y+xDlRrFOGqqkpbYmsI9oSSFjobZy J1J88G7Da8e262SKonZpMQq0UsVKXxFe6ZpMlwa5+PwjYa/yN5TW9mF7IQ+74vJ9FK61 cFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UMvz14KsDb0PYMBq3+E2kRoJCqEy6k0e06L9ePq+UfA=; b=Ou0/51J5N/5llSag1ROch4JJWLFWc+vXCkuLfZIV/htNC/hMpVbl7bTlE2FePcORLm xv02BMWX0/Ekb2MKVE+lE5ETzrd1nvNnkRd54aGwj5TNDfW1NDHfm0Fr9vL7Kf74H9n3 /oS29i0QH2rE6AzISUlnCv49RCrfAtmm34fUhmGVhNh5lv8mGtZYg/mxHK93RFhsBXLY A1CpFoWyEZcEN9+1UCkAmMTRpsCDPTCZoSXFlmJHDxEm+h2vZrFmnLPZG15RRPKMw0kr mQMLPqYu6GSPW/W0yG1gjOCB9HcE4dCN2XG5C3D15ZhIwrP0uNS24Ed2p9yNNha+SJpc xblw== X-Gm-Message-State: AJcUukce82THUs1Ak1GMpm6ug4JzpwBFucYTF8O3JBZdsAy+WOfAqwol NXQVIK/YdBXACVh0+FS/3lA= X-Google-Smtp-Source: ALg8bN5hUwzZesH5VdBnEDelmV183k6F7bwp74T/wOB1HhQXIVzVGCHABPyZhMDnuYMTeOOaB2enfQ== X-Received: by 2002:a63:5f89:: with SMTP id t131mr18696033pgb.26.1547830972161; Fri, 18 Jan 2019 09:02:52 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:51 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 7/8] DO-NOT-MERGE: arm64: allwinner: a64: enable Bluetooth On Pine64 Date: Fri, 18 Jan 2019 09:02:31 -0800 Message-Id: <20190118170232.16142-8-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090253_281350_A4844E08 X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Pine64 has optional RTL8723BS WiFi + BT module, BT is connected to UART1 and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO the I2C controlling signals are connected to R_I2C bus. Enable it in the device tree. Signed-off-by: Vasily Khoruzhick --- arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts index 216f2f5db5ef..4d48aa31d420 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts @@ -302,7 +302,15 @@ &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; - status = "disabled"; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */ + device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ + host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + firmware-postfix = "pine64"; + }; }; /* On Pi-2 connector */ From patchwork Fri Jan 18 17:02:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10771229 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 7CB9D1580 for ; Fri, 18 Jan 2019 17:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69C09295D6 for ; Fri, 18 Jan 2019 17:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DD46296FA; Fri, 18 Jan 2019 17:04: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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 EF670295D6 for ; Fri, 18 Jan 2019 17:04:40 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6p666/INlzOgOONn0UTVDbQZiFBpe31i8zRvcor8+GE=; b=PlAc9np1Ru8ZKI MXn6pspqsnvU4HTUxaL0/S15pcFWDNw0B9OvsHILXdA0Vv/HiqXXpO8JQtbJGINibe0CEXrNvGL5M 7lVNT7MiyZK2s7V3qsJnLiWUKgVigi+CcV83bvbDVjQ+JtQlFY7zbQ1ImbxcOAisCejhjiOwz4NAA 0QDeZ9BZfzwXwZruQs3//zLxVMFFFY9NoHDW5vOYP5aKgfsAkqwIWygiHn6F87uvGYcPlWZ3e5hNa Uwyt8pkzfyIpyEm03YurTBvCC2gglu7Ej2lHPGLQpj3vr0PqH+lk9Qzfe1tsb1ja4Jl3Qmocu8tcO nEF3i934aCwSttKwc0yg==; 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 1gkXZK-0001E2-Pl; Fri, 18 Jan 2019 17:04:34 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkXXh-0008Dh-RV for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 17:03:00 +0000 Received: by mail-pl1-x644.google.com with SMTP id t13so6593417ply.13 for ; Fri, 18 Jan 2019 09:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZcE0++5u/bnDO9bvoYpUsbiaOU0sb4V9OQ0+PXHgS5E=; b=mE2s9Fi4sTMYiU1QXLckdLLFVjTB+qtcWoGKiDN2/mjUnPrMyJ4k64vtBj2rKcUU6O In4qg1yIauYZ3u/2jaER+vstVOdaR64r2TQz63tV4b9xq4+0kR1mbsuAHrYt1PpZpXzq oga9PX/ZfZSxZJA+a5kXvZmzoIS8wZ3RJv9taxrP8MD0s2iWRIUEHq51q2Lz//kxELtb 1A6IRRJSJ+rXxq/G1ZsW2VuYUudyvnOJNrs63P6uxAX7xGWcpfk8hBvVoqsSJ4e2LlDX 1WOem+WVtD1FxWVs4KMe3xsMv6DNVP/T7H/lZ+xu73yMTOvd1rT1S2/qkYcVSK506eFE JABg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZcE0++5u/bnDO9bvoYpUsbiaOU0sb4V9OQ0+PXHgS5E=; b=FL19QjNHSDaqIawQpQLwU5m135KTuKMK3AHRdo7hYngsg2LS12Z1w3K0RVNreWB2NH eboXTjn+Mk6PbSraFTTGe1nq9ila8qFSKeOtgMBvY0JA6fTRTTm5mHY4Q2T79zYBAG1G vEySyvRi8YpxAmE3U9KOLBAKgXOwYX8UE53dEsKxsHkgcse+KL25rkj0hLppeQPUJZAy uUsaLYLBB4rFv8perjxNCKQjlB1ZkSLU0GHud+CGgMrEhLcjrVEbUjhzREMlCsJ3tonQ VDY1f2yvmfg76Wn4CDpfa4HBmhz9MhHpl+Ye1np2nsheUw5Jce7+wGXjLC0CHTdgK3yz yyuA== X-Gm-Message-State: AJcUukcIsYN/nSByvS7RJSSe+E70zdAUuZiyyHXT7RtYbvXLy1Llf/kB CMt+M1QMtdA0GSwMr+Zj8Go= X-Google-Smtp-Source: ALg8bN67v456utGVLWiqi+aDYttYUprlBywzYI0OUggA5xoUZQRpdBWeIlXY8gcLLbH3xV9LWXo1SA== X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr20153695plb.182.1547830973155; Fri, 18 Jan 2019 09:02:53 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id b4sm5672222pgq.65.2019.01.18.09.02.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:02:52 -0800 (PST) From: Vasily Khoruzhick To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , Vasily Khoruzhick , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 8/8] DO-NOT-MERGE: arm64: allwinner: a64: enable Bluetooth On SoPine baseboard Date: Fri, 18 Jan 2019 09:02:32 -0800 Message-Id: <20190118170232.16142-9-anarsoul@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com> References: <20190118170232.16142-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_090254_518275_5524C5CA X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP SoPine has optional RTL8723BS WiFi + BT module, BT is connected to UART1 and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO the I2C controlling signals are connected to R_I2C bus. Enable it in the device tree. Signed-off-by: Vasily Khoruzhick --- .../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts index e6fb9683f213..691ffad390c6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts @@ -204,6 +204,20 @@ status = "okay"; }; +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */ + device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ + host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + firmware-postfix = "pine64"; + }; +}; + &usb_otg { dr_mode = "host"; status = "okay";