Skip to contentSkip to conversation

uwb: nxp: sr1xx: UWB driver support for sr1xx series chip

PATCH Superseded Manjunatha Venkatesh 2 participants 4 messages Mar 15, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 uwb: nxp: sr1xx: UWB driver support for sr1xx series chip

Ultra Wide Band(UWB) is a fast, secure and low power radio protocol used to determine location with accuracy unmatched by any other wireless technology.
Its a short-range wireless communication protocol. It uses radio waves to enable devices to talk to each other.

This is a new driver that supports the integrated UWB for Nxp SoCs, especially the sr1xx series and depends on the SPI module.

This driver works with Nxp UWB Subsystem(UWBS) which is FiRa Compliance. Corresponding UCI details available in Fira Consortuim website.

sr1xx is flash less UWBS and it requires firmware download on every device boot.

Internally driver will handle two modes of operation.
1.HBCI mode (sr1xx BootROM Code Interface)
Firmware download uses HBCI ptotocol packet structure which is Nxp proprietary,Firmware File(.bin) stored in user space context and during device init sequence pick the firmware packet in chunk and send it to the driver with write() api call.
Complete firmware download protocol logic implemented in user space, Driver used here is kind of pipe to send data to SPI line. Firmware acknowledge for every chunk packet sent and same thing is monitored,in user space code(HAL layer).
If any error Firmware download sequence will fail and reset the device. If firmware download packet sent successfully at the end device will send device status notification and its indication of device entered UCI mode.Here after any command/response/notification will follow UCI packet structure.

2.UCI mode (UWB Command interface)
Once Firmware download finishes sr1xx will switch to UCI mode packet structure.Here this driver acts as pipe between user space and sr1xx. Any response or notification received from sr1xx through SPI line will convey to user space.User space(UCI lib) will take care of UCI parsing logic.

Its IRQ based driver and sr1xx specific irq handshake mechanism logic implemented to avoid any race condition between write and read during ranging sequence.

UCI mode Write is same as HBCI mode sequence whatever command received from user space will send to the sr1xx via SPI line.
In UCI mode read api called first and waiting on the IRQ line status in order to avoid missing of interrupts after write sequence.

This driver needs dts config update as per the sr1xx data sheet. Corresponding document added in Documentation/devicetree/bindings/uwb

Changes since v1:
https://lkml.org/lkml/2022/3/7/1254

---
 MAINTAINERS          |   7 +
 drivers/Kconfig      |   2 +
 drivers/Makefile     |   1 +
 drivers/uwb/Kconfig  |  27 ++
 drivers/uwb/Makefile |   5 +
 drivers/uwb/sr1xx.c  | 857 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 899 insertions(+)
 create mode 100644 drivers/uwb/Kconfig
 create mode 100644 drivers/uwb/Makefile
 create mode 100644 drivers/uwb/sr1xx.c
MAINTAINERS +7 -0
index e127c2fb08a7..31c08ecc152c 100644
@@ -21471,3 +21471,10 @@ S:	Buried alive in reporters
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 F:	*
 F:	*/
+
+UWB
+M:	Greg KH <[email protected]>
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	drivers/uwb/sr1xx.c
drivers/Kconfig +2 -0
index 0d399ddaa185..26b3cb95923c 100644
@@ -236,4 +236,6 @@ source "drivers/interconnect/Kconfig"
 source "drivers/counter/Kconfig"
 
 source "drivers/most/Kconfig"
+
+source "drivers/uwb/Kconfig"
 endmenu
drivers/Makefile +1 -0
index a110338c860c..f13a30d7bc9f 100644
@@ -187,3 +187,4 @@ obj-$(CONFIG_GNSS)		+= gnss/
 obj-$(CONFIG_INTERCONNECT)	+= interconnect/
 obj-$(CONFIG_COUNTER)		+= counter/
 obj-$(CONFIG_MOST)		+= most/
