diff mbox

spi: xilinx: Use standard num-cs binding

Message ID 67f3c196833c427a489ca2c530d08987a6b5ee2a.1421412912.git.michal.simek@xilinx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Simek Jan. 16, 2015, 12:55 p.m. UTC
Use standard num-cs binding property and setup
"xlnx,num-ss-bits" as deprecated.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/spi/spi-xilinx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--
1.8.2.3

Comments

Michal Simek Feb. 12, 2015, 9:45 a.m. UTC | #1
Hi Mark,

On 01/16/2015 01:55 PM, Michal Simek wrote:
> Use standard num-cs binding property and setup
> "xlnx,num-ss-bits" as deprecated.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
>  drivers/spi/spi-xilinx.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index 79bd84f43430..30e5180195bb 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -338,8 +338,15 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>  		num_cs = pdata->num_chipselect;
>  		bits_per_word = pdata->bits_per_word;
>  	} else {
> -		of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
> -					  &num_cs);
> +		if (of_property_read_u32(pdev->dev.of_node, "num-cs",
> +					 &num_cs)) {
> +			if (!of_property_read_u32(pdev->dev.of_node,
> +						  "xlnx,num-ss-bits",
> +						  &num_cs)) {
> +				dev_err(&pdev->dev,
> +					"property name 'xlnx,num-ss-bits' is deprecated.\n");
> +			}
> +		}
>  	}
> 
>  	if (!num_cs) {
> --
> 1.8.2.3
> 

Any update on this one?

Thanks,
Michal
Mark Brown Feb. 14, 2015, 5:35 a.m. UTC | #2
On Wed, Feb 11, 2015 at 12:07:20PM +0100, Michal Simek wrote:
> 2015-01-16 13:55 GMT+01:00 Michal Simek <michal.simek@xilinx.com>:

> > Use standard num-cs binding property and setup
> > "xlnx,num-ss-bits" as deprecated.

> Any update on this one?

Don't send content free quoted pings, they're just adding to the e-mail
volume and hence wasting people's time.
Michal Simek Feb. 23, 2015, 10:22 a.m. UTC | #3
Hi Mark,

On 02/14/2015 06:35 AM, Mark Brown wrote:
> On Wed, Feb 11, 2015 at 12:07:20PM +0100, Michal Simek wrote:
>> 2015-01-16 13:55 GMT+01:00 Michal Simek <michal.simek@xilinx.com>:
> 
>>> Use standard num-cs binding property and setup
>>> "xlnx,num-ss-bits" as deprecated.
> 
>> Any update on this one?
> 
> Don't send content free quoted pings, they're just adding to the e-mail
> volume and hence wasting people's time.

How do you want me to send ping on pending patches?
Just send them with RESEND prefix?
I just want to clarify this.

Thanks,
Michal
Mark Brown Feb. 24, 2015, 2:52 p.m. UTC | #4
On Mon, Feb 23, 2015 at 11:22:02AM +0100, Michal Simek wrote:
> On 02/14/2015 06:35 AM, Mark Brown wrote:

> > Don't send content free quoted pings, they're just adding to the e-mail
> > volume and hence wasting people's time.

> How do you want me to send ping on pending patches?
> Just send them with RESEND prefix?
> I just want to clarify this.

Reposting is helpful if things have been forgotten.  Though in this case
I'm deliberately leaving it for a while because of the nagging (since I
don't want people to get the impression that it's helpful).  Plus I'm
travelling.
Mark Brown March 8, 2015, 7 p.m. UTC | #5
On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:
> Use standard num-cs binding property and setup
> "xlnx,num-ss-bits" as deprecated.

Why?  These properties mean different things - num-cs is a bit confused
and is the total number of available chip selects for the system (which
could include GPIOs) while num-ss-bits is the size of the bitfield
(which could include things not actually mapped out properly/successfully 
or something if the hardware designers were feeling particularly inspired).

I'm not convinced num-cs ever made any sense.
Michal Simek March 27, 2015, 10:55 a.m. UTC | #6
Hi Mark,

