mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: "marcel@holtmann.org" <marcel@holtmann.org>,
	"luiz.dentz@gmail.com" <luiz.dentz@gmail.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Amitkumar Karwar <amitkumar.karwar@nxp.com>,
	Sherry Sun <sherry.sun@nxp.com>, Luke Wang <ziniu.wang_1@nxp.com>,
	"johan.korsnes@remarkable.no" <johan.korsnes@remarkable.no>,
	"kristian.krohn@remarkable.no" <kristian.krohn@remarkable.no>,
	Manjeet Gupta <manjeet.gupta@nxp.com>
Subject: Re: [PATCH v5 2/2] Bluetooth: btnxpuart: Add support for set BD address
Date: Fri, 28 Feb 2025 15:32:58 +0000	[thread overview]
Message-ID: <AS4PR04MB969222D9EB2FD7FD54007EA0E7CC2@AS4PR04MB9692.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <9b67d408-3557-46d5-81ad-e3d6636a5e0d@molgen.mpg.de>

Hi Paul,

Thank you for reviewing this patch.

> Dear Neeraj,
> 
> 
> Thank you for your patch. In the summary/title you could use *to set* or *for
> setting*.
> 
> Am 20.02.25 um 12:41 schrieb Neeraj Sanjay Kale:
> > This adds support for setting BD address during hci registration. NXP
> > FW does not allow vendor commands unless it receives a reset command
> > after FW download and initialization done.
> 
> I’d add a blank line between paragraphs.
> 
> > As a workaround, the .set_bdaddr callback function will first send the
> > HCI reset command, followed by the actual vendor command to set BD
> > address.
> 
> Where is the command 0xfc22 documented?
> 
> How did you verify this? Maybe document the commands how to set the BD
> address, and how to verify it.
> 
> Does Linux log new messages with your patch?

I have added User Manual reference in a comment. There is no new message logged by the driver.