+obj-$(CONFIG_UWB)		+= uwb/
drivers/uwb/Kconfig new file +27 -0
new file mode 100644
index 000000000000..1cdcf191a7f6
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Uwb driver configuration
+#
+menuconfig UWB
+        bool "Ultra Wide Band(UWB) support"
+        help
+         Support for UWB Protocol driver.
+
+         This driver is designed to support UCI(UWB Command Interface)
+          as per FiRa Compliance.
+
+
+          If unsure, say no.
+if UWB
+config NXP_UWB
+        tristate "Nxp UCI(Uwb Command Interface) protocol driver support"
+	depends on SPI
+        help
+          This option enables the UWB driver for Nxp sr1xx
+          device. Such device supports UCI packet structure,
+          FiRa compliance.
+
+          Say Y here to compile support for sr1xx into the kernel or
+          say M  to compile it as a module. The module will be called
+          sr1xx.ko.
+endif
drivers/uwb/Makefile new file +5 -0
new file mode 100644
index 000000000000..4f9fc91a7c35
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the uwb drivers.
+#
+obj-$(CONFIG_NXP_UWB) += sr1xx.o
drivers/uwb/sr1xx.c new file +857 -0

857 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw
Quoted 3 lines · Manjunatha Venkatesh

Ultra Wide Band(UWB) is a fast, secure and low power radio protocol used to determine location with accuracy unmatched by any other wireless technology.

The kernel changelog is not the place for marketing copy. Please just describe the hardware without using words like this.

Quoted 28 lines

Its a short-range wireless communication protocol. It uses radio waves to enable devices to talk to each other.

This is a new driver that supports the integrated UWB for Nxp SoCs, especially the sr1xx series and depends on the SPI module.

This driver works with Nxp UWB Subsystem(UWBS) which is FiRa Compliance. Corresponding UCI details available in Fira Consortuim website.

sr1xx is flash less UWBS and it requires firmware download on every device boot.

Internally driver will handle two modes of operation.
1.HBCI mode (sr1xx BootROM Code Interface)
Firmware download uses HBCI ptotocol packet structure which is Nxp proprietary,Firmware File(.bin) stored in user space context and during device init sequence pick the firmware packet in chunk and send it to the driver with write() api call.
Complete firmware download protocol logic implemented in user space, Driver used here is kind of pipe to send data to SPI line. Firmware acknowledge for every chunk packet sent and same thing is monitored,in user space code(HAL layer).
If any error Firmware download sequence will fail and reset the device. If firmware download packet sent successfully at the end device will send device status notification and its indication of device entered UCI mode.Here after any command/response/notification will follow UCI packet structure.

Quoted 6 lines

2.UCI mode (UWB Command interface)
Once Firmware download finishes sr1xx will switch to UCI mode packet structure.Here this driver acts as pipe between user space and sr1xx. Any response or notification received from sr1xx through SPI line will convey to user space.User space(UCI lib) will take care of UCI parsing logic.

Where is that userspace code? How will it talk to the kernel? Why do the existing user/kernel apis not sufice for this one random hardware device? We have support for wireless devices of all types today, why is this so special it needs a custom interface for it?

Quoted 36 lines

Its IRQ based driver and sr1xx specific irq handshake mechanism logic implemented to avoid any race condition between write and read during ranging sequence.

UCI mode Write is same as HBCI mode sequence whatever command received from user space will send to the sr1xx via SPI line.
In UCI mode read api called first and waiting on the IRQ line status in order to avoid missing of interrupts after write sequence.

This driver needs dts config update as per the sr1xx data sheet. Corresponding document added in Documentation/devicetree/bindings/uwb

Changes since v1:
https://lkml.org/lkml/2022/3/7/1254

---
 MAINTAINERS          |   7 +
 drivers/Kconfig      |   2 +
 drivers/Makefile     |   1 +
 drivers/uwb/Kconfig  |  27 ++
 drivers/uwb/Makefile |   5 +
 drivers/uwb/sr1xx.c  | 857 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 899 insertions(+)
 create mode 100644 drivers/uwb/Kconfig
 create mode 100644 drivers/uwb/Makefile
 create mode 100644 drivers/uwb/sr1xx.c
