[PATCH v2] spi: sun4i: Prevent chip-select from being activated twice before a transfer

2016-01-05 Thread Marcus Weseloh
, deactivate Moving the configuration of the SUN4I_CTL_CS_MANUAL flag from transfer_one to set_cs removes the double activation. Signed-off-by: Marcus Weseloh Acked-by: Maxime Ripard --- Changes from v1: - Added Maximes Acked-by --- drivers/spi/spi-sun4i.c | 6 +++--- 1 file changed, 3 insertions

[PATCH v2] spi: sun4i: Prevent chip-select from being activated twice before a transfer

2016-01-05 Thread Marcus Weseloh
, deactivate Moving the configuration of the SUN4I_CTL_CS_MANUAL flag from transfer_one to set_cs removes the double activation. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> Acked-by: Maxime Ripard <maxime.rip...@free-electrons.com> --- Changes from v1: - Added Maximes Acked-by -

[PATCH] clk: sunxi: Fix mod0 clock calculation to return stable results and check divisor size limits

2015-12-28 Thread Marcus Weseloh
the returned frequency removes this problem. Signed-off-by: Marcus Weseloh --- drivers/clk/sunxi/clk-mod0.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c index d167e1e..d03f099 100644 --- a/drivers/clk/sunxi/cl

Re: [PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-28 Thread Marcus Weseloh
Hi again, 2015-12-28 0:29 GMT+01:00 Marcus Weseloh : > 2015-12-27 22:09 GMT+01:00 Maxime Ripard : [...] > [...] >>> - /* Ensure that we have a parent clock fast enough */ >>> + /* >>> + * Ensure that the parent clock is set to twice the max spe

Re: [PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-28 Thread Marcus Weseloh
Hi again, 2015-12-28 0:29 GMT+01:00 Marcus Weseloh <mweselo...@gmail.com>: > 2015-12-27 22:09 GMT+01:00 Maxime Ripard <maxime.rip...@free-electrons.com>: [...] > [...] >>> - /* Ensure that we have a parent clock fast enough */ >>> + /* >>>

[PATCH] clk: sunxi: Fix mod0 clock calculation to return stable results and check divisor size limits

2015-12-28 Thread Marcus Weseloh
the returned frequency removes this problem. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- drivers/clk/sunxi/clk-mod0.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c index d167e1e..d03f099 100644

Re: [PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-27 Thread Marcus Weseloh
Hi, 2015-12-27 22:09 GMT+01:00 Maxime Ripard : > On Sat, Dec 26, 2015 at 04:53:05PM +0100, Marcus Weseloh wrote: >> This patch fixes multiple problems with the current clock calculations: >> >> 1. The A10/A20 datasheet contains the formula AHB_CLK / (2^(n+1)) to >>

Re: [PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-27 Thread Marcus Weseloh
Hi, 2015-12-27 22:09 GMT+01:00 Maxime Ripard <maxime.rip...@free-electrons.com>: > On Sat, Dec 26, 2015 at 04:53:05PM +0100, Marcus Weseloh wrote: >> This patch fixes multiple problems with the current clock calculations: >> >> 1. The A10/A20 datasheet contains th

[PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-26 Thread Marcus Weseloh
to unpredictable transfer speeds, depending on the order in which transfers with different speeds where serviced by the SPI driver. Signed-off-by: Marcus Weseloh --- drivers/spi/spi-sun4i.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi

[PATCH v6 3/3] spi: sun4i: Add support for wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
Modifies the sun4i SPI master driver to make use of the "spi-word-wait-ns" property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh --- drivers/spi/spi-su

[PATCH v6 1/3] spi: dts: Add new device property to specifcy a wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows SPI slave devices to set a wait time between the transmission of words. Signed-off-by: Marcus Weseloh Reviewed-by: Maxime Ripard Acked-by: Rob Herring --- Documentation/devicetree/bindings/spi/spi-b

[PATCH v6 0/3] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
speed instead of tfr->speed_hz for wait time calculation Marcus Weseloh (3): spi: dts: Add new device property to specifcy a wait time between word transmissions spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate spi: sun4i: Add support for

[PATCH v6 3/3] spi: sun4i: Add support for wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
Modifies the sun4i SPI master driver to make use of the "spi-word-wait-ns" property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com&

[PATCH v6 1/3] spi: dts: Add new device property to specifcy a wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows SPI slave devices to set a wait time between the transmission of words. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> Reviewed-by: Maxime Ripard <maxime.rip...@free-electrons.com> Ac

[PATCH v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate

2015-12-26 Thread Marcus Weseloh
to unpredictable transfer speeds, depending on the order in which transfers with different speeds where serviced by the SPI driver. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- drivers/spi/spi-sun4i.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff

[PATCH v6 0/3] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-26 Thread Marcus Weseloh
speed instead of tfr->speed_hz for wait time calculation Marcus Weseloh (3): spi: dts: Add new device property to specifcy a wait time between word transmissions spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate spi: sun4i: Add support for

Re: [PATCH v5 2/2] spi: sun4i: Add support for wait time between word transmissions

2015-12-20 Thread Marcus Weseloh
Hi, 2015-12-18 12:16 GMT+01:00 Maxime Ripard : >> sun4i_spi_write(sspi, SUN4I_CLK_CTL_REG, reg); >> >> + /* >> + * Setup wait time between words. >> + * >> + * Wait time is set in SPI_CLK cycles. The SPI hardware needs 3 >> + * additional cycles to setup the wait

Re: [PATCH v5 2/2] spi: sun4i: Add support for wait time between word transmissions

2015-12-20 Thread Marcus Weseloh
Hi, 2015-12-18 12:16 GMT+01:00 Maxime Ripard : >> sun4i_spi_write(sspi, SUN4I_CLK_CTL_REG, reg); >> >> + /* >> + * Setup wait time between words. >> + * >> + * Wait time is set in SPI_CLK cycles. The SPI hardware needs 3 >> + *

[PATCH v5 0/2] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
"hardware" in comments and description, as the wait time could also be implemented in software * read and set property value in spi core Changes from v4: * log with dev_dbg instead of dev_info * split patch into two separate ones for SPI-core and sun4i parts Marcus Weseloh (2): spi:

[PATCH v5 2/2] spi: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Modifies the sun4i SPI master driver to make use of the "spi-word-wait-ns" property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh --- drivers/spi/spi-su

[PATCH v5 1/2] spi: dts: Add new device property to specifcy a wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows SPI slave devices to set a wait time between the transmission of words. Signed-off-by: Marcus Weseloh --- Documentation/devicetree/bindings/spi/spi-bus.txt | 2 ++ drivers/spi/spi.c

Re: [PATCH v4] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Hi Maxime, 2015-12-16 11:39 GMT+01:00 Maxime Ripard : > It looks mostly fine, however, please try to make only one thing in > one patch. > > In this case, it would mean having one patch to add the DT property > and support in the SPI core in a first one, and then add support for > it in your

Re: [PATCH v4] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Hi Maxime, 2015-12-16 11:39 GMT+01:00 Maxime Ripard : > It looks mostly fine, however, please try to make only one thing in > one patch. > > In this case, it would mean having one patch to add the DT property > and support in the SPI core in a first one, and then

[PATCH v5 2/2] spi: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Modifies the sun4i SPI master driver to make use of the "spi-word-wait-ns" property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com&

[PATCH v5 1/2] spi: dts: Add new device property to specifcy a wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows SPI slave devices to set a wait time between the transmission of words. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- Documentation/devicetree/bindings/spi/spi-bus.txt | 2 ++ d

[PATCH v5 0/2] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-17 Thread Marcus Weseloh
"hardware" in comments and description, as the wait time could also be implemented in software * read and set property value in spi core Changes from v4: * log with dev_dbg instead of dev_info * split patch into two separate ones for SPI-core and sun4i parts Marcus Weseloh (2): spi:

[PATCH v4] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-14 Thread Marcus Weseloh
o make use of the new property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh --- Changes from v1: * renamed the property for more clarity * wait time is set in nanosecon

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-14 Thread Marcus Weseloh
2015-12-14 8:31 GMT+01:00 Marcus Weseloh : > [...] >>> + /* Setup wait time between words */ >>> + of_property_read_u32(spi->dev.of_node, "spi-word-wait-ns", >>> + _ns); >> >> Read this in probe an

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-14 Thread Marcus Weseloh
2015-12-14 8:31 GMT+01:00 Marcus Weseloh <mweselo...@gmail.com>: > [...] >>> + /* Setup wait time between words */ >>> + of_property_read_u32(spi->dev.of_node, "spi-word-wait-ns", >>> + _ns); >> >> Rea

[PATCH v4] spi: dts: sun4i: Add support for wait time between word transmissions

2015-12-14 Thread Marcus Weseloh
o make use of the new property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- Changes from v1: * renamed the property for more clarity *

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
Hi, 2015-12-14 2:29 GMT+01:00 Rob Herring : > On Mon, Dec 14, 2015 at 12:04:11AM +0100, Marcus Weseloh wrote: >> Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows [...] >> diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt >

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
2015-12-14 0:08 GMT+01:00 Mark Brown : > Please don't bury patches in reply to existing serieses, it makes it > hard to follow what's going on with regard to which versions are current > and so on. Thanks for the pointer, I will send patches like you ask from now on. Should I resend the patch?

[PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh --- Changes from v1: * renamed the property for more clarity * wait time is set in nanoseconds instead of number of clock cycles * transparently handle the 3 setup cl

Re: [PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-13 Thread Marcus Weseloh
2015-12-13 22:07 GMT+01:00 Maxime Ripard : [...] >> There is one review comment that I didn't address: Rob Herring suggested >> that this should be in the core-binding rather than in sun4i. I checked >> many of the hardware manuals of other SPI drivers and it looks to me like >> this hardware

Re: [PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-13 Thread Marcus Weseloh
2015-12-13 22:07 GMT+01:00 Maxime Ripard : [...] >> There is one review comment that I didn't address: Rob Herring suggested >> that this should be in the core-binding rather than in sun4i. I checked >> many of the hardware manuals of other SPI drivers and it

[PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- Changes from v1: * renamed the property for more clarity * wait time is set in nanoseconds instead of number of clock cycles * transparen

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
2015-12-14 0:08 GMT+01:00 Mark Brown : > Please don't bury patches in reply to existing serieses, it makes it > hard to follow what's going on with regard to which versions are current > and so on. Thanks for the pointer, I will send patches like you ask from now on. Should I

Re: [PATCH v3] spi: dts: sun4i: Add support for hardware-based wait time between words

2015-12-13 Thread Marcus Weseloh
Hi, 2015-12-14 2:29 GMT+01:00 Rob Herring <r...@kernel.org>: > On Mon, Dec 14, 2015 at 12:04:11AM +0100, Marcus Weseloh wrote: >> Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows [...] >> diff --git a/Documentation/devicetree/bindings/spi/

Re: [linux-sunxi] [PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-12 Thread Marcus Weseloh
2015-12-12 10:19 GMT+01:00 Priit Laes : > On Fri, 2015-12-11 at 23:45 +0100, Marcus Weseloh wrote: > [...] >> +- sun4i,spi-word-wait-ns: hardware based delay in nanoseconds between >> + transmission of words > > Should be 'allwinner,spi-word-wait-ns'

Re: [linux-sunxi] [PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-12 Thread Marcus Weseloh
2015-12-12 10:19 GMT+01:00 Priit Laes <pl...@plaes.org>: > On Fri, 2015-12-11 at 23:45 +0100, Marcus Weseloh wrote: > [...] >> +- sun4i,spi-word-wait-ns: hardware based delay in nanoseconds between >> + transmission of words > > Should be 'allwi

[PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-11 Thread Marcus Weseloh
m non-zero wait time 4 clock cycles. Signed-off-by: Marcus Weseloh --- Changes from v1: * renamed the property for more clarity * wait time is set in nanoseconds instead of number of clock cycles * transparently handle the 3 setup clock cycles There is one review comment that I didn't ad

[PATCH v2] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-12-11 Thread Marcus Weseloh
m non-zero wait time 4 clock cycles. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- Changes from v1: * renamed the property for more clarity * wait time is set in nanoseconds instead of number of clock cycles * transparently handle the 3 setup clock cycles There is one revie

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-23 Thread Marcus Weseloh
2015-11-22 20:45 GMT+01:00 Maxime Ripard : >> Julien, Rob: thanks for your comments! Ok, I will make the following changes: >> >> - remove "sun4i,spi-wdelay" from the sun4i binding and add the >> property to the spi-bus.txt binding instead >> - remove the comment about the additional 3 cycles from

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-23 Thread Marcus Weseloh
2015-11-22 20:45 GMT+01:00 Maxime Ripard : >> Julien, Rob: thanks for your comments! Ok, I will make the following changes: >> >> - remove "sun4i,spi-wdelay" from the sun4i binding and add the >> property to the spi-bus.txt binding instead >> - remove the comment

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
2015-11-20 17:12 GMT+01:00 Rob Herring : > On Fri, Nov 20, 2015 at 02:56:34PM +0100, Marcus Weseloh wrote: >> > (and the wdelay should >> > arguably be a core-spi thing, not a sunxi thing, but that's a separate >> > discussion) >> >> I've been thinking

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
Hi Julien, 2015-11-20 11:12 GMT+01:00 Julian Calaby : > Having magic numbers is kind-of a drivers' job. Yes, of course. What I meant was that I didn't feel comfortable to include this magic number in driver code because I'm not 100% sure if it is correct across all SPI configurations and SoCs

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
Hi Julian, 2015-11-19 23:59 GMT+01:00 Julian Calaby : > Should you possibly hide the 3 clock periods from the user? > > I.e. they set whatever they want for the wdelay, we set it to the > closest number we can that's greater or equal to what they ask for. That's a good idea and much better than

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
Hi Julien, 2015-11-20 11:12 GMT+01:00 Julian Calaby : > Having magic numbers is kind-of a drivers' job. Yes, of course. What I meant was that I didn't feel comfortable to include this magic number in driver code because I'm not 100% sure if it is correct across all SPI

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
2015-11-20 17:12 GMT+01:00 Rob Herring <r...@kernel.org>: > On Fri, Nov 20, 2015 at 02:56:34PM +0100, Marcus Weseloh wrote: >> > (and the wdelay should >> > arguably be a core-spi thing, not a sunxi thing, but that's a separate >> > discussion) >> >&

Re: [linux-sunxi] [PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-20 Thread Marcus Weseloh
Hi Julian, 2015-11-19 23:59 GMT+01:00 Julian Calaby : > Should you possibly hide the 3 clock periods from the user? > > I.e. they set whatever they want for the wdelay, we set it to the > closest number we can that's greater or equal to what they ask for. That's a good

[PATCH] spi: dts: sun4i: Add support for inter-word wait cycles

2015-11-19 Thread Marcus Weseloh
umentation. I used "example,dummy" as compatible... is this acceptable or should I use a device/compatible that actually exists somewhere? Oh... and should I split binding documentation and code changing patch? Best regards, Marcus Marcus Weseloh (1): spi: dts: sun4i: Add support

[PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-19 Thread Marcus Weseloh
next word. The constant additional 3 clock periods are not documented by the vendor and have been determined by analyzing the generated waveforms across many different transmission speeds. Signed-off-by: Marcus Weseloh --- Documentation/devicetree/bindings/spi/spi-sun4i.txt | 11 +++ drive

[PATCH] spi: dts: sun4i: Add support for inter-word wait cycles

2015-11-19 Thread Marcus Weseloh
umentation. I used "example,dummy" as compatible... is this acceptable or should I use a device/compatible that actually exists somewhere? Oh... and should I split binding documentation and code changing patch? Best regards, Marcus Marcus Weseloh (1): spi: dts: sun4i: Add support

[PATCH] spi: dts: sun4i: Add support for inter-word wait cycles using the SPI Wait Clock Register

2015-11-19 Thread Marcus Weseloh
next word. The constant additional 3 clock periods are not documented by the vendor and have been determined by analyzing the generated waveforms across many different transmission speeds. Signed-off-by: Marcus Weseloh <mweselo...@gmail.com> --- Documentation/devicetree/bindings/spi/sp