From patchwork Tue Sep 5 10:26:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 111655 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp2640487qge; Tue, 5 Sep 2017 03:26:19 -0700 (PDT) X-Received: by 10.99.126.84 with SMTP id o20mr3346311pgn.273.1504607179196; Tue, 05 Sep 2017 03:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504607179; cv=none; d=google.com; s=arc-20160816; b=DxDprjt7AUhFUEsQgnWMFRkp6BQ3CfQpyA/ncVVhM4cp3RwwiDzJNkfcTJUs5xrbwa MqS6A6MSi3LMGybmgShfBYReHliqbzhQkGyiOTptSmNWNucT3037M6uicxxjhBGyaiyo 4X79TL5G6HVknBAAScYSq1ybjTmrMEdy49IcSWXr3A/MJX40mUSJbW3eKpaF7cSZJNWZ W2bQIqZk0k+itcw5QXETO52fm8uMpO6j0tkTw439H5A+qLwhiJ9ncTUlVuoMZE57lkN1 7HUCpflobSMF8zJBIFVspTkUOoKr+KK7SraGrLdSjLlLBS80tgYgFk2AdMLaU735QGCo G7zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1Sken5Uzjfo6P6LJ3KjETgXkxHl/SwrrSQoT/CnU8qU=; b=bd/2dpD/1WX/PeZx4x5g8qGZangVgCH3dMl5jWbB9ecuFwzs3Qqd61mHJtvWbarzU4 nqBVaRdi5PDpfC6K2ml2PWeZDnUEIVejqhx9RtN6bf6mRm184Ri+GgcX33J0P81OaNRf BFjusfhN22qE7lcpFzoZFb3RRuko1pzetrxsS5ItRHen5Sw/jUrIlBnucVqA3eSoBeuf mzNVwdP6wtrlWpdBM3sCKBSs2yqL/TQp/FZZmhZpxi2NDwkBO6nZAamwzeoKRncoLbpv kt0vkPCywZA/eZP7lsMMsicJlWut3nGOl34Q2CY1nG1oJ4lXSY28itPKRu711/7XVkuP d+Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KYDjVrzp; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si46781pgr.350.2017.09.05.03.26.18; Tue, 05 Sep 2017 03:26:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KYDjVrzp; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751007AbdIEK0S (ORCPT + 6 others); Tue, 5 Sep 2017 06:26:18 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35737 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbdIEK0O (ORCPT ); Tue, 5 Sep 2017 06:26:14 -0400 Received: by mail-wm0-f49.google.com with SMTP id h144so3172362wme.0 for ; Tue, 05 Sep 2017 03:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HSriipajegX6efoI0VQX4SRt1OXkQ7bOfiof0VIcOHM=; b=KYDjVrzp9sH/1HDc/I5G2FAqAC3uktY3i+iEQjKbkZlkQAT8Ksi+TOUfiEALgeaqkY WI39+8zrunQWpIICFgpOQ3w+JsHLbNLwIHds+FvAcYLCUnAjL2XQCH2IbWTjAjgq8ZXS UaF5cQWPO+V3lFAeXUOzjW84hIn+6PnCUl8Co= 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; bh=HSriipajegX6efoI0VQX4SRt1OXkQ7bOfiof0VIcOHM=; b=fP48K8hvAuMpJ/Cd6ebhYACNsN6MIALEJT4pSJ+KHs4Xlj4gHMv7pULmY91LNa2ju7 g823pzoHn79RCEKTsTlLrknjbxxNiYIaSNAdiuen0aOgbiS/dE1MQ5NPxFsmB7SycpSg 9HNlNp5Me4pOC97VWCMPMlzTOjPxdRDuWdxmxY1lQHLKj8a+4Z6eapeNnYJLt4znq1RQ 9rhdDr5lEnQ6Kqhn6rG5gJlgopaNcrlkGv9pEVnGzYA2xkSpxwydgAsTe6tahyd9RqOB tvHQxLLtpfpJejEcpQsbGBIWUP8VLXW7J+QL42kTf+x7ThOjsn9Vvzwqsi7UfxBmPRwd ZpJw== X-Gm-Message-State: AHPjjUjhJ0/sme6B2e2aChia/u8A+doVymGfkHrOz5I3fs79KmRAv0as IULlQlPxTD1UBVto X-Google-Smtp-Source: ADKCNb6BFX9LdqOtDanFKuWSCdjuhzKunhc7htTT0Mwmj7Ahzbmh1UwRfqgrPCuCFuJp4EH4psuUJg== X-Received: by 10.28.20.208 with SMTP id 199mr577733wmu.101.1504607173122; Tue, 05 Sep 2017 03:26:13 -0700 (PDT) Received: from loic-XPS-12.home (LFbn-1-2083-208.w90-76.abo.wanadoo.fr. [90.76.148.208]) by smtp.gmail.com with ESMTPSA id v82sm214584wmd.44.2017.09.05.03.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 03:26:12 -0700 (PDT) From: Loic Poulain To: marcel@holtmann.org, johan.hedberg@gmail.com, robh+dt@kernel.org Cc: linux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, bjorn.andersson@linaro.org, Loic Poulain Subject: [PATCH v4 3/3] Bluetooth: btqcomsmd: retieve BD address from DT Date: Tue, 5 Sep 2017 12:26:04 +0200 Message-Id: <1504607164-12645-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504607164-12645-1-git-send-email-loic.poulain@linaro.org> References: <1504607164-12645-1-git-send-email-loic.poulain@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Retrieve BD address from the DT local-bd-address property. This address must be unique and is usually added in the DT by the bootloader which has access to the provisioned data. Signed-off-by: Loic Poulain --- v2: Set device as unconfigured if default address detected Add warning if BD addr retrieved from DT v3: if no addr retrieved from DT, unconditionally set the invalid BD addr flag. swap and set bdaddr in the platform probe v4: Add dt-bindings documentation split patch in two parts (setup, dt prop) use local-bd-address name instead of local-mac-address drivers/bluetooth/btqcomsmd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index c70fae75c4ad..08a83cb30af6 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -15,6 +15,8 @@ #include #include #include +#include + #include #include @@ -126,6 +128,7 @@ static int btqcomsmd_setup(struct hci_dev *hdev) static int btqcomsmd_probe(struct platform_device *pdev) { + const bdaddr_t *local_bd_addr; struct btqcomsmd *btq; struct hci_dev *hdev; void *wcnss; @@ -147,6 +150,18 @@ static int btqcomsmd_probe(struct platform_device *pdev) if (IS_ERR(btq->cmd_channel)) return PTR_ERR(btq->cmd_channel); + /* The local-bd-address DT property is usually injected by the + * bootloader which has access to the allocated BD address. + */ + local_bd_addr = of_get_property(pdev->dev.of_node, "local-mac-address", + &ret); + if (local_bd_addr && ret == sizeof(bdaddr_t)) { + /* local-bd-address stored with most significant byte first */ + baswap(&btq->bdaddr, local_bd_addr); + BT_INFO("BD address %pMR retrieved from device-tree", + &btq->bdaddr); + } + hdev = hci_alloc_dev(); if (!hdev) return -ENOMEM;