From patchwork Thu Nov 15 09:35:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10684011 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 8464A14BA for ; Thu, 15 Nov 2018 09:38:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 733A52C16E for ; Thu, 15 Nov 2018 09:38:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 676CC2C17B; Thu, 15 Nov 2018 09:38:10 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 AAC2C2C186 for ; Thu, 15 Nov 2018 09:38:08 +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:References:In-Reply-To: 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: List-Owner; bh=ZyJtsvuMk5hmNPAKDOEjeta/hXR6dX8Kf6F0rgts39c=; b=GA9ze1PlxSXv73 6sM2iLkp2KzhTKOAeSD98DOkx4oY/QqSVDUldHcfoR7MZkt09nvP++n48OsrM+scPRb2B6RvXSvpw vRNdf5sILKlNVwoNkzhKzuOeObUBTTCRfjjEZqMhj+t/3cjBYOKs7MifvHMvfSNkb/olctWaf549d 6noofJCf5jH76B8Pj9PRRx/g0e8SdEgASkbuFxuboX0LHUiXvCpnGrMVHVJQSnZjJevIoklst+l/U QULrjB2jnl3u9z61I8cR4YLlTmCwlpL02/KDBDXSedXUXCcyGZh9jITodVNk6hf0lVM+UhVmmkK9c L5RKL051jaRwEP13sNxg==; 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 1gNE63-0002el-Dl; Thu, 15 Nov 2018 09:37:59 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNE4n-0001R7-Er for linux-arm-kernel@bombadil.infradead.org; Thu, 15 Nov 2018 09:36:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2YQX7B6EQHYtN2WAMOOE4I1BTB+Uf7YQu1Q+8MJwJTg=; b=ldNOxy8dRZfEQBjalPGi4s1PGY Yqvr89/tRHBaTFJ/B63Iq+u2A8bOz57L2/WNkBz/NB/RYqLQvVX/lbftaspSB4lFf1XqZENkLEXoA CKXPMTCDVJI44tLywh7C/uNqF/t6BM7aFxbxQFdCw5iiQXBRE5C2QkYDatV5b295PpjpEuMxl1uOv Em+//9dQQ6HCVyXmO5M9O4nOwIEwjMOiCRcwYPbvWnl94c9oaA/dHPDjjfpiOCqFN37u4b9r1l3f3 lhVIgcVsPYP05YjyW/JRz4KEsif2jqdspSSGwHWfGOgT04qrWvCTfvl1isoEbb06Ufe3r135x8E3W ochqMgzw==; Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNE4k-0000jf-L6 for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2018 09:36:39 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id E69A85FDAF; Thu, 15 Nov 2018 17:36:04 +0800 (CST) From: Chen-Yu Tsai To: Marcel Holtmann , Johan Hedberg , Rob Herring , Mark Rutland , Maxime Ripard Subject: [PATCH v2 10/15] Bluetooth: hci_bcm: Wait for device to come out of reset after power on Date: Thu, 15 Nov 2018 17:35:58 +0800 Message-Id: <20181115093603.26729-11-wens@csie.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115093603.26729-1-wens@csie.org> References: <20181115093603.26729-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181115_043638_952888_326F238D X-CRM114-Status: GOOD ( 13.23 ) 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: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Chen-Yu Tsai , Loic Poulain , linux-arm-kernel@lists.infradead.org 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 datasheets for BCM20702 and BCM43438 both have power up time sequence graphs, however they are slightly different. Both chips also have an internal power-on-reset, which holds the chip in reset for a short time after the regulators are enabled. For the BCM20702, the time period from when the regulators are enabled, until the chip settles and comes out of sleep state, is 6564 ~ 8171 us. For the BCM43438, the graph only shows the time period from when the regulators are enabled until the chip responds by driving the host's CTS line low, assuming the host has already driven its RTS line low. This is shown to be 6.5 sleep cycles, with the sleep clock at 32.768 kHz. This is around 2 ms. Wait a full 10 ms after the regulators are enabled to account for signal rising times. Signed-off-by: Chen-Yu Tsai --- drivers/bluetooth/hci_bcm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index f2101038284e..538ce8059bff 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -256,6 +256,9 @@ static int bcm_gpio_set_power(struct bcm_device *dev, bool powered) regulator_bulk_disable(BCM_NUM_SUPPLIES, dev->supplies); } + /* wait for device to power on and come out of reset */ + usleep_range(10000, 20000); + dev->res_enabled = powered; return 0;