diff mbox series

[v4,1/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT

Message ID 1504607164-12645-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series [v4,1/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT | expand

Commit Message

Loic Poulain Sept. 5, 2017, 10:26 a.m. UTC
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

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

-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Marcel Holtmann Sept. 5, 2017, 12:14 p.m. UTC | #1
Hi Loic,

> This patch implements the hdev setup function.

> wcnss-bt does not have persistent memory to store

> an allocated BD address. The device is therefore

> marked as unconfigured if no BD address has been

> previously retrieved.

> 

> 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

> 

> drivers/bluetooth/btqcomsmd.c | 25 +++++++++++++++++++++++++

> 1 file changed, 25 insertions(+)

> 

> diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c

> index ef730c173d4b..c70fae75c4ad 100644

> --- a/drivers/bluetooth/btqcomsmd.c

> +++ b/drivers/bluetooth/btqcomsmd.c

> @@ -26,6 +26,7 @@

> struct btqcomsmd {

> 	struct hci_dev *hdev;

> 

> +	bdaddr_t bdaddr;

> 	struct rpmsg_endpoint *acl_channel;

> 	struct rpmsg_endpoint *cmd_channel;

> };

> @@ -100,6 +101,29 @@ static int btqcomsmd_close(struct hci_dev *hdev)

> 	return 0;

> }

> 

> +static int btqcomsmd_setup(struct hci_dev *hdev)

> +{

> +	struct btqcomsmd *btq = hci_get_drvdata(hdev);

> +	struct sk_buff *skb;

> +

> +	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);

> +	if (IS_ERR(skb))

> +		return PTR_ERR(skb);

> +	kfree_skb(skb);

> +

> +	/* Device does not have persistent storage for BD address.

> +	 * Mark the device with invalid BD addr flag if no address

> +	 * retrieved during probe.

> +	 */

> +	if (!bacmp(&btq->bdaddr, BDADDR_ANY)) {

> +		bt_dev_info(hdev, "No BD address configured");

> +		set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);

> +		return 0;

> +	}

> +

> +	return qca_set_bdaddr_rome(hdev, &btq->bdaddr);

> +}

> +


actually 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.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
index 4ea39e9186a7..1edfcdc6e267 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
@@ -37,6 +37,12 @@  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: should specify the unique 6-byte BD address assigned to the
+		    BT controller. Usually added at runtime by the boot loader.
+
 == WiFi
 The following properties are defined to the WiFi node: