[PATCH lora-next 00/11] net: lora: Get SX130x to transmit lora packets

2019-01-28 Thread Ben Whitten
est transmission with real values and has been tested to show changing bandwidths. To perform testing a tx_test [4] was used to show changing parameters on a spectrum analyser. We also add patches to the defaults in the SX130x to fill in a TODO in our initialisation. Thanks, Ben Whitten [1] h

[PATCH lora-next 02/11] net: lora: sx130x: add loading of tx lut from DT

2019-01-28 Thread Ben Whitten
From: Ben Whitten The AGC software requires loading of a power lookup table on initialisation prior to transmission. The fields required are digital, pa, dac, and mixer gain. These values are typically hardware specific and calibrated for a particular power output at the card rf port. The format

[PATCH lora-next 01/11] dt-bindings: net: lora: sx130x: add power lut binding

2019-01-28 Thread Ben Whitten
From: Ben Whitten Adding power lookup table for the concentrator specified in DT. These values are calibrated for the hardware and are unique to hardware designs and certifications. First byte is signed power in dBm measured at the rf connector. Second byte is unsigned value for DIGITAL gain

[PATCH lora-next 04/11] net: lora: sx130x: add helper function for writing to the SX130x MCU

2019-01-28 Thread Ben Whitten
From: Ben Whitten The transaction to the internal MCU starts with CMD_WAIT to start a transaction, written to CHRS followed by writing the value, the status of the command is read back from AGCSTS. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 28

[PATCH lora-next 06/11] net: lora: sx130x: add detail to TODO in setup

2019-01-28 Thread Ben Whitten
From: Ben Whitten Setup requires a more steps to be complete, call these out specifically so they are not missed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/lora/sx130x.c b/drivers/net

[PATCH lora-next 03/11] net: lora: sx130x: add CHRS to volatile register list

2019-01-28 Thread Ben Whitten
From: Ben Whitten The CHRS register is used in transactions to the MCU within the SX130x, we need to always write to it. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/lora/sx130x.c b/drivers/net/lora/sx130x.c index

[PATCH lora-next 05/11] net: lora: sx130x: initialise AGC

2019-01-28 Thread Ben Whitten
From: Ben Whitten Initialisation of the AGC firmware requires a couple of steps to be completed; - Loading a TX LUT - Loading the two MSBs for the radio tx synthesizer frequencies, (Always 3 if f > 768 for SX1257 and SX1258 or f > 384 for SX1255) - Loading a firmware option -

[PATCH lora-next 10/11] net: lora: sx130x: make use of lora address metadata in transmission

2019-01-28 Thread Ben Whitten
We take the metadata encoded in the lora address and apply it to the outgoing transmission. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 58 --- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/drivers/net/lora/sx130x.c b/drivers

[PATCH lora-next 07/11] net: lora: sx130x: add work queue to tx path

2019-01-28 Thread Ben Whitten
As we are not allowed to sleep in _start_xmit, we need to add a work queue to handle transmission of the packets. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 50 ++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/net/lora

[PATCH lora-next 09/11] net: lora: introduce lora socket addressing for metadata

2019-01-28 Thread Ben Whitten
Information such as spreading factor, coding rate and power are on a per transmission basis so we can encode this information in the lora socket address. In future we may have a different format for receive with additional fields which get populated. Signed-off-by: Ben Whitten --- include/linux

[PATCH lora-next 11/11] net: lora: sx130x: add patch to register fields

2019-01-28 Thread Ben Whitten
The SX130x chips require a number of constant adjustments and patches. We add the fields for the registers which require patches, add patch values then add a helper to patch fields. Removing one TODO. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 131

[PATCH lora-next 08/11] net: lora: sx130x: add test transmission

2019-01-28 Thread Ben Whitten
First transmission from the SX130x, all metadata values are hardcoded and will be replaced with a suitable alternative. Data sent into the socket is sent straight out of the card. Signed-off-by: Ben Whitten --- drivers/net/lora/sx130x.c | 128 +- drivers/net

Re: [PATCH v3 lora-next 4/4] dt-bindings: lora: sx130x: add clock bindings