On 03/08/2015 08:00 PM, Mark Brown wrote:
> On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:
>> Use standard num-cs binding property and setup
>> "xlnx,num-ss-bits" as deprecated.
> 
> Why?  These properties mean different things - num-cs is a bit confused
> and is the total number of available chip selects for the system (which
> could include GPIOs) while num-ss-bits is the size of the bitfield
> (which could include things not actually mapped out properly/successfully 
> or something if the hardware designers were feeling particularly inspired).

I was checking meaning of num-ss-bits and meaning is Number of slaves (taking
explanation from Vivado 2014.4) Range 1-32.
http://www.xilinx.com/support/documentation/ip_documentation/axi_spi/v1_02_a/axi_spi_ds742.pdf
Table 1 - page 4

Checking through the hw design every pin is connected to device to do chip select.
That's why I think that num-cs (based on spi-bus.txt) is the right property.

Of course hw guys can use decoder from these bits and we could use binding
as is used in cadence spi (is-decoded-cs)

> I'm not convinced num-cs ever made any sense.

Does it mean that num-cs property used by 11 SPI drivers is just incorrect?

Based on Documentation/devicetree/bindings/spi/spi-bus.txt it is the part of binding
- num-cs : total number of chipselects

Please let me know what you think.

Thanks,
Michal


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 27, 2015, 5:53 p.m. UTC | #7
On Fri, Mar 27, 2015 at 11:55:49AM +0100, Michal Simek wrote:

Please fix your mail client to word wrap within paragraphs at less than
80 columns - this makes your mails easier to read and reply to.

> On 03/08/2015 08:00 PM, Mark Brown wrote:
> > On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:
> >> Use standard num-cs binding property and setup
> >> "xlnx,num-ss-bits" as deprecated.

> > Why?  These properties mean different things - num-cs is a bit confused
> > and is the total number of available chip selects for the system (which
> > could include GPIOs) while num-ss-bits is the size of the bitfield
> > (which could include things not actually mapped out properly/successfully 
> > or something if the hardware designers were feeling particularly inspired).

> I was checking meaning of num-ss-bits and meaning is Number of slaves (taking
> explanation from Vivado 2014.4) Range 1-32.
> http://www.xilinx.com/support/documentation/ip_documentation/axi_spi/v1_02_a/axi_spi_ds742.pdf
> Table 1 - page 4

> Checking through the hw design every pin is connected to device to do chip select.
> That's why I think that num-cs (based on spi-bus.txt) is the right property.

Remember that we can at least in theory have additional chip selects
that aren't controlled by the IP block but are instead GPIOs.  There's
also some potential confusion for users between the number of chip
selects in use in a given system and the size of the bitfield that the
driver needs to take care of.

> > I'm not convinced num-cs ever made any sense.

> Does it mean that num-cs property used by 11 SPI drivers is just incorrect?

> Based on Documentation/devicetree/bindings/spi/spi-bus.txt it is the part of binding
> - num-cs : total number of chipselects

> Please let me know what you think.

I don't think it has any value.
Michal Simek March 30, 2015, 6:46 a.m. UTC | #8
Hi Mark,

On 03/27/2015 06:53 PM, Mark Brown wrote:
> On Fri, Mar 27, 2015 at 11:55:49AM +0100, Michal Simek wrote:
> 
> Please fix your mail client to word wrap within paragraphs at less than
> 80 columns - this makes your mails easier to read and reply to.

You are the first one who had problem with this. But I have setup lower
limit and hopefully it is better now.


>> On 03/08/2015 08:00 PM, Mark Brown wrote:
>>> On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:
>>>> Use standard num-cs binding property and setup
>>>> "xlnx,num-ss-bits" as deprecated.
> 
>>> Why?  These properties mean different things - num-cs is a bit confused
>>> and is the total number of available chip selects for the system (which
>>> could include GPIOs) while num-ss-bits is the size of the bitfield
>>> (which could include things not actually mapped out properly/successfully 
>>> or something if the hardware designers were feeling particularly inspired).
> 
>> I was checking meaning of num-ss-bits and meaning is Number of slaves (taking
>> explanation from Vivado 2014.4) Range 1-32.
>> http://www.xilinx.com/support/documentation/ip_documentation/axi_spi/v1_02_a/axi_spi_ds742.pdf
>> Table 1 - page 4
> 
>> Checking through the hw design every pin is connected to device to do chip select.
>> That's why I think that num-cs (based on spi-bus.txt) is the right property.
> 
> Remember that we can at least in theory have additional chip selects
> that aren't controlled by the IP block but are instead GPIOs.  