> 
> > Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> > Signed-off-by: Johan Korsnes <johan.korsnes@remarkable.no>
> > Signed-off-by: Kristian Husevåg Krohn <kristian.krohn@remarkable.no>
> 
> The last name has some wrong character.
> 
> > Tested-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > ---
> > v4: hci0 interface shows RAW mode if 'local-bd-address' not defined and
> >      HCI_QUIRK_USE_BDADDR_PROPERTY is set. Add Quirk only if device tree
> >      property 'local-bd-address' found. (Neeraj)
> > v5: Initialize local variable ba, update Copywrite year. (Kristian)
> > ---
> >   drivers/bluetooth/btnxpuart.c | 39
> ++++++++++++++++++++++++++++++++++-
> >   1 file changed, 38 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/btnxpuart.c
> > b/drivers/bluetooth/btnxpuart.c index 1230045d78a5..dd9161bfd52c
> > 100644
> > --- a/drivers/bluetooth/btnxpuart.c
> > +++ b/drivers/bluetooth/btnxpuart.c
> > @@ -1,7 +1,7 @@
> >   // SPDX-License-Identifier: GPL-2.0-or-later
> >   /*
> >    *  NXP Bluetooth driver
> > - *  Copyright 2023 NXP
> > + *  Copyright 2023-2025 NXP
> >    */
> >
> >   #include <linux/module.h>
> > @@ -1197,6 +1197,34 @@ static int nxp_set_ind_reset(struct hci_dev
> *hdev, void *data)
> >       return hci_recv_frame(hdev, skb);
> >   }
> >
> > +static int nxp_set_bdaddr(struct hci_dev *hdev, const bdaddr_t
> > +*bdaddr) {
> > +     u8 data[8] = { 0xfe, 0x06, 0, 0, 0, 0, 0, 0 };
> > +     struct sk_buff *skb;
> > +     int err;
> > +
> > +     memcpy(data + 2, bdaddr, 6);
> > +
> 
> Add a comment about the firmware limitation/requirement?
> 
> > +     skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL,
> HCI_INIT_TIMEOUT);
> > +     if (IS_ERR(skb)) {
> > +             err = PTR_ERR(skb);
> > +             bt_dev_err(hdev, "Reset before setting local-bd-addr failed (%ld)",
> > +                        PTR_ERR(skb));
> > +             return err;
> > +     }
> > +     kfree_skb(skb);
> > +
> > +     skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(data), data,
> HCI_CMD_TIMEOUT);
> > +     if (IS_ERR(skb)) {
> > +             err = PTR_ERR(skb);
> > +             bt_dev_err(hdev, "Changing device address failed (%d)", err);
> > +             return err;
> > +     }
> > +     kfree_skb(skb);
> > +
> > +     return 0;
> > +}
> > +
> >   /* NXP protocol */
> >   static int nxp_setup(struct hci_dev *hdev)
> >   {
> > @@ -1500,6 +1528,7 @@ static int nxp_serdev_probe(struct serdev_device
> *serdev)
> >   {
> >       struct hci_dev *hdev;
> >       struct btnxpuart_dev *nxpdev;
> > +     bdaddr_t ba = {0};
> >
> >       nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
> >       if (!nxpdev)
> > @@ -1547,8 +1576,16 @@ static int nxp_serdev_probe(struct serdev_device
> *serdev)
> >       hdev->send  = nxp_enqueue;
> >       hdev->hw_error = nxp_hw_err;
> >       hdev->shutdown = nxp_shutdown;
> > +     hdev->set_bdaddr = nxp_set_bdaddr;
> > +
> >       SET_HCIDEV_DEV(hdev, &serdev->dev);
> >
> > +     device_property_read_u8_array(&nxpdev->serdev->dev,
> > +                                   "local-bd-address",
> > +                                   (u8 *)&ba, sizeof(ba));
> > +     if (bacmp(&ba, BDADDR_ANY))
> > +             set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
> 
> Please elaborate in the commit message, why the quirk is needed.
> 
> > +
> >       if (hci_register_dev(hdev) < 0) {
> >               dev_err(&serdev->dev, "Can't register HCI device\n");
> >               goto probe_fail;

Rest of the review comments I have resolved in V6 patch.

Thanks,
Neeraj

  reply	other threads:[~2025-02-28 15:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 11:41 [PATCH v5 1/2] dt-bindings: net: bluetooth: nxp: Add support to " Neeraj Sanjay Kale
2025-02-20 11:41 ` [PATCH v5 2/2] Bluetooth: btnxpuart: Add support for " Neeraj Sanjay Kale
2025-02-20 12:04   ` Paul Menzel
2025-02-28 15:32     ` Neeraj Sanjay Kale [this message]
2025-02-20 11:45 ` [PATCH v5 1/2] dt-bindings: net: bluetooth: nxp: Add support to " Paul Menzel
2025-02-20 11:59   ` Neeraj Sanjay Kale
2025-02-20 12:11     ` Paul Menzel
2025-02-20 12:30       ` Neeraj Sanjay Kale
2025-02-20 17:08       ` Conor Dooley
2025-02-20 17:59   ` Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2025-01-15 16:38 Neeraj Sanjay Kale
2025-01-15 16:38 ` [PATCH v5 2/2] Bluetooth: btnxpuart: Add support for " Neeraj Sanjay Kale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS4PR04MB969222D9EB2FD7FD54007EA0E7CC2@AS4PR04MB9692.eurprd04.prod.outlook.com \
    --to=neeraj.sanjaykale@nxp.com \
    --cc=amitkumar.karwar@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=johan.korsnes@remarkable.no \
    --cc=kristian.krohn@remarkable.no \
    --cc=krzk+dt@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=manjeet.gupta@nxp.com \
    --cc=marcel@holtmann.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=robh@kernel.org \
    --cc=sherry.sun@nxp.com \
    --cc=ziniu.wang_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®