2019-01-24 Thread Ben Whitten
Missed linux-lpwan On Thu, 24 Jan 2019 at 14:53, Ben Whitten wrote: > > From: Ben Whitten > > The SX130x family consumes two clocks, a 32 MHz clock provided by a > connected IQ transceiver, and a 133 MHz high speed clock. > It also provides a 32 MHz clock out to the radio in t

Re: [PATCH v3 lora-next 3/4] dt-bindings: lora: sx125x: add clock bindings

2019-01-24 Thread Ben Whitten
Missed linux-lpwan On Thu, 24 Jan 2019 at 14:53, Ben Whitten wrote: > > From: Ben Whitten > > The SX125x consumes a clock (FXOSC) ranging from 32 to 36 MHz as its main > XTAL. It may also consume a clock for the TX synthesizer or DAC input clock > (FCLK_IN). > If the rad

Re: [PATCH v3 lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

2019-01-24 Thread Ben Whitten
Missed linux-lpwan On Thu, 24 Jan 2019 at 14:53, Ben Whitten wrote: > > From: Ben Whitten > > The SX125x family are IQ radio transceivers from Semtech configured over > SPI, they are typically connected to an SX130x series concentrator however > may be connected to a host dire

Re: [PATCH v3 lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-24 Thread Ben Whitten
Missed linux-lpwan On Thu, 24 Jan 2019 at 14:53, Ben Whitten wrote: > > From: Ben Whitten > > Add basic documentation in YAML format for the SX130x series concentrators > from Semtech. > Required is; the location on the SPI bus and the compatible string. > > Si

Re: [PATCH v3 lora-next 0/4] net: lora: Add documentation for SX130x and SX125x parts

2019-01-24 Thread Ben Whitten
Missed linux-lpwan On Thu, 24 Jan 2019 at 14:53, Ben Whitten wrote: > > Hello, > > This series adds documentation for the SX130x and SX125x chips. > We are using the yaml binding format and this series builds with > 'make dt_binding_check'. > > This s

[PATCH v3 lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-24 Thread Ben Whitten
From: Ben Whitten Add basic documentation in YAML format for the SX130x series concentrators from Semtech. Required is; the location on the SPI bus and the compatible string. Signed-off-by: Ben Whitten --- v2 -> v3: * Corrected fallback notation * Limited radio node names from anything

[PATCH v3 lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

2019-01-24 Thread Ben Whitten
From: Ben Whitten The SX125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an SX130x series concentrator however may be connected to a host directly. Required properties include the radio number of the host or concentrator bus. Signed-off-by

[PATCH v3 lora-next 0/4] net: lora: Add documentation for SX130x and SX125x parts

2019-01-24 Thread Ben Whitten
em running clk over spi backed regmaps on certain spi controller drivers [1] Thanks, Ben Whitten v2 -> v3 * Added the clock input and output names * Limited the radio-spi node children names to radio@ * Fixed fallback compatible for SX1308 -> SX1301 v1 -> v2 * Dropped reset-gpios, radi

[PATCH v3 lora-next 3/4] dt-bindings: lora: sx125x: add clock bindings

2019-01-24 Thread Ben Whitten
From: Ben Whitten The SX125x consumes a clock (FXOSC) ranging from 32 to 36 MHz as its main XTAL. It may also consume a clock for the TX synthesizer or DAC input clock (FCLK_IN). If the radio is coupled with an SX130x the radio is therefor operating in master mode and it may also provide a gated

[PATCH v3 lora-next 4/4] dt-bindings: lora: sx130x: add clock bindings

2019-01-24 Thread Ben Whitten
From: Ben Whitten The SX130x family consumes two clocks, a 32 MHz clock provided by a connected IQ transceiver, and a 133 MHz high speed clock. It also provides a 32 MHz clock out to the radio in the TX path. In the example we connect the concentrator to a fixed clock providing the 133 MHz high

Re: [PATCH v2 lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-22 Thread Ben Whitten
Hi, On 22/01/2019 20:04, Rob Herring wrote: On Tue, Jan 22, 2019 at 12:07 PM Ben Whitten wrote: From: Ben Whitten Add basic documentation in YAML format for the SX130x series concentrators from Semtech. Required is; the location on the SPI bus and the compatible string. Signed-off-by: Ben

[PATCH v2 lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-22 Thread Ben Whitten
From: Ben Whitten Add basic documentation in YAML format for the SX130x series concentrators from Semtech. Required is; the location on the SPI bus and the compatible string. Signed-off-by: Ben Whitten --- v1 -> v2: * Dropped reset-gpios, radio-spi from required. * Dropped spi-max-freque

[PATCH v2 lora-next 0/4] net: lora: Add documentation for SX130x and SX125x parts

2019-01-22 Thread Ben Whitten
Hello, This series adds documentation for the SX130x and SX125x chips. We are using the yaml binding format and this series builds with 'make dt_binding_check'. Thanks, Ben Whitten Ben Whitten (4): dt-bindings: lora: sx130x: add basic documentation dt-bindings: lora: sx125x:

[PATCH v2 lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

2019-01-22 Thread Ben Whitten
From: Ben Whitten The SX125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an SX130x series concentrator however may be connected to a host directly. Required properties include the radio number of the host or concentrator bus. Signed-off-by

[PATCH v2 lora-next 3/4] dt-bindings: lora: sx125x: add clock bindings

2019-01-22 Thread Ben Whitten
From: Ben Whitten The SX125x consumes a clock (FXOSC) ranging from 32 to 36 MHz. If the radio is coupled with an SX130x the radio is therefor operating in master mode and it may also provide a gated version of this clock for the concentrator. In this case the concentrator is expecting a 32 MHz

[PATCH v2 lora-next 4/4] dt-bindings: lora: sx130x: add clock bindings

2019-01-22 Thread Ben Whitten
From: Ben Whitten The SX130x family consumes two clocks, a 32 MHz clock provided by a connected IQ transceiver, and a 133 MHz high speed clock. In the example we connect the concentrator to a fixed clock providing the 133 MHz high speed clock, and we connect to a connected transceiver 32 MHz

RE: [PATCH lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

2019-01-16 Thread Ben Whitten
Hi Andreas, > Am 08.01.19 um 09:41 schrieb Ben Whitten: > > The sx125x family are IQ radio transceivers from Semtech configured over > > SPI, they are typically connected to an sx130x series concentrator however > > may be connected to a host directly. >

RE: [PATCH lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-16 Thread Ben Whitten
Hi Andreas, > Am 08.01.19 um 09:41 schrieb Ben Whitten: > > Add basic documentation in YAML format for the sx130x series concentrators > > from Semtech. > > Required is; the location on the SPI bus, the reset gpio and the node for > > downstream IQ radios, typically sx

[PATCH lora-next 3/4] dt-bindings: lora: sx125x: add clock bindings

2019-01-08 Thread Ben Whitten
s = <0>", named "clk32m" for consumption by the sx130x concentrator. Signed-off-by: Ben Whitten --- .../{ => net}/lora/semtech,sx125x.yaml| 27 +++ 1 file changed, 27 insertions(+) rename Documentation/devicetree/bindings/{ => net}/lora/semtech,sx12

[PATCH lora-next 4/4] dt-bindings: lora: sx130x: add clock bindings

2019-01-08 Thread Ben Whitten
clock. The connected radios are both fed from output 0 of a fixed 32MHz clock, with only one being the clock source back with one output to the sx130x concentrator. Signed-off-by: Ben Whitten --- .../{ => net}/lora/semtech,sx130x.yaml| 39 ++- 1 file changed, 38 inserti

[PATCH lora-next 1/4] dt-bindings: lora: sx130x: add basic documentation

2019-01-08 Thread Ben Whitten
Add basic documentation in YAML format for the sx130x series concentrators from Semtech. Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x. Signed-off-by: Ben Whitten --- .../bindings/lora/semtech,sx130x.yaml | 87

[PATCH lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

2019-01-08 Thread Ben Whitten
The sx125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an sx130x series concentrator however may be connected to a host directly. Required properties include the radio number of the host or concentrator bus. Signed-off-by: Ben Whitten

Re: [PATCH lora-next 3/5] net: lora: sx130x: Add PicoCell serdev driver

2019-01-05 Thread Ben Whitten
;Removed\n"); +} + +static const struct of_device_id picogw_serdev_of_match[] = { + { .compatible = "semtech,lora-picocell" }, lora-picocell or lora-picogw... picocell has mobile connotations, should we match the module name? + {} +}; +MODULE_DEVICE_TABLE(of, picogw_serdev_of_match); + +static struct serdev_device_driver picogw_serdev_driver = { + .probe = picogw_serdev_probe, + .remove = picogw_serdev_remove, + .driver = { + .name = "lora-picogw", + .of_match_table = picogw_serdev_of_match, + }, +}; + +static int __init picogw_serdev_init(void) +{ + int ret; + + ret = serdev_device_driver_register(&picogw_serdev_driver); + if (ret) { + pr_err("serdev_device_driver_register failed (%d)", ret); + return ret; + } + + return 0; +} +module_init(picogw_serdev_init); + +static void __exit picogw_serdev_exit(void) +{ + serdev_device_driver_unregister(&picogw_serdev_driver); +} +module_exit(picogw_serdev_exit); + +MODULE_LICENSE("GPL"); Thanks, Ben Whitten

Re: [PATCH RFC lora-next 1/4] net: lora: sx125x sx1301: correct style warnings

2019-01-04 Thread Ben Whitten
Hi Andreas, On 29/12/2018 09:05, Andreas Färber wrote: Hi Ben, Am 19.12.18 um 16:56 schrieb Ben Whitten: Checkpatch highlights some style issues which need to be addressed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 20 +-- drivers/net/lora/sx1301.c | 52

Re: [PATCH RFC lora-next 2/4] net: lora: sx1301: add minimal to get AGC working prior to tx work

2019-01-04 Thread Ben Whitten
On 29/12/2018 09:58, Andreas Färber wrote: Hi Ben, Am 19.12.18 um 16:56 schrieb Ben Whitten: As part of initialisation when opening the lora device after loading the AGC firmware we need to satisfy its startup procedure which involves a few steps; Loading a 16 entry lookup table. For this

RE: [PATCH v5 5/6] net: maclorawan: Implement maclorawan class module

2018-12-20 Thread Ben Whitten
> > > Am 18.12.18 um 15:27 schrieb Jian-Hong Pan: > > > >> Sun, Dec 16, 2018 at 11:18:59AM CET, starni...@g.ncu.edu.tw wrote: > > > >>> LoRaWAN defined by LoRa Alliance(TM) is the MAC layer over LoRa > > > devices. > > > >>> > > > >>> This patch implements part of Class A end-devices SoftMAC define

[PATCH RFC lora-next 1/4] net: lora: sx125x sx1301: correct style warnings

2018-12-19 Thread Ben Whitten
Checkpatch highlights some style issues which need to be addressed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 20 +-- drivers/net/lora/sx1301.c | 52 ++- drivers/net/lora/sx1301.h | 7 +++--- 3 files changed, 45 insertions(+), 34

[PATCH RFC lora-next 2/4] net: lora: sx1301: add minimal to get AGC working prior to tx work

2018-12-19 Thread Ben Whitten
investigation on how other devices load calibration data. Selecting the correct channel to transmit on. Currently always 0 for the reference design. Then ending the AGC init procedure and seeing that it has come up. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 254

[PATCH RFC lora-next 4/4] net: lora: sx1301: introduce a lora frame for packet metadata

2018-12-19 Thread Ben Whitten
Information such as spreading factor, coding rate and power are on a per transmission basis so it makes sence to include this in a header much like CAN frames do. Signed-off-by: Ben Whitten --- drivers/net/lora/dev.c| 2 - drivers/net/lora/sx1301.c | 79

[PATCH RFC lora-next 3/4] net: lora: sx1301: add minimal to get transmission out

2018-12-19 Thread Ben Whitten
as coding rate, spreading factor and power into the transmission. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 166 +- drivers/net/lora/sx1301.h | 21 + 2 files changed, 186 insertions(+), 1 deletion(-) diff --git a/drivers/net/lora/sx1301.c

[PATCH RFC lora-next 0/4] Get sx1301 to transmit lora packets

2018-12-19 Thread Ben Whitten
://github.com/BWhitten/lora-modules/blob/master/tx_test.c Ben Whitten (4): net: lora: sx125x sx1301: correct style warnings net: lora: sx1301: add minimal to get AGC working prior to tx work net: lora: sx1301: add minimal to get transmission out net: lora: sx1301: introduce a lora frame for packet

RE: [PATCH v5 5/6] net: maclorawan: Implement maclorawan class module

2018-12-19 Thread Ben Whitten
r transmission such as; frequency, spreading factor / data rate, power, are given by a remote server and passed in from the userspace application which received it. Eventually in the kernel these need to be checked locally to ensure regulatory compliance. To that end I have experimented with framing, as CAN does, so that this metadata can be provided on a write from userspace to the SX1301 driver. Sounds like we need different protocols for framing within the protocol family. Raw in the case of nodes and framed with metadata in the case of concentrator cards, thoughts? I will send my experiment RFC to the lpwan mailing list. Regards, Ben Whitten

[lora-next RFC] Socket details for PF_LORA on sx1301

2018-11-05 Thread Ben Whitten
additional info down to the lora portion of the socket, setsockopts? Thanks, Ben Whitten

[PATCH v3 lora-next 2/5] net: lora: sx1301: replace burst spi functions with regmap_noinc

2018-10-12 Thread Ben Whitten
We can now use to regmap_noinc API to allow reading and writing to the internal FIFO register which controls processor memory. We also remove the now defunct spi element from the structure as this completes the move to regmap. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 22

[PATCH v3 lora-next 3/5] net: lora: sx1301: convert to using regmap fields for bit ops

2018-10-12 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 234 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH v3 lora-next 4/5] net: lora: sx125x: convert to regmap fields

2018-10-12 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

[PATCH v3 lora-next 5/5] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-10-12 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided by

[PATCH v3 lora-next 0/5] based on 4.19-rc7 migration to regmap and clk framewor

2018-10-12 Thread Ben Whitten
probed ip link set lora0 up sx125x_con spi0.0-b: enabling clkout Ben Whitten (5): regmap: Add regmap_noinc_write API net: lora: sx1301: replace burst spi functions with regmap_noinc net: lora: sx1301: convert to using regmap fields for bit ops net: lora: sx125x: convert to regmap fields net

RE: [PATCH v2 lora-next 1/4] net: lora: sx1301: convert burst spi functions to regmap raw

2018-10-10 Thread Ben Whitten
> Subject: Re: [PATCH v2 lora-next 1/4] net: lora: sx1301: > convert burst spi functions to regmap raw > > Hi Ben and Mark, > > Am 09.10.18 um 14:52 schrieb Ben Whitten: > > As we have caching disabled we can access the regmap > using raw for our > > firmware r

[PATCH v2 lora-next 0/4] migration to regmap and clk framework

2018-10-09 Thread Ben Whitten
0.0-b: enabling clkout Ben Whitten (4): net: lora: sx1301: convert burst spi functions to regmap raw net: lora: sx1301: convert to using regmap fields for bit ops net: lora: sx125x: convert to regmap fields net: lora: sx125x sx1301: allow radio to register as a clk provider drivers/net

[PATCH v2 lora-next 2/4] net: lora: sx1301: convert to using regmap fields for bit ops

2018-10-09 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 240 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH v2 lora-next 1/4] net: lora: sx1301: convert burst spi functions to regmap raw

2018-10-09 Thread Ben Whitten
As we have caching disabled we can access the regmap using raw for our firmware reading and writing bursts. We also remove the now defunct spi element from the structure as this completes the move to regmap. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 26

[PATCH v2 lora-next 3/4] net: lora: sx125x: convert to regmap fields

2018-10-09 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

[PATCH v2 lora-next 4/4] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-10-09 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided by

[PATCH lora-next 3/3] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-08-22 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided by

[PATCH lora-next 1/3] net: lora: sx1301: convert to using regmap fields for bit ops

2018-08-22 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 240 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH lora-next 2/3] net: lora: sx125x: convert to regmap fields

2018-08-22 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

Re: [PATCH lora-next v2 8/8] net: lora: sx1301: convert driver over to regmap reads and writes

2018-08-09 Thread Ben Whitten
On Thu, 9 Aug 2018 at 23:34, Andreas Färber wrote: > > Am 09.08.2018 um 14:33 schrieb Ben Whitten: > > The reads and writes are replaced with regmap versions and unneeded > > functions, variable, and defines removed. > > > > Signed-off-by: Ben Whitten > > ---

Re: [PATCH lora-next v2 3/8] net: lora: sx1301: convert to passing priv data throughout

2018-08-09 Thread Ben Whitten
On Thu, 9 Aug 2018 at 21:43, Andreas Färber wrote: > > Am 09.08.2018 um 14:33 schrieb Ben Whitten: > > Instead of passing around the spi device we instead pass around our > > driver data directly. > > > > Signed-off-by: Ben Whitten > > ---

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-09 Thread Ben Whitten
> To: Ben Whitten ; Ben > Whitten > Cc: starni...@g.ncu.edu.tw; hasnain.v...@arm.com; > netdev@vger.kernel.org; Xue Liu > ; Sebastian Heß > > Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > + Xue Liu

[PATCH lora-next v2 7/8] net: lora: sx1301: add initial registration for regmap

2018-08-09 Thread Ben Whitten
ter priv and regmap allocation. Further registers or fields are added as they are required in conversion. Signed-off-by: Ben Whitten --- drivers/net/lora/Kconfig | 1 + drivers/net/lora/sx1301.c | 46 ++ drivers/net/lora/sx1301.h | 10 ++ 3 file

[PATCH lora-next v2 8/8] net: lora: sx1301: convert driver over to regmap reads and writes

2018-08-09 Thread Ben Whitten
The reads and writes are replaced with regmap versions and unneeded functions, variable, and defines removed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 204 +++--- drivers/net/lora/sx1301.h | 30 +++ 2 files changed, 95 insertions

[PATCH lora-next v2 1/8] net: lora: add methods for devm registration

2018-08-09 Thread Ben Whitten
Follow the devm model so that we can avoid lengthy unwind code. Signed-off-by: Ben Whitten --- drivers/net/lora/dev.c | 28 include/linux/lora/dev.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c index

[PATCH lora-next v2 6/8] net: lora: sx1301: replace version and size magic numbers with defines

2018-08-09 Thread Ben Whitten
We replace the hard coded numbers for size and version with meaningful names. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 21 + drivers/net/lora/sx1301.h | 18 ++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 drivers/net

[PATCH lora-next v2 4/8] net: lora: sx1301: convert load_firmware to take firmware directly

2018-08-09 Thread Ben Whitten
We just pass the pointer to firmware down to the function that loads it. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c index 7324001..3f2a532

[PATCH lora-next v2 5/8] net: lora: sx1301: remove duplicate firmware size checks

2018-08-09 Thread Ben Whitten
No need to check the size of the firmware multiple times, just do it once in the function responsible for loading as the firmwares are the same size. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 21 +++-- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git

[PATCH lora-next v2 2/8] net: lora: sx1301: convert to devm registration of netdev

2018-08-09 Thread Ben Whitten
We allow the devres framework handle the clean removal of resources on teardown of the device, in this case the SPI device, saving lengthy unwind code and improving clarity. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 87 +++ 1 file

[PATCH lora-next v2 3/8] net: lora: sx1301: convert to passing priv data throughout

2018-08-09 Thread Ben Whitten
Instead of passing around the spi device we instead pass around our driver data directly. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 305 +++--- 1 file changed, 155 insertions(+), 150 deletions(-) diff --git a/drivers/net/lora/sx1301.c b

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 08.08.2018 um 14:32 schrieb Ben Whitten: > >>> drivers/net/lora/Kconfig | 1 + > >>&

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > From: Ben Whitten > > > > The register and bit-field definitions are taken from the > SX1301 > >

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > diff --git a/drivers/net/lora/sx1301.c > b/drivers/net/lora/sx1301.c > > index 5342b61..49958f0 100644 > &

Re: [RFC] spi: add spi multiplexing functions for dt

2018-08-07 Thread Ben Whitten
On Tue, 7 Aug 2018 at 22:17, Andreas Färber wrote: > > Hi Ben, > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > Like I2C busses SPI devices can also sit behind multiplexers. > > This patch adds is based off the I2C implementation and allows > > description in the

[PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-07 Thread Ben Whitten
From: Ben Whitten The register and bit-field definitions are taken from the SX1301 datasheet version 2.01 dated June 2014 with the revision information 'First released version'. The reset state and RW capability of each field is not reflected in this patch however from the datasheet:

[PATCH lora-next 08/10] net: lora: sx1301: convert read and write to priv pointer

2018-08-07 Thread Ben Whitten
From: Ben Whitten Convert the next layer of read and writes to our private pointer, once again compatiblity later in the page read and write layer. The page functions will be removed with this full stack as page switches are handled by regmap automatically. Signed-off-by: Ben Whitten

[PATCH lora-next 04/10] net: lora: sx1301: convert probe function to regmap access

2018-08-07 Thread Ben Whitten
From: Ben Whitten Keeping change sets small we convert the probe function over to regmap and regmap_field access for initialisation. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 155 +- drivers/net/lora/sx1301.h | 7 +++ 2 files

[PATCH lora-next 02/10] net: lora: add methods for devm registration

2018-08-07 Thread Ben Whitten
From: Ben Whitten Follow the devm model so that we can avoid lengthy unwind code. Signed-off-by: Ben Whitten --- drivers/net/lora/dev.c | 20 include/linux/lora/dev.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c

[PATCH lora-next 03/10] net: lora: sx1301: convert to devm registration of netdev

2018-08-07 Thread Ben Whitten
From: Ben Whitten We allow the devres framework handle the clean removal of resources on teardown of the device, in this case the SPI device, saving lengthy unwind code and improving clarity. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 87

[PATCH lora-next 05/10] net: lora: sx1301: add device to private data and convert ram reads

2018-08-07 Thread Ben Whitten
From: Ben Whitten It's easier to simply add a pointer to our device to our private data, this way we can avoid passing around our spi_device and instead just pass private data which is more flexible. As its a two line change its coupled with converting AGC and ARB ram reads to regmap func

[RFC] spi: add spi multiplexing functions for dt

2018-08-07 Thread Ben Whitten
Like I2C busses SPI devices can also sit behind multiplexers. This patch adds is based off the I2C implementation and allows description in the devicetree. Signed-off-by: Ben Whitten --- drivers/spi/Kconfig | 10 +++ drivers/spi/Makefile| 3 + drivers/spi/spi-mux.c | 181

[PATCH lora-next 09/10] net: lora: sx1301: convert agc calibrate to regmap functions

2018-08-07 Thread Ben Whitten
From: Ben Whitten We convert the AGC calibration function over to regmap and take the opportunity to make the expected firmware versions defines. Switch to taking a pointer to our private data. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 101

[PATCH lora-next 07/10] net: lora: sx1301: convert read and write burst to take priv data

2018-08-07 Thread Ben Whitten
From: Ben Whitten As part of standardising on passing our priv data around we convert read and write burst to take the priv data, there is a small compat step needed in the old _read and _write functions and will be removed in the next step. Signed-off-by: Ben Whitten --- drivers/net/lora

[PATCH lora-next 10/10] net: lora: sx1301: convert all firmware to regmap

2018-08-07 Thread Ben Whitten
The last stage in the probe function loads the final firmwares to the sx1301. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 67 --- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/drivers/net/lora/sx1301.c b/drivers/net

[PATCH lora-next 00/10] Conversing sx1301 to regmap and regfield

2018-08-07 Thread Ben Whitten
somewhere todo with sx1301_page_read on my hardware. Since conversion to regmap the sx1301 initialises properly, sx1257 still oopses because of the SPI bus read but presumably will go away with regmap_bus. Ben Whitten (10): net: lora: sx1301: add register, bit-fields, and helpers for regmap net: lora

[PATCH lora-next 06/10] net: lora: sx1301: simplify firmware loading and convert

2018-08-07 Thread Ben Whitten
From: Ben Whitten As part of changing our internal pointers to our priv data we add the spi_device temporarily for downstream burst read/writes. Just pass firmware pointer to the load and remove redundant size checks, as both MCUs have the same program size add a define. Use devm_kzalloc for

[PATCH v5] leds: trigger: Introduce a NETDEV trigger

2017-12-10 Thread Ben Whitten
This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten --- Changes in v5: Adjust header comment style to be consistent Changes in v4: Adopt SPDX licence header Changes in v3: Cancel the software blink prior to a

Re: [PATCH v4] leds: trigger: Introduce a NETDEV trigger

2017-12-10 Thread Ben Whitten
Hi Jacek, On 10 December 2017 at 18:31, Jacek Anaszewski wrote: > Hi Ben, > > Thanks for the update. I have one doubt about comment style > at the top of the file. Please refer below. > > On 12/10/2017 05:24 PM, Ben Whitten wrote: >> This commit introduces a NETDEV

[PATCH v4] leds: trigger: Introduce a NETDEV trigger

2017-12-10 Thread Ben Whitten
This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten --- Changes in v4: Adopt SPDX licence header Changes in v3: Cancel the software blink prior to a oneshot re-queue Changes in v2: Sort includes and redate

Re: [PATCH v3] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
Philippe, On 7 December 2017 at 13:01, Philippe Ombredanne wrote: > Ben, > > On Thu, Dec 7, 2017 at 12:46 PM, Ben Whitten wrote: >> From: Ben Whitten >> >> This commit introduces a NETDEV trigger for named device >> activity. Available triggers are link, rx,

[PATCH v3] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
From: Ben Whitten This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten --- Changes in v3: Cancel the software blink prior to a oneshot re-queue Changes in v2: Sort includes and redate documentation Correct

Re: [PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
On 6 December 2017 at 20:07, Ben Whitten wrote: > Hi Jacek, > > On 5 December 2017 at 20:38, Jacek Anaszewski > wrote: >> Hi Ben, >> >> On 12/05/2017 12:19 PM, Ben Whitten wrote: >>> From: Ben Whitten >>> >>> The patch was con

Re: [PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-06 Thread Ben Whitten
Hi Jacek, On 5 December 2017 at 20:38, Jacek Anaszewski wrote: > Hi Ben, > > On 12/05/2017 12:19 PM, Ben Whitten wrote: >> From: Ben Whitten >> >> The patch was converted to led_blink_oneshot, in doing so we find that the >> behaviour has changed. As I d

[PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-05 Thread Ben Whitten
From: Ben Whitten This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten --- Changes in v2: Sort includes and redate documentation Correct licence Remove macro and replace with generic function using enums Convert

[PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-05 Thread Ben Whitten
From: Ben Whitten The patch was converted to led_blink_oneshot, in doing so we find that the behaviour has changed. As I dont want to break 'userspace' led behaviour this patch shouldn't be merged as is. Open to suggestions. Given an interval of 50ms and heavy throughpu

Re: [PATCH] leds: trigger: Introduce a NETDEV trigger

2017-12-04 Thread Ben Whitten
\ >> + return size;\ >> +}\ >> +static DEVICE_ATTR_RW(field); > > In order to get rid of this macro and avoid the need for camel case > macro name we could have one function that would accept an enum e.g. > > enum netdev_led_attr { > NETDEV_ATTR_LINK, > NETDEV_ATTR_RX, > NETDEV_ATTR_TX > }; > > The function would be called from each sysfs attr callback with the > related enum, and would alter the state of the related bit. > I was aiming for a bit of code de duplication, but it ended up a mess. Fixed as per your suggestion. -- Kind regards, Ben Whitten

[PATCH] leds: trigger: Introduce a NETDEV trigger

2017-11-28 Thread Ben Whitten
This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten --- .../ABI/testing/sysfs-class-led-trigger-netdev | 45 +++ drivers/leds/trigger/Kconfig | 7 + drivers/leds/trigger/Makefile

[PATCH] Introduce a NETDEV LED trigger

2017-11-28 Thread Ben Whitten
ed in the initial submission have been addressed [1]. I am also including the netdev mailing list as it was suggested previously that if there is no activity the interval will still run and is wasteful [1] https://lkml.org/lkml/2010/11/14/116 Ben Whitten (1): leds: trigger: Introduce a N