Skip to contentSkip to conversation

spi:fsl-dspi:convert to use regmap and big-endian supports

PATCH Superseded Chao Fu 2 participants 3 messages Feb 11, 2014

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Chao Fu

author
#0 lore raw

PATCH v3 1/2 spi:fsl-dspi:convert to use regmap and big-endian supports

From: Chao Fu <[email protected]>

Freescale DSPI module will have two endianess in different platform, but ARM is little endian. So when DSPI in big endian, core in little endian, readl and writel can not adjust R/W register in this condition. This patch will remove general readl/writel, and import regmap mechanism. Data endian will be transfered in regmap APIs.

Documents: dspi add bool "big-endian" in dts node if DSPI module work in big endian.

---
Change in v3:
Remove readl and wrirel, and import regmap mechanism to R/W module registers.

Change in v2:
Make dspi_readx dspi_writex as inline functions. Modify the issue of indentation in function is_double_byte_mode. Add description about big endian in bindings document.

 .../devicetree/bindings/spi/spi-fsl-dspi.txt       |  2 +
 drivers/spi/spi-fsl-dspi.c                         | 80 ++++++++++++++--------
 2 files changed, 55 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt +2 -0
index a1fb303..5376de4 100644
@@ -10,6 +10,7 @@ Required properties:
 - pinctrl-names: must contain a "default" entry.
 - spi-num-chipselects : the number of the chipselect signals.
 - bus-num : the slave chip chipselect signal number.
+- big-endian : if DSPI modudle is big endian, the bool will be set in node.
 Example:
 
 dspi0 at 4002c000 {
@@ -24,6 +25,7 @@ dspi0 at 4002c000 {
 	bus-num = <0>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_dspi0_1>;
+	big-endian;
 	status = "okay";
 
 	sflash: at26df081a at 0 {
drivers/spi/spi-fsl-dspi.c +53 -27

179 lines not on this page · raw message

Signature · 1 line
1.8.4
author
#1 lore raw

PATCH v3 2/2 spi:dspi:Remove some coding sytle not in standard

From: Chao Fu <[email protected]>

Remove some coding sytle not in standard in former code.

---
Change in v3:
None.
Change in v2:
New.

 drivers/spi/spi-fsl-dspi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-fsl-dspi.c +4 -4
index fb16575..42ede0d 100644
@@ -111,9 +111,9 @@ struct fsl_dspi {
 
 	struct regmap		*regmap;
 	int			irq;
-	struct clk 		*clk;
+	struct clk		*clk;
 
-	struct spi_transfer 	*cur_transfer;
+	struct spi_transfer	*cur_transfer;
 	struct chip_data	*cur_chip;
 	size_t			len;
 	void			*tx;
@@ -124,8 +124,8 @@ struct fsl_dspi {
 	u8			cs;
 	u16			void_write_data;
 
-	wait_queue_head_t 	waitq;
-	u32 			waitflags;
+	wait_queue_head_t	waitq;
+	u32			waitflags;
 };
 
 static inline int is_double_byte_mode(struct fsl_dspi *dspi)
Signature · 1 line
1.8.4
#2 lore raw
In reply to Chao Fu

???????, 11 ??????? 2014, 13:48 +08:00 ?? Chao Fu <[email protected]>:

Quoted 7 lines

From: Chao Fu <[email protected]>

Freescale DSPI module will have two endianess in different platform, but ARM is little endian. So when DSPI in big endian, core in little endian, readl and writel can not adjust R/W register in this condition. This patch will remove general readl/writel, and import regmap mechanism. Data endian will be transfered in regmap APIs.

In this case You should additionally select REGMAP_MMIO option for SPI_FSL_DSPI in the drivers/spi/Kconfig.

---