From patchwork Fri Dec 8 02:57:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 845970 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=lechnology.com header.i=@lechnology.com header.b="NM5GNdXi"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ytH942fvdz9s7B for ; Fri, 8 Dec 2017 13:58:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752966AbdLHC6C (ORCPT ); Thu, 7 Dec 2017 21:58:02 -0500 Received: from vern.gendns.com ([206.190.152.46]:49233 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752908AbdLHC56 (ORCPT ); Thu, 7 Dec 2017 21:57:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding: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=BST0WhcMmsdjTEbYSACAF+8AL7LBv8NL7lI77114gD0=; b=NM5GNdXiOkwbxt5xc77FOY3dq s4uHkdewT3AkPoAZfuOC5A+0F4i2o52WJeUb4mg8O3PTZt61kG/JOq6+vXw1WG8XE1VHiSYX8YKqo lXzWNoOePH6xyrJ3cxsIqzVuRfg6xMGnoe9bD7VJDIIykhPxiug+r8kNHxzm0zw5S3iitl2xYXf9O CE4kps7La+ONSThj5TanmfUPMko8NQueCaAOEHY6RzB0zKGdRKQUZ8nbovLzsN99yovkfKoN+kWoA T9bU//WsmDZbRatwUD37l2w7XGhJs/mTk/Kar4uRJg/9gS1ka9iVUda7MeSkJ0dmardZM45kcv4F6 zZYNM0Qyw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:44808 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89) (envelope-from ) id 1eN8pk-002zC5-4f; Thu, 07 Dec 2017 21:56:16 -0500 From: David Lechner To: devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org Cc: David Lechner , Rob Herring , Mark Rutland , Marcel Holtmann , Gustavo Padovan , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] Bluetooth: hci_ll: add support for setting public address Date: Thu, 7 Dec 2017 20:57:38 -0600 Message-Id: <1512701860-8321-2-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512701860-8321-1-git-send-email-david@lechnology.com> References: <1512701860-8321-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This adds support for setting the public address on Texas Instruments Bluetooth chips using a vendor-specific command. This has been tested on a CC2560A. The TI wiki also indicates that this command should work on TI WL17xx/WL18xx Bluetooth chips. Signed-off-by: David Lechner --- v2 changes: * This is a new patch in v2 drivers/bluetooth/hci_ll.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 974a788..b732004 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -57,6 +57,7 @@ #include "hci_uart.h" /* Vendor-specific HCI commands */ +#define HCI_VS_WRITE_BD_ADDR 0xfc06 #define HCI_VS_UPDATE_UART_HCI_BAUDRATE 0xff36 /* HCILL commands */ @@ -662,6 +663,20 @@ static int download_firmware(struct ll_device *lldev) return err; } +static int ll_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) +{ + bdaddr_t bdaddr_swapped; + struct sk_buff *skb; + + baswap(&bdaddr_swapped, bdaddr); + skb = __hci_cmd_sync(hdev, HCI_VS_WRITE_BD_ADDR, sizeof(bdaddr_t), + &bdaddr_swapped, HCI_INIT_TIMEOUT); + if (!IS_ERR(skb)) + kfree_skb(skb); + + return PTR_ERR_OR_ZERO(skb); +} + static int ll_setup(struct hci_uart *hu) { int err, retry = 3; @@ -674,6 +689,8 @@ static int ll_setup(struct hci_uart *hu) lldev = serdev_device_get_drvdata(serdev); + hu->hdev->set_bdaddr = ll_set_bdaddr; + serdev_device_set_flow_control(serdev, true); do {