Re: [PATCH v4] staging: nrf24: add new driver for 2.4GHz radio transceiver

2019-02-23 Thread Greg Kroah-Hartman
On Fri, Feb 22, 2019 at 09:20:56PM +0100, Marcin Ciupak wrote:
> On Tue, Feb 19, 2019 at 11:20:10AM +0100, Greg Kroah-Hartman wrote:
> > On Wed, Feb 13, 2019 at 08:40:35PM +0100, Marcin Ciupak wrote:
> > > This patch adds driver for Nordic Semiconductor nRF24L01+ radio
> > > transceiver.
> > > 
> > > Signed-off-by: Marcin Ciupak 
> > > ---
> > > Changes in v2:
> > >   - add terminating newlines to all logging formats
> > > Changes in v3:
> > >   - patch subject
> > >   - comments cleanup
> > >   - goto labels cleanup
> > >   - scnprintf bugfix
> > >   - ida_simple_remove bugfix
> > > Changes in v4:
> > >   - fix smatch warnings
> > 
> > What is preventing this from being merged today with the normal
> > subsystem for this type of drivers?  Why does this have to go into
> > staging?
> > 
> > thanks,
> > 
> > greg k-h
> 
> As per TODO file:
> +Todo:
> +- opening and closing pipes via sysfs

That's not what sysfs is for, so that can't be a TODO item :)

> +- improve switching in between RX and TX
> +- improve handling of MAX_RT interrupt

That's just logic cleanup, no reason to have it in staging.

> +- find and fix bugs

Same here.

> +- code cleanup

What specifically do you mean by this?  And why can't you just spend a
day and do it now?

> 
> Additionally, I would like to add ioctl (or any similar) interface
> as configuration via sysfs is not very efficent in here.

sysfs is not for configuration, that is what configfs is for, please use
that instead.

> My beliefes are that this driver needs some time in staging, but I might
> be wrong and if you believe otherwise just let me know and I will try to
> push it ti regular sybsystem.

I think you need to use the standard apis that the kernel has for
drivers like this (v4l?) and work on getting the driver into the proper
subsystem first.  I don't see what the goal of getting it into staging
is going to do to help you out with that.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] staging: nrf24: add new driver for 2.4GHz radio transceiver

2019-02-22 Thread Marcin Ciupak
On Tue, Feb 19, 2019 at 11:20:10AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Feb 13, 2019 at 08:40:35PM +0100, Marcin Ciupak wrote:
> > This patch adds driver for Nordic Semiconductor nRF24L01+ radio
> > transceiver.
> > 
> > Signed-off-by: Marcin Ciupak 
> > ---
> > Changes in v2:
> >   - add terminating newlines to all logging formats
> > Changes in v3:
> >   - patch subject
> >   - comments cleanup
> >   - goto labels cleanup
> >   - scnprintf bugfix
> >   - ida_simple_remove bugfix
> > Changes in v4:
> >   - fix smatch warnings
> 
> What is preventing this from being merged today with the normal
> subsystem for this type of drivers?  Why does this have to go into
> staging?
> 
> thanks,
> 
> greg k-h

As per TODO file:
+Todo:
+- opening and closing pipes via sysfs
+- improve switching in between RX and TX
+- improve handling of MAX_RT interrupt
+- find and fix bugs
+- code cleanup

Additionally, I would like to add ioctl (or any similar) interface
as configuration via sysfs is not very efficent in here.

My beliefes are that this driver needs some time in staging, but I might
be wrong and if you believe otherwise just let me know and I will try to
push it ti regular sybsystem.

Thanks,
Marcin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] staging: nrf24: add new driver for 2.4GHz radio transceiver

2019-02-19 Thread Greg Kroah-Hartman
On Wed, Feb 13, 2019 at 08:40:35PM +0100, Marcin Ciupak wrote:
> This patch adds driver for Nordic Semiconductor nRF24L01+ radio
> transceiver.
> 
> Signed-off-by: Marcin Ciupak 
> ---
> Changes in v2:
>   - add terminating newlines to all logging formats
> Changes in v3:
>   - patch subject
>   - comments cleanup
>   - goto labels cleanup
>   - scnprintf bugfix
>   - ida_simple_remove bugfix
> Changes in v4:
>   - fix smatch warnings

What is preventing this from being merged today with the normal
subsystem for this type of drivers?  Why does this have to go into
staging?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] staging: nrf24: add new driver for 2.4GHz radio transceiver

2019-02-13 Thread Marcin Ciupak
This patch adds driver for Nordic Semiconductor nRF24L01+ radio
transceiver.

Signed-off-by: Marcin Ciupak 
---
Changes in v2:
  - add terminating newlines to all logging formats
Changes in v3:
  - patch subject
  - comments cleanup
  - goto labels cleanup
  - scnprintf bugfix
  - ida_simple_remove bugfix
Changes in v4:
  - fix smatch warnings