MAINTAINERS +0 -0
index e127c2fb08a7..31c08ecc152c 100644

MAINTAINERS S: Buried alive in reporters · line 21476

Quoted 6 lines
MAINTAINERS +3 -0
@@ -21471,3 +21471,10 @@ S:	Buried alive in reporters
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 F:	*
 F:	*/
+
+UWB
+M:	Greg KH <[email protected]>

Hah, NO!

MAINTAINERS S: Buried alive in reporters · line 21478

Quoted 2 lines
MAINTAINERS +2 -0
+M:	[email protected]
+L:	[email protected]

Full names.

MAINTAINERS S: Buried alive in reporters · line 21480

Quoted 2 lines
MAINTAINERS +2 -0
+S:	Maintained
+F:	drivers/uwb/sr1xx.c

This needs to be sorted properly. Please read the file you are modifying.

I'm stopping here. Don't add anyone's name to a MAINTAINERS file unless you get explicit permission from them to do so. Otherwise it is quite rude, don't you think?

{sigh}

greg k-h

#2 lore raw
Quoted 8 lines · Greg KH

Caution: EXT Email

Quoted 3 lines · Manjunatha Venkatesh

Ultra Wide Band(UWB) is a fast, secure and low power radio protocol used to determine location with accuracy unmatched by any other wireless technology.

The kernel changelog is not the place for marketing copy. Please just describe the hardware without using words like this.

Sure, will update the description as part of next patch.

Quoted 85 lines
Quoted 29 lines

Its a short-range wireless communication protocol. It uses radio waves to enable devices to talk to each other.

This is a new driver that supports the integrated UWB for Nxp SoCs, especially the sr1xx series and depends on the SPI module.

This driver works with Nxp UWB Subsystem(UWBS) which is FiRa Compliance. Corresponding UCI details available in Fira Consortuim website.

sr1xx is flash less UWBS and it requires firmware download on every device boot.

Internally driver will handle two modes of operation.
1.HBCI mode (sr1xx BootROM Code Interface)
Firmware download uses HBCI ptotocol packet structure which is Nxp proprietary,Firmware File(.bin) stored in user space context and during device init sequence pick the firmware packet in chunk and send it to the driver with write() api call.
Complete firmware download protocol logic implemented in user space, Driver used here is kind of pipe to send data to SPI line. Firmware acknowledge for every chunk packet sent and same thing is monitored,in user space code(HAL layer).
If any error Firmware download sequence will fail and reset the device. If firmware download packet sent successfully at the end device will send device status notification and its indication of device entered UCI mode.Here after any command/response/notification will follow UCI packet structure.

Quoted 6 lines

2.UCI mode (UWB Command interface)
Once Firmware download finishes sr1xx will switch to UCI mode packet structure.Here this driver acts as pipe between user space and sr1xx. Any response or notification received from sr1xx through SPI line will convey to user space.User space(UCI lib) will take care of UCI parsing logic.

Where is that userspace code? How will it talk to the kernel? Why do the existing user/kernel apis not sufice for this one random hardware device? We have support for wireless devices of all types today, why is this so special it needs a custom interface for it?

Quoted 33 lines

Its IRQ based driver and sr1xx specific irq handshake mechanism logic implemented to avoid any race condition between write and read during ranging sequence.

UCI mode Write is same as HBCI mode sequence whatever command received from user space will send to the sr1xx via SPI line.
In UCI mode read api called first and waiting on the IRQ line status in order to avoid missing of interrupts after write sequence.

This driver needs dts config update as per the sr1xx data sheet. Corresponding document added in Documentation/devicetree/bindings/uwb

Changes since v1:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.org%2Flkml%2F2022%2F3%2F7%2F1254&amp;data=04%7C01%7Cmanjunatha.venkatesh%40nxp.com%7C708a77e63b7d4a5aeca308da0677c19e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637829408669477610%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=54vIhj3naaT4MRXvX7nUXbaTgx%2BiLoG3NAkh1KqK8V4%3D&amp;reserved=0

