linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-xilinx: Use DT information for bits_per_word value
@ 2013-02-11 14:55 Jens Renner (EFE)
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Renner (EFE) @ 2013-02-11 14:55 UTC (permalink / raw)
  To: spi-devel-general; +Cc: linux-kernel

From: Jens Renner <renner@efe-gmbh.de>

This patch overrides the default value of bits_per_word with the actual value of "xlnx,num-transfer-bits" from the DTS file to allow for 16 and 32 bit word lengths.

Signed-off-by: Jens Renner <renner@efe-gmbh.de>
---
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index e1d7696..03abdfa 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -487,6 +487,12 @@ static int xilinx_spi_probe(struct platform_device *dev)
				       &len);
		if (prop && len >= sizeof(*prop))
			num_cs = __be32_to_cpup(prop);
+
+		/* override default number of bits per word */
+		prop = of_get_property(dev->dev.of_node,
+				       "xlnx,num-transfer-bits", &len);
+		if (prop && len >= sizeof(*prop))
+			bits_per_word = __be32_to_cpup(prop);
	}
 #endif

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] spi: spi-xilinx: Use DT information for bits_per_word value
@ 2013-02-11 16:28 Jens Renner (EFE)
       [not found] ` <51191C11.9070607-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Renner (EFE) @ 2013-02-11 16:28 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

From: Jens Renner <renner-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>

This patch overrides the default value of bits_per_word with the actual value
of "xlnx,num-transfer-bits" from the DTS file to allow for 16 and 32 bit word
lengths.

Signed-off-by: Jens Renner <renner-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
---
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index e1d7696..03abdfa 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -487,6 +487,12 @@ static int xilinx_spi_probe(struct platform_device *dev)
				       &len);
		if (prop && len >= sizeof(*prop))
			num_cs = __be32_to_cpup(prop);
+
+		/* override default number of bits per word */
+		prop = of_get_property(dev->dev.of_node,
+				       "xlnx,num-transfer-bits", &len);
+		if (prop && len >= sizeof(*prop))
+			bits_per_word = __be32_to_cpup(prop);
	}
 #endif

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: spi-xilinx: Use DT information for bits_per_word value
       [not found] ` <51191C11.9070607-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
@ 2013-03-02 21:22   ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2013-03-02 21:22 UTC (permalink / raw)
  To: Jens Renner (EFE),
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, 11 Feb 2013 17:28:01 +0100, "Jens Renner (EFE)" <renner-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org> wrote:
> From: Jens Renner <renner-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
> 
> This patch overrides the default value of bits_per_word with the actual value
> of "xlnx,num-transfer-bits" from the DTS file to allow for 16 and 32 bit word
> lengths.
> 
> Signed-off-by: Jens Renner <renner-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
> ---
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index e1d7696..03abdfa 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -487,6 +487,12 @@ static int xilinx_spi_probe(struct platform_device *dev)
> 				       &len);
> 		if (prop && len >= sizeof(*prop))
> 			num_cs = __be32_to_cpup(prop);
> +
> +		/* override default number of bits per word */
> +		prop = of_get_property(dev->dev.of_node,
> +				       "xlnx,num-transfer-bits", &len);
> +		if (prop && len >= sizeof(*prop))
> +			bits_per_word = __be32_to_cpup(prop);

Hi Jens,

Please remember to update documentation when modifying a DT binding.

Also, if you use of_property_read_u32() the code will be a lot simpler.

g.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-02 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 16:28 [PATCH] spi: spi-xilinx: Use DT information for bits_per_word value Jens Renner (EFE)
     [not found] ` <51191C11.9070607-Xf229rFC5gsb1SvskN2V4Q@public.gmane.org>
2013-03-02 21:22   ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2013-02-11 14:55 Jens Renner (EFE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).