devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 1/3] dt-bindings: net: document Bluetooth bindings in one place
@ 2017-09-08 13:57 Loic Poulain
  2017-09-08 13:57 ` [PATCH v7 2/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT Loic Poulain
  2017-09-08 13:57 ` [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property Loic Poulain
  0 siblings, 2 replies; 4+ messages in thread
From: Loic Poulain @ 2017-09-08 13:57 UTC (permalink / raw)
  To: marcel, robh+dt, johan.hedberg
  Cc: linux-bluetooth, linux-arm-msm, devicetree, bjorn.andersson,
	Loic Poulain

In the same way as Ethernet, gather the Bluetooth related bindings in
one file. Introduce the bluetooth-bd-address property which can be used
to store the assigned BD address.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 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
 v5: remove 2/3 merged in bluetooth-next tree
     Add bluetooth.txt for common BT bindings
     expect local-bd-address in little-endian format
 v6: use of_property_read_u8_array instead of of_get_property
 v7: use dev_info instead of BT_INFO to have dev context

 Documentation/devicetree/bindings/net/bluetooth.txt | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt

diff --git a/Documentation/devicetree/bindings/net/bluetooth.txt b/Documentation/devicetree/bindings/net/bluetooth.txt
new file mode 100644
index 0000000..94797df
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/bluetooth.txt
@@ -0,0 +1,5 @@
+The following properties are common to the Bluetooth controllers:
+
+- local-bd-address: array of 6 bytes, specifies the BD address that was
+  uniquely assigned to the Bluetooth device, formatted with least significant
+  byte first (little-endian).
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v7 2/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT
  2017-09-08 13:57 [PATCH v7 1/3] dt-bindings: net: document Bluetooth bindings in one place Loic Poulain
@ 2017-09-08 13:57 ` Loic Poulain
  2017-09-08 13:57 ` [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property Loic Poulain
  1 sibling, 0 replies; 4+ messages in thread
From: Loic Poulain @ 2017-09-08 13:57 UTC (permalink / raw)
  To: marcel, robh+dt, johan.hedberg
  Cc: linux-bluetooth, linux-arm-msm, devicetree, bjorn.andersson,
	Loic Poulain

Add optional local-bd-address property which is a 6-byte array
storing the assigned BD address. Since having a unique BD address
is critical, a per-device property value should be allocated.
This property is usually added by the boot loader which has access
to the provisioned data.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 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
 v5: remove 2/3 merged in bluetooth-next tree
     Add bluetooth.txt for common BT bindings
     expect local-bd-address in little-endian format
 v6: use of_property_read_u8_array instead of of_get_property
 v7: use dev_info instead of BT_INFO to have dev context

 Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
index 4ea39e9..042a2e4 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
@@ -37,6 +37,11 @@ The following properties are defined to the bluetooth node:
 	Definition: must be:
 		    "qcom,wcnss-bt"
 
+- local-bd-address:
+	Usage: optional
+	Value type: <u8 array>
+	Definition: see Documentation/devicetree/bindings/net/bluetooth.txt
+
 == WiFi
 The following properties are defined to the WiFi node:
 
@@ -91,6 +96,9 @@ smd {
 
 			bt {
 				compatible = "qcom,wcnss-bt";
+
+				/* BD address 00:11:22:33:44:55 */
+				local-bd-address = [ 55 44 33 22 11 00 ];
 			};
 
 			wlan {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property
  2017-09-08 13:57 [PATCH v7 1/3] dt-bindings: net: document Bluetooth bindings in one place Loic Poulain
  2017-09-08 13:57 ` [PATCH v7 2/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT Loic Poulain
@ 2017-09-08 13:57 ` Loic Poulain
       [not found]   ` <1504879075-587-3-git-send-email-loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Loic Poulain @ 2017-09-08 13:57 UTC (permalink / raw)
  To: marcel, robh+dt, johan.hedberg
  Cc: linux-bluetooth, linux-arm-msm, devicetree, bjorn.andersson,
	Loic Poulain

Retrieve BD address from the 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 <loic.poulain@linaro.org>
---
 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
 v5: remove 2/3 merged in bluetooth-next tree
     Add bluetooth.txt for common BT bindings
     expect local-bd-address in little-endian format
 v6: use of_property_read_u8_array instead of of_get_property
 v7: use dev_info instead of BT_INFO to have dev context

 drivers/bluetooth/btqcomsmd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c
index bd810d0..663bed6 100644
--- a/drivers/bluetooth/btqcomsmd.c
+++ b/drivers/bluetooth/btqcomsmd.c
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/rpmsg.h>
+#include <linux/of.h>
+
 #include <linux/soc/qcom/wcnss_ctrl.h>
 #include <linux/platform_device.h>
 
@@ -156,6 +158,15 @@ static int btqcomsmd_probe(struct platform_device *pdev)
 	if (IS_ERR(btq->cmd_channel))
 		return PTR_ERR(btq->cmd_channel);
 
+	/* The local-bd-address property is usually injected by the
+	 * bootloader which has access to the allocated BD address.
+	 */
+	if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
+				       (u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
+		dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
+			 &btq->bdaddr);
+	}
+
 	hdev = hci_alloc_dev();
 	if (!hdev)
 		return -ENOMEM;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property
       [not found]   ` <1504879075-587-3-git-send-email-loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2017-09-08 15:31     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-09-08 15:31 UTC (permalink / raw)
  To: Loic Poulain
  Cc: Rob Herring, Johan Hedberg, Bluez mailing list,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, devicetree,
	bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A

Hi Loic,

> Retrieve BD address from the 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 <loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> 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
> v5: remove 2/3 merged in bluetooth-next tree
>     Add bluetooth.txt for common BT bindings
>     expect local-bd-address in little-endian format
> v6: use of_property_read_u8_array instead of of_get_property
> v7: use dev_info instead of BT_INFO to have dev context
> 
> drivers/bluetooth/btqcomsmd.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-08 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08 13:57 [PATCH v7 1/3] dt-bindings: net: document Bluetooth bindings in one place Loic Poulain
2017-09-08 13:57 ` [PATCH v7 2/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT Loic Poulain
2017-09-08 13:57 ` [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property Loic Poulain
     [not found]   ` <1504879075-587-3-git-send-email-loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-09-08 15:31     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).