[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AM9PR04MB8603BE475B041AD1B45BBCC0E7B99@AM9PR04MB8603.eurprd04.prod.outlook.com>
Date: Mon, 13 Mar 2023 14:17:41 +0000
From: Neeraj sanjay kale <neeraj.sanjaykale@....com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>,
"marcel@...tmann.org" <marcel@...tmann.org>,
"johan.hedberg@...il.com" <johan.hedberg@...il.com>,
"luiz.dentz@...il.com" <luiz.dentz@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
"alok.a.tiwari@...cle.com" <alok.a.tiwari@...cle.com>,
"hdanton@...a.com" <hdanton@...a.com>,
"leon@...nel.org" <leon@...nel.org>,
Netdev <netdev@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"linux-bluetooth@...r.kernel.org" <linux-bluetooth@...r.kernel.org>,
linux-serial <linux-serial@...r.kernel.org>,
Amitkumar Karwar <amitkumar.karwar@....com>,
Rohit Fule <rohit.fule@....com>,
Sherry Sun <sherry.sun@....com>
Subject: RE: [EXT] Re: [PATCH v6 3/3] Bluetooth: NXP: Add protocol support for
NXP Bluetooth chipsets
Hi Ilpo
>
> On Fri, 10 Mar 2023, Neeraj sanjay kale wrote:
>
> > Hi Ilpo,
> >
> > I have resolved most of your comments in v8 patch, and I have few things
> to discuss regarding the v6 patch.
> >
> > > > > > +static bool nxp_fw_change_baudrate(struct hci_dev *hdev, u16
> > > > > > +req_len) {
> > > > > > + struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
> > > > > > + struct nxp_bootloader_cmd nxp_cmd5;
> > > > > > + struct uart_config uart_config;
> > > > > > +
> > > > > > + if (req_len == sizeof(nxp_cmd5)) {
> > > > > > + nxp_cmd5.header = __cpu_to_le32(5);
> > > > > > + nxp_cmd5.arg = 0;
> > > > > > + nxp_cmd5.payload_len =
> __cpu_to_le32(sizeof(uart_config));
> > > > > > + nxp_cmd5.crc = swab32(crc32_be(0UL, (char *)&nxp_cmd5,
> > > > > > + sizeof(nxp_cmd5)
> > > > > > + - 4));
> > > > >
> > > > > swab32(crc32_be(...)) seems and odd construct instead of
> > > __cpu_to_le32().
> > > > Earlier I had tried using __cpu_to_le32() but that did not work.
> > > > The FW expects a swapped CRC value for it's header and payload data.
> > >
> > > So the .crc member should be __be32 then?
> > >
> > I disagree with using __be32.
> > I have simplified this part of the code in v8 patch, please do check it out.
> > So the CRC part of the data structure will remain __le32, and will be sent
> over UART to the chip in Little Endian format.
> > It's just that the FW expects the CRC to be byte-swapped.
> > Technically it is big endian format, but you may think of it as a "+1 level" of
> encryption (although it isn't).
> > So defining this structure member as __be32 can create more questions
> > than answers, leading to more confusion.
> > If it helps, I have also added a small comment in there to signify
> > that the FW expects CRC in byte swapped method.
>
> I'd have still put the member as __be32 and commented the swap
> expectation there. But it's not an end of the world even in the current form.
This sounds okay to me. I have changed the CRC datatype to __be32 and kept the comment.
Thanks,
Neeraj
Powered by blists - more mailing lists