Skip to contentSkip to conversation

spi: spi-xilinx: Use DT information for bits_per_word value

PATCH Superseded Jens Renner (EFE) 2 participants 2 messages Feb 11, 2013 – Mar 2, 2013 1 message not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-xilinx: Use DT information for bits_per_word value

From: Jens Renner <[email protected]>

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.

---

drivers/spi/spi-xilinx.c +0 -0
index e1d7696..03abdfa 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 13 lines · Jens Renner (EFE)

From: Jens Renner <[email protected]>

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.

---

drivers/spi/spi-xilinx.c +0 -0
index e1d7696..03abdfa 100644

drivers/spi/spi-xilinx.c static int xilinx_spi_probe(struct platform_device *dev) · line 495

Quoted 9 lines
drivers/spi/spi-xilinx.c +6 -0
@@ -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