Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2657892pxa; Mon, 17 Aug 2020 15:44:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2hqq54addCsXLprv+F+XEZplx0FY1Xm41awIV24jiNoLQe9QfPDz9NId6/3mZO/MHhRUM X-Received: by 2002:a17:906:551:: with SMTP id k17mr17118788eja.322.1597704261898; Mon, 17 Aug 2020 15:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704261; cv=none; d=google.com; s=arc-20160816; b=BdyiNMHq6qChLQ0BFvQhdo4nzwD67qUcOp9LQ7qUj1mTf9D4bPxgjPw1xtOLk43Rri Nun5JejEuqOTY9tVXw8Pam7RdRdt4tUw0ZygMrohRAtsqYCCjC/9RJjBCdBwHJ1/mVDN sb9t5Zv4biLxKGv3X0cF/PPFil2If+QP0jCIwnd/a7AJ+Ut/H1H9Wilj9P4RxBNuVrqN ZVBw+PK9z4D/ZBHqsG5oexOaMk18DgNaqpy/k701F4++7x/eMilHIKIrgUrRDAm2i9vK gdDlzjuu+NdZV86zJqe+6wetv3rsFnJSZJPR7e2F23msOOfc7IjVNzOT2+vPZb0iUh2f ThRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ahu391Vg+DIoO87z4DWVc9hFNHGTL2+yfv29QFytuWg=; b=HfEfGhtbUPLIFFYNpDUs0XlKpZBHl0zY8qE08kr8LTSIYnXXVvjQ+cM2kSrwrsoECU CTLC2HLXpnnndRBBkWuzBfI1GQifwx5TgEMd21NnN6vCrVaOMRbWjCP7qTI56lW5x4oh GlWL0V+TyiTrbIpU1RHRvWHE9DXT6auYvvNXzPqbgKHrGCI0TgIbZWZbhnRlZRgfL8b2 ydprS9vnwZFbnDYj9mFVlt2ORIKzrsPZu3WXChQLzQS3yx2FrLBJd0IgyvF75NXfCb2N hOMB3UPhO0Z/5yIeJ90uPd0ruxqabA7vXNzR3bgiTlBOngZTY2jcOa/zesPxNNACDzKB 6+2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MEGWAseO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si12349556ejx.56.2020.08.17.15.43.58; Mon, 17 Aug 2020 15:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MEGWAseO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731772AbgHQTBc (ORCPT + 99 others); Mon, 17 Aug 2020 15:01:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:59194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730272AbgHQPro (ORCPT ); Mon, 17 Aug 2020 11:47:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEA7E20789; Mon, 17 Aug 2020 15:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679263; bh=Wxm+dQv1e/7S1fyu4VC3ugX/kDSnqeoQZQzm/VmVwXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MEGWAseOMH0LWg7NJWzmP1RBVWtey5Rcr/taMENO/hCDJfzU6yQmq+3hOPiEsTmeX 1RSSTU6uvh6n7x0a7rejkSDYCmviBHA3kHhoxuMu5WTtXjWgoSeRJrvLBNNWSa/1UG 1MjanwfZ9CsA3xBSCqwjA8tFSOFtPo1ejJRvPoFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Chen , Sean Wang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.7 150/393] Bluetooth: btusb: fix up firmware download sequence Date: Mon, 17 Aug 2020 17:13:20 +0200 Message-Id: <20200817143826.890504707@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang [ Upstream commit f645125711c80f9651e4a57403d799070c6ad13b ] Data RAM on the device have to be powered on before starting to download the firmware. Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices") Co-developed-by: Mark Chen Signed-off-by: Mark Chen Signed-off-by: Sean Wang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3d9313c746f39..4085387f13cfb 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2826,7 +2826,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) const u8 *fw_ptr; size_t fw_size; int err, dlen; - u8 flag; + u8 flag, param; err = request_firmware(&fw, fwname, &hdev->dev); if (err < 0) { @@ -2834,6 +2834,20 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) return err; } + /* Power on data RAM the firmware relies on. */ + param = 1; + wmt_params.op = BTMTK_WMT_FUNC_CTRL; + wmt_params.flag = 3; + wmt_params.dlen = sizeof(param); + wmt_params.data = ¶m; + wmt_params.status = NULL; + + err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); + if (err < 0) { + bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); + return err; + } + fw_ptr = fw->data; fw_size = fw->size; -- 2.25.1