I agree with you but this can be generic case for every SPI driver. Also
using external decoder is possible for every driver. Maybe there are
others options via I2C too.

> There's
> also some potential confusion for users between the number of chip
> selects in use in a given system and the size of the bitfield that the
> driver needs to take care of.

num-ss-bits is autogenerated directly from design tools for particular
hardware design and this size is exactly setup and hardcoded. (num-cs
can be just the same case)
If there are 5 bits there are 5 wires from IP. And value of num-ss-bits
and num-cs will be the same.

If user wants to use less lines then physically available we could
potentially extend binding to say. num-ss-bit - number of chip selects
available in hardware. num-cs - number of chip selects used by the driver.
But I expect that this will be rejected because it is software setting
not hardware description.

It is not a problem to still use num-ss-bits in the driver binding
but I still think that "standard" num-cs binding can be also used,
because values will be the same all the time.

For all that cases with GPIO, I2C, etc binding needs to be extended
and to be honest setting up CS with GPIO is easy to do in FPGA and
test it.

Thanks,
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 31, 2015, 5:47 a.m. UTC | #9
On Mon, Mar 30, 2015 at 08:46:10AM +0200, Michal Simek wrote:
> On 03/27/2015 06:53 PM, Mark Brown wrote:
> > On Fri, Mar 27, 2015 at 11:55:49AM +0100, Michal Simek wrote:

> > Please fix your mail client to word wrap within paragraphs at less than
> > 80 columns - this makes your mails easier to read and reply to.

> You are the first one who had problem with this. But I have setup lower
> limit and hopefully it is better now.

That looks better, yes...  I may just be the first one who's bothered
remarking on this.

> >> On 03/08/2015 08:00 PM, Mark Brown wrote:
> >>> On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:

> > Remember that we can at least in theory have additional chip selects
> > that aren't controlled by the IP block but are instead GPIOs.  

> I agree with you but this can be generic case for every SPI driver. Also
> using external decoder is possible for every driver. Maybe there are
> others options via I2C too.

Remember that this in the context of me saying I don't think num-cs is
a particularly good idea at all...

> > There's
> > also some potential confusion for users between the number of chip
> > selects in use in a given system and the size of the bitfield that the
> > driver needs to take care of.

> num-ss-bits is autogenerated directly from design tools for particular
> hardware design and this size is exactly setup and hardcoded. (num-cs
> can be just the same case)
> If there are 5 bits there are 5 wires from IP. And value of num-ss-bits
> and num-cs will be the same.

But what your patch did was *replace* num-ss-bits in the binding, not
just add it.

> If user wants to use less lines then physically available we could
> potentially extend binding to say. num-ss-bit - number of chip selects
> available in hardware. num-cs - number of chip selects used by the driver.
> But I expect that this will be rejected because it is software setting
> not hardware description.

num-cs *is* a software setting.
Michal Simek March 31, 2015, 8:16 a.m. UTC | #10
On 03/31/2015 07:47 AM, Mark Brown wrote:
> On Mon, Mar 30, 2015 at 08:46:10AM +0200, Michal Simek wrote:
>> On 03/27/2015 06:53 PM, Mark Brown wrote:
>>> On Fri, Mar 27, 2015 at 11:55:49AM +0100, Michal Simek wrote:
> 
>>> Please fix your mail client to word wrap within paragraphs at less than
>>> 80 columns - this makes your mails easier to read and reply to.
> 
>> You are the first one who had problem with this. But I have setup lower
>> limit and hopefully it is better now.
> 
> That looks better, yes...  I may just be the first one who's bothered
> remarking on this.

yes and I definitely thank you for that.

