Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3905793ima; Mon, 4 Feb 2019 07:09:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IbhKM9+mkWa5e7Emxe+UGOS6QcdL6Pr4lkMjjnncuxswrcG5gC0uSSSVfMIMQzjBRGiNo4S X-Received: by 2002:a63:c051:: with SMTP id z17mr13092936pgi.20.1549292960922; Mon, 04 Feb 2019 07:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549292960; cv=none; d=google.com; s=arc-20160816; b=yUqs9rV26XyW41egmM1/fSajfKwcNHs7CmHAkLVB7RtePX2oo6NwHW1nuNyIv4ClTG VYZBxnvCEny6Z5jVHVU917O9Mz/pb2H3RqymW37xY48M9BDzDj0bBCTK2XSwzYXpv6/m 6tbV0ptxWrR4OOJgYrk8L0aDFKvIMbHfmGYg72+NKScL5VKY3iks4ygyevX3I3jX9kIo d1SqklQyrKVCn9Te1NmPi0gx6Oq7kC0VdPrvHurpwt+Px/9rjC9M58SlLkI+ft5ls/uk mgfnC8uxRjc9eYXHEi9WbH0r/AeP1USQaC/OTHabdDBwmpPq2Ee/1OCGYAT2wrpmNa6D pcZg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=pNK6ydFKGqbi9MVJaOxQYII0CFzD4R8bYE7e3M10L4s=; b=VXDkNyDBSn1ZyIBMc/iN5wFvkoPQrS8qisAveiTzW82pN/QUNjnQl1Hi/QFMifR5km Wmojrpv5kC9EH2ffm2Q2ZicqX1YSoubbjFlBeKzgpWVOvl7fQEeCdb5taeH3SpoMaQRT SiLKc0AkR0LElOS1+FfWh+phpYUT1BRfkUkdg7kJZ1urDV1xBscVq3Z1kbAr9S92DEiI Ehbn9SMaBOouGo1Goj6HSFV7TTnICQagYvSqwgJcqBI1fApS3ZpyLyEjR5nplaDdLC+y BkCY+DUWpz2btBT0BFrdUGRgN/b/0Sax7oG3k/MSx4Uj3unV9FsCX/RblBsINgPAcIpH DuNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZQcggmn3; dkim=pass header.i=@codeaurora.org header.s=default header.b=Sxq6GNqe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si220150pll.221.2019.02.04.07.08.54; Mon, 04 Feb 2019 07:09:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZQcggmn3; dkim=pass header.i=@codeaurora.org header.s=default header.b=Sxq6GNqe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731089AbfBDPHG (ORCPT + 99 others); Mon, 4 Feb 2019 10:07:06 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:38842 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbfBDPHE (ORCPT ); Mon, 4 Feb 2019 10:07:04 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6E3526090B; Mon, 4 Feb 2019 15:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1549292823; bh=gBAjWmb5wZi7IM+pLlmP740rWD4a0iAgMw9l28gY5BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQcggmn3j0Fznstk3R9G6Ab2/FnrSkqhfh564XioFEmwfO3DSV05atVeRxUzLNPA/ 465HwuAwYwYwH5fCRwaClI0QUZPCRLEqEgmmH/9j5Bj8h/kPxtViIBxqUIDMkFOaaR HckwT9w9rD+vSFO2kbM1pU4yK6usaj0BHM5Fkdeo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from bgodavar-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bgodavar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DA006608CE; Mon, 4 Feb 2019 15:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1549292822; bh=gBAjWmb5wZi7IM+pLlmP740rWD4a0iAgMw9l28gY5BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sxq6GNqeWsT8oZEHbI6mCXfe8Z2AOnnTGYZXcwI86LlPO12yL1uDLhq29/Cw3IxJE wEBsT65S3WrFgS+Wk8U014xHs4EPLVzjxorp+q9ifjfp6M8XJSahgXToGrmWtlrhKL 52DBD0Lh2uFwJTQ3COyprAvobYhCi88xNK7BTLxg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DA006608CE 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=bgodavar@codeaurora.org From: Balakrishna Godavarthi To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, Balakrishna Godavarthi Subject: [PATCH v11 2/3] Bluetooth: hci_qca: Deassert RTS while baudrate change command Date: Mon, 4 Feb 2019 20:36:42 +0530 Message-Id: <20190204150643.25165-3-bgodavar@codeaurora.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190204150643.25165-1-bgodavar@codeaurora.org> References: <20190204150643.25165-1-bgodavar@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch will help to stop frame reassembly errors while changing the baudrate. This is because host send a change baudrate request command to the chip with 115200 bps, Whereas chip will change their UART clocks to the enable for new baudrate and sends the response for the change request command with newer baudrate, On host side we are still operating in 115200 bps which results of reading garbage data. Here we are pulling RTS line, so that chip we will wait to send data to host until host change its baudrate. Signed-off-by: Balakrishna Godavarthi Tested-by: Matthias Kaehlcke Reviewed-by: Matthias Kaehlcke --- Changes in v10: Enabled flow control back when the baudarte change request fails. --- drivers/bluetooth/hci_qca.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 9a1c0a71b460..e3cf0dbfc89d 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -964,7 +964,6 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) struct hci_uart *hu = hci_get_drvdata(hdev); struct qca_data *qca = hu->priv; struct sk_buff *skb; - struct qca_serdev *qcadev; u8 cmd[] = { 0x01, 0x48, 0xFC, 0x01, 0x00 }; if (baudrate > QCA_BAUDRATE_3200000) @@ -978,13 +977,6 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) return -ENOMEM; } - /* Disabling hardware flow control is mandatory while - * sending change baudrate request to wcn3990 SoC. - */ - qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type == QCA_WCN3990) - hci_uart_set_flow_control(hu, true); - /* Assign commands to change baudrate and packet type. */ skb_put_data(skb, cmd, sizeof(cmd)); hci_skb_pkt_type(skb) = HCI_COMMAND_PKT; @@ -1000,9 +992,6 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS)); set_current_state(TASK_RUNNING); - if (qcadev->btsoc_type == QCA_WCN3990) - hci_uart_set_flow_control(hu, false); - return 0; } @@ -1089,7 +1078,8 @@ static int qca_check_speeds(struct hci_uart *hu) static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) { unsigned int speed, qca_baudrate; - int ret; + struct qca_serdev *qcadev; + int ret = 0; if (speed_type == QCA_INIT_SPEED) { speed = qca_get_speed(hu, QCA_INIT_SPEED); @@ -1100,16 +1090,27 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) if (!speed) return 0; + /* Disable flow control for wcn3990 to deassert RTS while + * changing the baudrate of chip and host. + */ + qcadev = serdev_device_get_drvdata(hu->serdev); + if (qcadev->btsoc_type == QCA_WCN3990) + hci_uart_set_flow_control(hu, true); + qca_baudrate = qca_get_baudrate_value(speed); bt_dev_dbg(hu->hdev, "Set UART speed to %d", speed); ret = qca_set_baudrate(hu->hdev, qca_baudrate); if (ret) - return ret; + goto error; host_set_baudrate(hu, speed); + +error: + if (qcadev->btsoc_type == QCA_WCN3990) + hci_uart_set_flow_control(hu, false); } - return 0; + return ret; } static int qca_wcn3990_init(struct hci_uart *hu) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project