Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1445260ybx; Tue, 5 Nov 2019 16:30:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzWhZSRHPP5I5G/FhkqQU0KvgzUm7qYzC9vvBV1YeXIGzQ7IhoQ9EDZPqjiYbCmWPZAh4Wr X-Received: by 2002:a50:b5e3:: with SMTP id a90mr38079538ede.201.1573000242047; Tue, 05 Nov 2019 16:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573000242; cv=none; d=google.com; s=arc-20160816; b=LLVyXK/FDO4sMk6yzdLVPPjHUOvR0vyIVDqVC92ozkNXnIJeP0sC3cEhdZz/MnqZaF zYkSisCnEEv+xCx1earANSg7oGmRwanLoKK1DQmM1cLId/yJLCP20hlr5rs1/KVxgQWT Oa6/+MPwcgaBSa5pgIKiIUtjolvzgQUMLrojcnEaGY7JjtMAYeGOZT8mxSbIfeutUWBF dsBCITJBn3Evsm8jvP7Fp+hYjCxV47B622b58pyc2+gAzbsix1lladU5/uOOuWmyW5DG eoppt6XW8qICygvSpC54UuizDmc38lE986SjY//KjjYryq8OCXA3U0b66GOueHNmxymo pYVA== 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 :dkim-signature; bh=4zYk3XP3GGf3YpNueJW4AQrSmZBF3wxROTnECKWVGaY=; b=EO/iZ6npYWgKxRjfRruc8xCruABDvZJbpjRFgsKIVP3BgdS8CuIbWVET5D+kgSmU5D /0OHc/vcfNRFLxdQED32IiWsRg0dwCvnuDVU0IHXxv3S/u/ENevEOdn7gQBm336cFRqu fpoq84sVygu/rv/6RrqerE14fXGHGPufq3edEFvBauA6FJVt3Dyj7NliG1HRdFzTMfBW aEffxRrMQ/I5l3jmVxRDj+VvhKC3vYqrozjkLkEloro5QpjMwLC9/f/RaVTB34QIBZZL MyMibQeDqAUSKwpc9QU6QcJSx4WagYAhhR1+TxHBPxrQFfLKihyyzq0F+cEpRt+qTgGc UXhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="QmB6b/fq"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e58si10953214eda.7.2019.11.05.16.30.15; Tue, 05 Nov 2019 16:30:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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=@chromium.org header.s=google header.b="QmB6b/fq"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730531AbfKFAaG (ORCPT + 99 others); Tue, 5 Nov 2019 19:30:06 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36023 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbfKFAaG (ORCPT ); Tue, 5 Nov 2019 19:30:06 -0500 Received: by mail-pf1-f194.google.com with SMTP id v19so17418244pfm.3 for ; Tue, 05 Nov 2019 16:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4zYk3XP3GGf3YpNueJW4AQrSmZBF3wxROTnECKWVGaY=; b=QmB6b/fqcXz2xNFmhf4Vlx/ti+A4QZZU7YV9hVZ1HyG9XFI1Q89+nvE6AevubkTXgw jgxo9qs20yz9L6REBpahqqd0JM+YXmqQA4tDxdEMorPYQcOZZzsYpGxB0bWtWrOOY7iw yTSQaqezG1heGd1bilnh8gWtynkigGbDe5s3I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4zYk3XP3GGf3YpNueJW4AQrSmZBF3wxROTnECKWVGaY=; b=MpOFRnTI3GfyuGq6oyFJl79boFp3cNDjRVzpFVe2AIbfuxechlS5cbWlkcnUS+QxmA pllcg9JXwEJZm0s0jV6kd8uF4c2q5LwQGJVVfBGadfZRK6gwzxKXBQrolJYbSdZC0lH8 m4V9NyyE8vuLGxa7v8VQF/Hx2bPmOMqBjyPdCjrU8U0S6h3Wfu36Sy+JfP9A3N78T7sP Gc11211bDdHcTWv98WR3Nc3SFiAihFlduXRvGOueOhwZQp1lUJpT5SfYK8Q1WVcBl8Zt aJdzrCVBMKiDy/VI88V7kf/0Jvl/e1OmPlSmAuPGmzOd8MGgw/9Qv9fwmiJK6KNLgsMz jLwg== X-Gm-Message-State: APjAAAWS+/+XHhsY+lCwINrBpLjB5prhlttlUessEtqOIcCRvWymtG4T T0hGOaHBwfiglxPpYDY4ut/H4A== X-Received: by 2002:a63:745:: with SMTP id 66mr5168633pgh.389.1573000205454; Tue, 05 Nov 2019 16:30:05 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id k9sm21032835pfk.72.2019.11.05.16.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 16:30:05 -0800 (PST) From: Abhishek Pandit-Subedi To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] Bluetooth: hci_bcm: Disallow set_baudrate for BCM4354 Date: Tue, 5 Nov 2019 16:29:20 -0800 Message-Id: <20191106002923.109344-2-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191106002923.109344-1-abhishekpandit@chromium.org> References: <20191106002923.109344-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Without updating the patchram, the BCM4354 does not support a higher operating speed. The normal bcm_setup follows the correct order (init_speed, patchram and then oper_speed) but the serdev driver will set the operating speed before calling the hu->setup function. Thus, for the BCM4354, disallow setting the operating speed before patchram. Signed-off-by: Abhishek Pandit-Subedi --- drivers/bluetooth/hci_bcm.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 0f851c0dde7f..4fe66e52927d 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -1167,7 +1167,7 @@ static int bcm_remove(struct platform_device *pdev) return 0; } -static const struct hci_uart_proto bcm_proto = { +static struct hci_uart_proto bcm_proto = { .id = HCI_UART_BCM, .name = "Broadcom", .manufacturer = 15, @@ -1371,6 +1371,22 @@ static struct platform_driver bcm_driver = { }, }; +static int bcm_check_disallow_set_baudrate(struct serdev_device *serdev) +{ + const char *compatible = of_get_property(serdev->dev.of_node, + "compatible", NULL); + + if (compatible) { + /* BCM4354 can't run at full speed before patchram. Disallow + * externally setting operating speed. + */ + if (!strcmp(compatible, "brcm,bcm43540-bt")) + return 1; + } + + return 0; +} + static int bcm_serdev_probe(struct serdev_device *serdev) { struct bcm_device *bcmdev; @@ -1408,6 +1424,9 @@ static int bcm_serdev_probe(struct serdev_device *serdev) if (err) dev_err(&serdev->dev, "Failed to power down\n"); + if (bcm_check_disallow_set_baudrate(serdev)) + bcm_proto.set_baudrate = NULL; + return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto); } -- 2.24.0.rc1.363.gb1bccd3e3d-goog