Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3211684ybc; Mon, 18 Nov 2019 11:22:23 -0800 (PST) X-Google-Smtp-Source: APXvYqw3LrtavhYm6uJn35UmKYZkNo36RCUcz5D5dfsS2ejZwFvgyKccbdg4rDagClpkfT5gBmSd X-Received: by 2002:a17:906:5e52:: with SMTP id b18mr28353061eju.318.1574104943598; Mon, 18 Nov 2019 11:22:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574104943; cv=none; d=google.com; s=arc-20160816; b=MYplFGVSHbp8WMyGGfKam4ZC1/pSzWP17qJADq6HGTfdLaQtnZurog19B8t6jYEcbE DvW91n0+NutPSyRklZyGcWt+wKYCDAYqz4M56yheS8S8NE1Pab04b1mFpDxk/DffDXoI 9T0Grtnav/Y0N39YMjmDk5jYlRB9rkAItM89s5vwuGK5ONMk3KcjYwdi/5bi5nq3bkbj lZmcCUZKuLOeUs17GNjXVHp8GLOoqnvuqmRnMinkwSPFeT1NSE/eoqupzWtxEDyi9XTI w1K2z5FQ1xQJwJvX/wi2Lw18QcIcij2bWAa5QPvodiDo0a/xuRCeJRgSXc5iwEGYn2Lw oiTA== 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=DzisFq8fux9k/N21kQN1ZtrgwBNPbrVsn1ch8Jq5ueE=; b=bKz/iP2Js6LIyQnOXdpuPyEWcPS95Ax1XbH9tljS227DPOgIseOiHXT8IaPULhqu3q MF55NvwfU0PSPhPiD4YbION49bD8UHvmOdnEP3Ut2j9S2n0QPEt3kXNGuRgz31WddaqP gxieAKfqU4OOY6CKBAD/gB1tLy8SLfeEVjiYUsPQIypb5ptPWyPj/0hpIl7Tw6xJx5f+ bSHAHY6pFMEsfewIFIqTgJoJqxYCWePt7N2o7vHaNEv3zNiKXj6FXNfCtFpJSBodR2Rk dc1cblo10xjH8rvDtWKaXP3PWYJOyOGG6XY5Maluc/G4gpEmCsANoHE2cQEsjOz23ZNF QbKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="ausrL/bo"; 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 j23si12160122eja.393.2019.11.18.11.21.55; Mon, 18 Nov 2019 11:22:23 -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="ausrL/bo"; 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 S1726912AbfKRTVi (ORCPT + 99 others); Mon, 18 Nov 2019 14:21:38 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:46909 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbfKRTVh (ORCPT ); Mon, 18 Nov 2019 14:21:37 -0500 Received: by mail-pj1-f65.google.com with SMTP id a16so1770324pjs.13 for ; Mon, 18 Nov 2019 11:21:36 -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=DzisFq8fux9k/N21kQN1ZtrgwBNPbrVsn1ch8Jq5ueE=; b=ausrL/boGyOBsVp8bS/Er5jCNIZzOWKh2raHpxUVXOoDbw/TzpEUka9AjChY7JlWZD vaJYqSSWuin+OnLD0jtO+eMtQmtj0eq4m22NZ8bN6ziE8szQ3czZWD8guZvCfJpG0Vpp c1z6UZduWEoSuucp05CcnJVlgDzFlDJmaaOT0= 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=DzisFq8fux9k/N21kQN1ZtrgwBNPbrVsn1ch8Jq5ueE=; b=uTon1LuHZtDjM5+dFWPVSrIiMs/XjQLFYPUg4JItl2SgnQ2RntU7DvqY9yKvv88i48 oC9cdsoSMwMSViX2kmid3fWQJtSTEIv/SRPC1NnrDR5PXmHRQYLVdpoVQPsL4KY6fYbc ZB/4RuSgiiUuEph8UrgCkaAb7HJduraarzwsg3t4aS/5cBxHcRO099job8Ejw99Tj9OH omHl406vhK0XGr5I57nV+kbMpaT+Moj4suY8syqAOdUWKBoZO6l5JgY0JbjpcglwdxQO 583lrzBmKtLW0I9X8+lLgzJ8gU4o5TEFiysPlaFKkx8treYaDkDsPfvaUoADZ7Y3tkAY Y3BA== X-Gm-Message-State: APjAAAUkqjHdsoR0Uocj884nZ0GpsDZDtYJkHtB0XheYsxiSCWRwLG4R 33gdgmTRhnmHAYVWiI1lbnvxsA== X-Received: by 2002:a17:90a:33ce:: with SMTP id n72mr747115pjb.17.1574104895674; Mon, 18 Nov 2019 11:21:35 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id p123sm22772633pfg.30.2019.11.18.11.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 11:21:34 -0800 (PST) From: Abhishek Pandit-Subedi To: Marcel Holtmann , Johan Hedberg , Rob Herring Cc: linux-bluetooth@vger.kernel.org, dianders@chromium.org, Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Subject: [PATCH v6 1/4] Bluetooth: hci_bcm: Disallow set_baudrate for BCM4354 Date: Mon, 18 Nov 2019 11:21:20 -0800 Message-Id: <20191118110335.v6.1.I8ed714e23fdf42fa35588cfee2877b53d781df12@changeid> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog In-Reply-To: <20191118192123.82430-1-abhishekpandit@chromium.org> References: <20191118192123.82430-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, don't set the operating speed before patchram. Signed-off-by: Abhishek Pandit-Subedi --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/bluetooth/hci_bcm.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 0f851c0dde7f..ee40003008d8 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -47,6 +47,14 @@ #define BCM_NUM_SUPPLIES 2 +/** + * struct bcm_device_data - device specific data + * @no_early_set_baudrate: Disallow set baudrate before driver setup() + */ +struct bcm_device_data { + bool no_early_set_baudrate; +}; + /** * struct bcm_device - device driver resources * @serdev_hu: HCI UART controller struct @@ -79,6 +87,7 @@ * @hu: pointer to HCI UART controller struct, * used to disable flow control during runtime suspend and system sleep * @is_suspended: whether flow control is currently disabled + * @no_early_set_baudrate: don't set_baudrate before setup() */ struct bcm_device { /* Must be the first member, hci_serdev.c expects this. */ @@ -112,6 +121,7 @@ struct bcm_device { struct hci_uart *hu; bool is_suspended; #endif + bool no_early_set_baudrate; }; /* generic bcm uart resources */ @@ -447,7 +457,13 @@ static int bcm_open(struct hci_uart *hu) if (bcm->dev) { hci_uart_set_flow_control(hu, true); hu->init_speed = bcm->dev->init_speed; - hu->oper_speed = bcm->dev->oper_speed; + + /* If oper_speed is set, ldisc/serdev will set the baudrate + * before calling setup() + */ + if (!bcm->dev->no_early_set_baudrate) + hu->oper_speed = bcm->dev->oper_speed; + err = bcm_gpio_set_power(bcm->dev, true); hci_uart_set_flow_control(hu, false); if (err) @@ -565,6 +581,8 @@ static int bcm_setup(struct hci_uart *hu) /* Operational speed if any */ if (hu->oper_speed) speed = hu->oper_speed; + else if (bcm->dev && bcm->dev->oper_speed) + speed = bcm->dev->oper_speed; else if (hu->proto->oper_speed) speed = hu->proto->oper_speed; else @@ -1374,6 +1392,7 @@ static struct platform_driver bcm_driver = { static int bcm_serdev_probe(struct serdev_device *serdev) { struct bcm_device *bcmdev; + const struct bcm_device_data *data; int err; bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL); @@ -1408,6 +1427,10 @@ static int bcm_serdev_probe(struct serdev_device *serdev) if (err) dev_err(&serdev->dev, "Failed to power down\n"); + data = device_get_match_data(bcmdev->dev); + if (data) + bcmdev->no_early_set_baudrate = data->no_early_set_baudrate; + return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto); } @@ -1419,12 +1442,16 @@ static void bcm_serdev_remove(struct serdev_device *serdev) } #ifdef CONFIG_OF +struct bcm_device_data bcm4354_device_data = { + .no_early_set_baudrate = true, +}; + static const struct of_device_id bcm_bluetooth_of_match[] = { { .compatible = "brcm,bcm20702a1" }, { .compatible = "brcm,bcm4345c5" }, { .compatible = "brcm,bcm4330-bt" }, { .compatible = "brcm,bcm43438-bt" }, - { .compatible = "brcm,bcm43540-bt" }, + { .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data }, { }, }; MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match); -- 2.24.0.432.g9d3f5f5b63-goog