[{"id":1763266,"web_url":"http://patchwork.ozlabs.org/comment/1763266/","msgid":"<F3742D76-DDB2-4D25-B7BB-62BD18175C4E@holtmann.org>","list_archive_url":null,"date":"2017-09-05T11:54:24","subject":"Re: [PATCH v4 1/3] dt-bindings: soc: qcom: Add local-bd-address\n\tproperty to WCNSS-BT","submitter":{"id":384,"url":"http://patchwork.ozlabs.org/api/people/384/","name":"Marcel Holtmann","email":"marcel@holtmann.org"},"content":"Hi Loic,\n\n> Add optional local-bd-address property which is a 6-byte array\n> storing the assigned BD address. Since having a unique BD address\n> is critical, a per-device property value should be allocated.\n> This property is usually added by the boot loader which has access\n> to the provisioned data.\n> \n> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>\n> ---\n> v2: Set device as unconfigured if default address detected\n>     Add warning if BD addr retrieved from DT\n> v3: if no addr retrieved from DT, unconditionally set\n>     the invalid BD addr flag.\n>     swap and set bdaddr in the platform probe\n> v4: Add dt-bindings documentation\n>     split patch in two parts (setup, dt prop)\n>     use local-bd-address name instead of local-mac-address\n> \n> Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt | 6 ++++++\n> 1 file changed, 6 insertions(+)\n> \n> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt\n> index 4ea39e9186a7..1edfcdc6e267 100644\n> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt\n> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt\n> @@ -37,6 +37,12 @@ The following properties are defined to the bluetooth node:\n> \tDefinition: must be:\n> \t\t    \"qcom,wcnss-bt\"\n> \n> +- local-bd-address:\n> +\tUsage: optional\n> +\tValue type: <u8 array>\n> +\tDefinition: should specify the unique 6-byte BD address assigned to the\n> +\t\t    BT controller. Usually added at runtime by the boot loader.\n> +\n\nas mentioned in my other email, I would really add an example on how to format this. Especially since these are formatted in little-endian order. So adding an example of “00:11:22:33:44:55” string representation on how it converts to [ 55 44 33 22 11 00 ] would be super helpful.\n\nIt might also be useful to create a generic bluetooth.txt similar to ethernet.txt. And then just reference it from here.\n\nOf course we need to have Rob sign off on this and also make sure the boot loader people get this done correctly.\n\nRegards\n\nMarcel\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmlW82Mwjz9sPt\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 21:54:28 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751219AbdIELy0 convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 07:54:26 -0400","from coyote.holtmann.net ([212.227.132.17]:46700 \"EHLO\n\tmail.holtmann.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750847AbdIELy0 (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 5 Sep 2017 07:54:26 -0400","from marcel-macpro.fritz.box (p5B3D2BCF.dip0.t-ipconnect.de\n\t[91.61.43.207])\n\tby mail.holtmann.org (Postfix) with ESMTPSA id D26E3CF2A3;\n\tTue,  5 Sep 2017 13:59:47 +0200 (CEST)"],"Content-Type":"text/plain; charset=utf-8","Mime-Version":"1.0 (Mac OS X Mail 10.3 \\(3273\\))","Subject":"Re: [PATCH v4 1/3] dt-bindings: soc: qcom: Add local-bd-address\n\tproperty to WCNSS-BT","From":"Marcel Holtmann <marcel@holtmann.org>","In-Reply-To":"<1504607164-12645-1-git-send-email-loic.poulain@linaro.org>","Date":"Tue, 5 Sep 2017 13:54:24 +0200","Cc":"Johan Hedberg <johan.hedberg@gmail.com>, Rob Herring <robh+dt@kernel.org>,\n\t\"open list:BLUETOOTH DRIVERS\" <linux-bluetooth@vger.kernel.org>,\n\tlinux-arm-msm@vger.kernel.org, devicetree <devicetree@vger.kernel.org>,\n\tbjorn.andersson@linaro.org","Content-Transfer-Encoding":"8BIT","Message-Id":"<F3742D76-DDB2-4D25-B7BB-62BD18175C4E@holtmann.org>","References":"<1504607164-12645-1-git-send-email-loic.poulain@linaro.org>","To":"Loic Poulain <loic.poulain@linaro.org>","X-Mailer":"Apple Mail (2.3273)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1763278,"web_url":"http://patchwork.ozlabs.org/comment/1763278/","msgid":"<2C437D3D-FD64-456D-91D3-322220740A90@holtmann.org>","list_archive_url":null,"date":"2017-09-05T12:13:20","subject":"Re: [PATCH v4 3/3] Bluetooth: btqcomsmd: retieve BD address from DT","submitter":{"id":384,"url":"http://patchwork.ozlabs.org/api/people/384/","name":"Marcel Holtmann","email":"marcel@holtmann.org"},"content":"Hi Loic,\n\n> Retrieve BD address from the DT local-bd-address property.\n> This address must be unique and is usually added in the DT\n> by the bootloader which has access to the provisioned data.\n> \n> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>\n> ---\n> v2: Set device as unconfigured if default address detected\n>     Add warning if BD addr retrieved from DT\n> v3: if no addr retrieved from DT, unconditionally set\n>     the invalid BD addr flag.\n>     swap and set bdaddr in the platform probe\n> v4: Add dt-bindings documentation\n>     split patch in two parts (setup, dt prop)\n>     use local-bd-address name instead of local-mac-address\n> \n> drivers/bluetooth/btqcomsmd.c | 15 +++++++++++++++\n> 1 file changed, 15 insertions(+)\n> \n> diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c\n> index c70fae75c4ad..08a83cb30af6 100644\n> --- a/drivers/bluetooth/btqcomsmd.c\n> +++ b/drivers/bluetooth/btqcomsmd.c\n> @@ -15,6 +15,8 @@\n> #include <linux/module.h>\n> #include <linux/slab.h>\n> #include <linux/rpmsg.h>\n> +#include <linux/of.h>\n> +\n> #include <linux/soc/qcom/wcnss_ctrl.h>\n> #include <linux/platform_device.h>\n> \n> @@ -126,6 +128,7 @@ static int btqcomsmd_setup(struct hci_dev *hdev)\n> \n> static int btqcomsmd_probe(struct platform_device *pdev)\n> {\n> +\tconst bdaddr_t *local_bd_addr;\n> \tstruct btqcomsmd *btq;\n> \tstruct hci_dev *hdev;\n> \tvoid *wcnss;\n> @@ -147,6 +150,18 @@ static int btqcomsmd_probe(struct platform_device *pdev)\n> \tif (IS_ERR(btq->cmd_channel))\n> \t\treturn PTR_ERR(btq->cmd_channel);\n> \n> +\t/* The local-bd-address DT property is usually injected by the\n> +\t * bootloader which has access to the allocated BD address.\n> +\t */\n> +\tlocal_bd_addr = of_get_property(pdev->dev.of_node, \"local-mac-address\",\n> +\t\t\t\t\t&ret);\n> +\tif (local_bd_addr && ret == sizeof(bdaddr_t)) {\n> +\t\t/* local-bd-address stored with most significant byte first */\n> +\t\tbaswap(&btq->bdaddr, local_bd_addr);\n\nactually my preference would be really that the address is coming from DT in the right order. We are defining what local-bd-address means. So lets do that in Bluetooth specified order and not confuse people even more.\n\nAnd btw. I am fine if you just use const bdaddr_t *bdaddr here as temporary variable name.\n\nRegards\n\nMarcel\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmlx168ywz9sRm\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 22:13:25 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750896AbdIEMNY convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 08:13:24 -0400","from coyote.holtmann.net ([212.227.132.17]:50335 \"EHLO\n\tmail.holtmann.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750731AbdIEMNX (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 5 Sep 2017 08:13:23 -0400","from marcel-macpro.fritz.box (p5B3D2BCF.dip0.t-ipconnect.de\n\t[91.61.43.207])\n\tby mail.holtmann.org (Postfix) with ESMTPSA id 64CFDCF2A3;\n\tTue,  5 Sep 2017 14:18:44 +0200 (CEST)"],"Content-Type":"text/plain; charset=us-ascii","Mime-Version":"1.0 (Mac OS X Mail 10.3 \\(3273\\))","Subject":"Re: [PATCH v4 3/3] Bluetooth: btqcomsmd: retieve BD address from DT","From":"Marcel Holtmann <marcel@holtmann.org>","In-Reply-To":"<1504607164-12645-3-git-send-email-loic.poulain@linaro.org>","Date":"Tue, 5 Sep 2017 14:13:20 +0200","Cc":"Johan Hedberg <johan.hedberg@gmail.com>, robh+dt@kernel.org,\n\tlinux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org,\n\tdevicetree@vger.kernel.org, bjorn.andersson@linaro.org","Content-Transfer-Encoding":"8BIT","Message-Id":"<2C437D3D-FD64-456D-91D3-322220740A90@holtmann.org>","References":"<1504607164-12645-1-git-send-email-loic.poulain@linaro.org>\n\t<1504607164-12645-3-git-send-email-loic.poulain@linaro.org>","To":"Loic Poulain <loic.poulain@linaro.org>","X-Mailer":"Apple Mail (2.3273)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1763280,"web_url":"http://patchwork.ozlabs.org/comment/1763280/","msgid":"<773E21D0-9E00-45B5-8454-3AFFAECCBFD7@holtmann.org>","list_archive_url":null,"date":"2017-09-05T12:14:15","subject":"Re: [PATCH v4 2/3] Bluetooth: btqcomsmd: BD address setup","submitter":{"id":384,"url":"http://patchwork.ozlabs.org/api/people/384/","name":"Marcel Holtmann","email":"marcel@holtmann.org"},"content":"Hi Loic,\n\n> This patch implements the hdev setup function.\n> wcnss-bt does not have persistent memory to store\n> an allocated BD address. The device is therefore\n> marked as unconfigured if no BD address has been\n> previously retrieved.\n> \n> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>\n> ---\n> v2: Set device as unconfigured if default address detected\n>     Add warning if BD addr retrieved from DT\n> v3: if no addr retrieved from DT, unconditionally set\n>     the invalid BD addr flag.\n>     swap and set bdaddr in the platform probe\n> v4: Add dt-bindings documentation\n>     split patch in two parts (setup, dt prop)\n>     use local-bd-address name instead of local-mac-address\n> \n> drivers/bluetooth/btqcomsmd.c | 25 +++++++++++++++++++++++++\n> 1 file changed, 25 insertions(+)\n> \n> diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c\n> index ef730c173d4b..c70fae75c4ad 100644\n> --- a/drivers/bluetooth/btqcomsmd.c\n> +++ b/drivers/bluetooth/btqcomsmd.c\n> @@ -26,6 +26,7 @@\n> struct btqcomsmd {\n> \tstruct hci_dev *hdev;\n> \n> +\tbdaddr_t bdaddr;\n> \tstruct rpmsg_endpoint *acl_channel;\n> \tstruct rpmsg_endpoint *cmd_channel;\n> };\n> @@ -100,6 +101,29 @@ static int btqcomsmd_close(struct hci_dev *hdev)\n> \treturn 0;\n> }\n> \n> +static int btqcomsmd_setup(struct hci_dev *hdev)\n> +{\n> +\tstruct btqcomsmd *btq = hci_get_drvdata(hdev);\n> +\tstruct sk_buff *skb;\n> +\n> +\tskb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);\n> +\tif (IS_ERR(skb))\n> +\t\treturn PTR_ERR(skb);\n> +\tkfree_skb(skb);\n> +\n> +\t/* Device does not have persistent storage for BD address.\n> +\t * Mark the device with invalid BD addr flag if no address\n> +\t * retrieved during probe.\n> +\t */\n> +\tif (!bacmp(&btq->bdaddr, BDADDR_ANY)) {\n> +\t\tbt_dev_info(hdev, \"No BD address configured\");\n> +\t\tset_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);\n> +\t\treturn 0;\n> +\t}\n> +\n> +\treturn qca_set_bdaddr_rome(hdev, &btq->bdaddr);\n> +}\n> +\n\nactually I applied a modified version of your patch that also sets invalid BD address when changing the address fails. I think there is no good reason to fail ->setup(). Let them fix that in userspace since the device is actually functional.\n\nRegards\n\nMarcel\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmly43Gx9z9sRm\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 22:14:20 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751159AbdIEMOS convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 08:14:18 -0400","from coyote.holtmann.net ([212.227.132.17]:34912 \"EHLO\n\tmail.holtmann.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751129AbdIEMOR (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 5 Sep 2017 08:14:17 -0400","from marcel-macpro.fritz.box (p5B3D2BCF.dip0.t-ipconnect.de\n\t[91.61.43.207])\n\tby mail.holtmann.org (Postfix) with ESMTPSA id 24A1BCF2A3;\n\tTue,  5 Sep 2017 14:19:39 +0200 (CEST)"],"Content-Type":"text/plain; charset=us-ascii","Mime-Version":"1.0 (Mac OS X Mail 10.3 \\(3273\\))","Subject":"Re: [PATCH v4 2/3] Bluetooth: btqcomsmd: BD address setup","From":"Marcel Holtmann <marcel@holtmann.org>","In-Reply-To":"<1504607164-12645-2-git-send-email-loic.poulain@linaro.org>","Date":"Tue, 5 Sep 2017 14:14:15 +0200","Cc":"Johan Hedberg <johan.hedberg@gmail.com>, robh+dt@kernel.org,\n\tlinux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org,\n\tdevicetree@vger.kernel.org, bjorn.andersson@linaro.org","Content-Transfer-Encoding":"8BIT","Message-Id":"<773E21D0-9E00-45B5-8454-3AFFAECCBFD7@holtmann.org>","References":"<1504607164-12645-1-git-send-email-loic.poulain@linaro.org>\n\t<1504607164-12645-2-git-send-email-loic.poulain@linaro.org>","To":"Loic Poulain <loic.poulain@linaro.org>","X-Mailer":"Apple Mail (2.3273)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]