drivers/staging/Kconfig   |   2 +
 drivers/staging/Makefile  |   1 +
 drivers/staging/nrf24/Kconfig |  16 +
 drivers/staging/nrf24/Makefile|   3 +
 drivers/staging/nrf24/TODO|   7 +
 .../nrf24/devicetree/nrf24-spi0-overlay.dts   |  54 ++
 .../nrf24/devicetree/nrf24-spi1-overlay.dts   |  54 ++
 drivers/staging/nrf24/devicetree/nrf24.txt|   1 +
 drivers/staging/nrf24/nRF24L01.h  |  82 ++
 drivers/staging/nrf24/nrf24_enums.h   |  60 ++
 drivers/staging/nrf24/nrf24_hal.c | 764 +++
 drivers/staging/nrf24/nrf24_hal.h |  54 ++
 drivers/staging/nrf24/nrf24_if.c  | 893 ++
 drivers/staging/nrf24/nrf24_if.h  |  63 ++
 drivers/staging/nrf24/nrf24_sysfs.c   | 707 ++
 drivers/staging/nrf24/nrf24_sysfs.h   |  14 +
 16 files changed, 2775 insertions(+)
 create mode 100644 drivers/staging/nrf24/Kconfig
 create mode 100644 drivers/staging/nrf24/Makefile
 create mode 100644 drivers/staging/nrf24/TODO
 create mode 100644 drivers/staging/nrf24/devicetree/nrf24-spi0-overlay.dts
 create mode 100644 drivers/staging/nrf24/devicetree/nrf24-spi1-overlay.dts
 create mode 100644 drivers/staging/nrf24/devicetree/nrf24.txt
 create mode 100644 drivers/staging/nrf24/nRF24L01.h
 create mode 100644 drivers/staging/nrf24/nrf24_enums.h
 create mode 100644 drivers/staging/nrf24/nrf24_hal.c
 create mode 100644 drivers/staging/nrf24/nrf24_hal.h
 create mode 100644 drivers/staging/nrf24/nrf24_if.c
 create mode 100644 drivers/staging/nrf24/nrf24_if.h
 create mode 100644 drivers/staging/nrf24/nrf24_sysfs.c
 create mode 100644 drivers/staging/nrf24/nrf24_sysfs.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index c0901b96cfe4..8473823aaa6f 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -124,4 +124,6 @@ source "drivers/staging/axis-fifo/Kconfig"
 
 source "drivers/staging/erofs/Kconfig"
 
+source "drivers/staging/nrf24/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 57c6bce13ff4..10709ab6f42c 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -52,3 +52,4 @@ obj-$(CONFIG_SOC_MT7621)  += mt7621-dts/
 obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket/
 obj-$(CONFIG_XIL_AXIS_FIFO)+= axis-fifo/
 obj-$(CONFIG_EROFS_FS) += erofs/
+obj-$(CONFIG_NRF24)+= nrf24/
diff --git a/drivers/staging/nrf24/Kconfig b/drivers/staging/nrf24/Kconfig
new file mode 100644
index ..67ebf14dd982
--- /dev/null
+++ b/drivers/staging/nrf24/Kconfig
@@ -0,0 +1,16 @@
+config NRF24
+tristate "nRF24L01+ 2.4GHz radio module support"
+depends on SPI
+help
+  This enables support for Nordic Semiconductor nRF24L01+ radio module,
+  with the following features:
+- multiple radio module instances via nrfX
+- dedicated /dev/nrfX.Y device per pipe per instance
+- dynamic and static payload lengths
+- configuration via sysfs (/sys/class/nrfX)
+- poll mechanism
+- 64kB RX FIFO per pipe
+- 64kB TX FIFO
+
+  To compile this driver as a module, choose M here: the module will be
+  called nrf24.
diff --git a/drivers/staging/nrf24/Makefile b/drivers/staging/nrf24/Makefile
new file mode 100644
index ..f5222567c632
--- /dev/null
+++ b/drivers/staging/nrf24/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_NRF24) += nrf24.o
+
+nrf24-objs := nrf24_if.o nrf24_hal.o nrf24_sysfs.o
diff --git a/drivers/staging/nrf24/TODO b/drivers/staging/nrf24/TODO
new file mode 100644
index ..a089e43faac5
--- /dev/null
+++ b/drivers/staging/nrf24/TODO
@@ -0,0 +1,7 @@
+Todo:
+- opening and closing pipes via sysfs
+- improve switching in between RX and TX
+- improve handling of MAX_RT interrupt
+- find and fix bugs
+- code cleanup
+
diff --git a/drivers/staging/nrf24/devicetree/nrf24-spi0-overlay.dts 
b/drivers/staging/nrf24/devicetree/nrf24-spi0-overlay.dts
new file mode 100644
index ..130e6787b76d
--- /dev/null
+++ b/drivers/staging/nrf24/devicetree/nrf24-spi0-overlay.dts
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//
+// Copyright (C) 2017 Marcin Ciupak 
+//
+
+// Definitions for NRF24
+/dts-v1/;
+/plugin/;
+
+/ {
+   compatible = "bcm,bcm2835", "bcm,bcm2708", "bcm,bcm2709";
+
+   fragment@0 {
+   target = <&spi0>;
+   __overlay__ {
+   #address-cells = <1>;
+   #size-cell