---
  MAINTAINERS          |   7 +
  drivers/Kconfig      |   2 +
  drivers/Makefile     |   1 +
  drivers/uwb/Kconfig  |  27 ++
  drivers/uwb/Makefile |   5 +
  drivers/uwb/sr1xx.c  | 857 +++++++++++++++++++++++++++++++++++++++++++
  6 files changed, 899 insertions(+)

create mode 100644 drivers/uwb/Kconfig
create mode 100644 drivers/uwb/Makefile
create mode 100644 drivers/uwb/sr1xx.c

MAINTAINERS +0 -0
index e127c2fb08a7..31c08ecc152c 100644

MAINTAINERS S: Buried alive in reporters · line 21476

Quoted 6 lines
MAINTAINERS +3 -0
@@ -21471,3 +21471,10 @@ S:   Buried alive in reporters
  T:   git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  F:   *
  F:   */
+
+UWB
+M:   Greg KH <[email protected]>

Hah, NO!

MAINTAINERS S: Buried alive in reporters · line 21478

Quoted 2 lines
MAINTAINERS +2 -0
+M:   [email protected]
+L:   [email protected]

Full names.

Quoted 8 lines

MAINTAINERS S: Buried alive in reporters · line 21480

Quoted 2 lines
MAINTAINERS +2 -0
+S:   Maintained
+F:   drivers/uwb/sr1xx.c

This needs to be sorted properly. Please read the file you are modifying.

I'm stopping here. Don't add anyone's name to a MAINTAINERS file unless you get explicit permission from them to do so. Otherwise it is quite rude, don't you think?

Sorry, Next patch will remove your name from this list.

Quoted 4 lines

{sigh}

greg k-h

#3 lore raw
In reply to Manjunatha Venkatesh
Quoted 47 lines · Manjunatha Venkatesh

Ultra Wide Band(UWB) is a fast, secure and low power radio protocol used to determine location with accuracy unmatched by any other wireless technology.
Its a short-range wireless communication protocol. It uses radio waves to enable devices to talk to each other.

This is a new driver that supports the integrated UWB for Nxp SoCs, especially the sr1xx series and depends on the SPI module.

This driver works with Nxp UWB Subsystem(UWBS) which is FiRa Compliance. Corresponding UCI details available in Fira Consortuim website.

sr1xx is flash less UWBS and it requires firmware download on every device boot.

Internally driver will handle two modes of operation.
1.HBCI mode (sr1xx BootROM Code Interface)
Firmware download uses HBCI ptotocol packet structure which is Nxp proprietary,Firmware File(.bin) stored in user space context and during device init sequence pick the firmware packet in chunk and send it to the driver with write() api call.
Complete firmware download protocol logic implemented in user space, Driver used here is kind of pipe to send data to SPI line. Firmware acknowledge for every chunk packet sent and same thing is monitored,in user space code(HAL layer).
If any error Firmware download sequence will fail and reset the device. If firmware download packet sent successfully at the end device will send device status notification and its indication of device entered UCI mode.Here after any command/response/notification will follow UCI packet structure.

2.UCI mode (UWB Command interface)
Once Firmware download finishes sr1xx will switch to UCI mode packet structure.Here this driver acts as pipe between user space and sr1xx. Any response or notification received from sr1xx through SPI line will convey to user space.User space(UCI lib) will take care of UCI parsing logic.

Its IRQ based driver and sr1xx specific irq handshake mechanism logic implemented to avoid any race condition between write and read during ranging sequence.

UCI mode Write is same as HBCI mode sequence whatever command received from user space will send to the sr1xx via SPI line.
In UCI mode read api called first and waiting on the IRQ line status in order to avoid missing of interrupts after write sequence.

Quoted 7 lines

This driver needs dts config update as per the sr1xx data sheet. Corresponding document added in Documentation/devicetree/bindings/uwb

Changes since v1:
https://lkml.org/lkml/2022/3/7/1254

Always use lore.kernel.org links. Also the changelog goes below the --- line. This does not describe what changed, you are just pointing to a random place on the internet, which does not explain anything.

greg k-h