>>>> On 03/08/2015 08:00 PM, Mark Brown wrote:
>>>>> On Fri, Jan 16, 2015 at 01:55:14PM +0100, Michal Simek wrote:
> 
>>> Remember that we can at least in theory have additional chip selects
>>> that aren't controlled by the IP block but are instead GPIOs.  
> 
>> I agree with you but this can be generic case for every SPI driver. Also
>> using external decoder is possible for every driver. Maybe there are
>> others options via I2C too.
> 
> Remember that this in the context of me saying I don't think num-cs is
> a particularly good idea at all...

yes.


>>> There's
>>> also some potential confusion for users between the number of chip
>>> selects in use in a given system and the size of the bitfield that the
>>> driver needs to take care of.
> 
>> num-ss-bits is autogenerated directly from design tools for particular
>> hardware design and this size is exactly setup and hardcoded. (num-cs
>> can be just the same case)
>> If there are 5 bits there are 5 wires from IP. And value of num-ss-bits
>> and num-cs will be the same.
> 
> But what your patch did was *replace* num-ss-bits in the binding, not
> just add it.

yes. Sync binding was the main my point.


>> If user wants to use less lines then physically available we could
>> potentially extend binding to say. num-ss-bit - number of chip selects
>> available in hardware. num-cs - number of chip selects used by the driver.
>> But I expect that this will be rejected because it is software setting
>> not hardware description.
> 
> num-cs *is* a software setting.

ok - what to do with that? Remove it because it shouldn't be passed via DT?

Thanks,
Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 31, 2015, 11:16 a.m. UTC | #11
On Tue, Mar 31, 2015 at 10:16:57AM +0200, Michal Simek wrote:
> On 03/31/2015 07:47 AM, Mark Brown wrote:

> > num-cs *is* a software setting.

> ok - what to do with that? Remove it because it shouldn't be passed via DT?

Well, there's a lot of existing users to check and clean up some of
which currently rely on it which will take time to deal with.  Removing
it while some drivers rely on using it isn't ideal.
Michal Simek March 31, 2015, 11:25 a.m. UTC | #12
On 03/31/2015 01:16 PM, Mark Brown wrote:
> On Tue, Mar 31, 2015 at 10:16:57AM +0200, Michal Simek wrote:
>> On 03/31/2015 07:47 AM, Mark Brown wrote:
> 
>>> num-cs *is* a software setting.
> 
>> ok - what to do with that? Remove it because it shouldn't be passed via DT?
> 
> Well, there's a lot of existing users to check and clean up some of
> which currently rely on it which will take time to deal with.  Removing
> it while some drivers rely on using it isn't ideal.
> 

We have spi-cadence driver in the kernel which uses num-cs and also
is-decoded-cs and we can change it but the question still remains how
to do it better.

Thanks,
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 31, 2015, 12:24 p.m. UTC | #13
On Tue, Mar 31, 2015 at 01:25:07PM +0200, Michal Simek wrote:
> On 03/31/2015 01:16 PM, Mark Brown wrote:

> > Well, there's a lot of existing users to check and clean up some of
> > which currently rely on it which will take time to deal with.  Removing
> > it while some drivers rely on using it isn't ideal.

> We have spi-cadence driver in the kernel which uses num-cs and also
> is-decoded-cs and we can change it but the question still remains how
> to do it better.

Like I say just don't use num-cs, use a property which describes the
hardware.
diff mbox

Patch

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 79bd84f43430..30e5180195bb 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -338,8 +338,15 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 		num_cs = pdata->num_chipselect;
 		bits_per_word = pdata->bits_per_word;
 	} else {
-		of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
-					  &num_cs);
+		if (of_property_read_u32(pdev->dev.of_node, "num-cs",
+					 &num_cs)) {
+			if (!of_property_read_u32(pdev->dev.of_node,
+						  "xlnx,num-ss-bits",
+						  &num_cs)) {
+				dev_err(&pdev->dev,
+					"property name 'xlnx,num-ss-bits' is deprecated.\n");
+			}
+		}
 	}

 	if (!num_cs) {