Skip to contentSkip to conversation

spi: Cleanup set

PATCH New Jagan Teki 3 participants 25 messages Dec 16, 2015 – Dec 28, 2015

Subsystems (2)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

cover spi: Cleanup set

Cleanup set on spi_slave{}

Jagan Teki (8):
spi: Remove SPI_OPM_RX_EXTN
spi: Remove SPI_OPM_RX_DIO|QIOF
spi: Rename SPI_OPM_RX_* to SPI_RX_*
spi: Rename op_mode_rx to mode_rx
spi: Move mode, mode_rx, flags macro's to structure
spi: Fix bit assignment with flags
spi: Use BIT macro
spi: Minor cleanup

 drivers/mtd/spi/spi_flash.c |  2 +-
 drivers/spi/ich.c           |  2 +-
 drivers/spi/ti_qspi.c       |  2 +-
 include/spi.h               | 65 +++++++++++++++++++--------------------------
 4 files changed, 31 insertions(+), 40 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/8 spi: Remove SPI_OPM_RX_EXTN

SPI_OPM_RX_EXTN is a combination of all rx opmode's and spi driver shall use any one of the rx mode at a time not the combination and it is true in case of flash where spi_flash_table mention combination of supported read opmodes so-that the required one will pick based on the rx mode from spi driver.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 3 ---
 1 file changed, 3 deletions(-)
include/spi.h +0 -3
index b9a6e6f..bf2ed28 100644
@@ -41,9 +41,6 @@
 #define SPI_OPM_RX_DIO		(1 << 3)
 #define SPI_OPM_RX_QOF		(1 << 4)
 #define SPI_OPM_RX_QIOF		(1 << 5)
-#define SPI_OPM_RX_EXTN	(SPI_OPM_RX_AS | SPI_OPM_RX_AF | SPI_OPM_RX_DOUT | \
-				SPI_OPM_RX_DIO | SPI_OPM_RX_QOF | \
-				SPI_OPM_RX_QIOF)
 
 /* SPI bus connection options - see enum spi_dual_flash */
 #define SPI_CONN_DUAL_SHARED		(1 << 0)
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/8 spi: Remove SPI_OPM_RX_EXTN

Quoted 7 lines · Jagan Teki

SPI_OPM_RX_EXTN is a combination of all rx opmode's and spi driver shall use any one of the rx mode at a time not the combination and it is true in case of flash where spi_flash_table mention combination of supported read opmodes so-that the required one will pick based on the rx mode from spi driver.

Quoted 6 lines
Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

author
#3 lore raw

PATCH 2/8 spi: Remove SPI_OPM_RX_DIO|QIOF

In reply to Jagan Teki

SPI_OPM_RX_DIO and SPI_OPM_RX_QIOF are rx IO commands/opmodes for dual and quad. Usually IO operation's are referred to flash protocol rather with spi controller protocol, these are still present in flash side for the usage of spi-nor controllers.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 2 --
 1 file changed, 2 deletions(-)
include/spi.h +0 -2
index bf2ed28..3e3480a 100644
@@ -38,9 +38,7 @@
 #define SPI_OPM_RX_AS		(1 << 0)
 #define SPI_OPM_RX_AF		(1 << 1)
 #define SPI_OPM_RX_DOUT		(1 << 2)
-#define SPI_OPM_RX_DIO		(1 << 3)
 #define SPI_OPM_RX_QOF		(1 << 4)
-#define SPI_OPM_RX_QIOF		(1 << 5)
 
 /* SPI bus connection options - see enum spi_dual_flash */
 #define SPI_CONN_DUAL_SHARED		(1 << 0)
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/8 spi: Remove SPI_OPM_RX_DIO|QIOF

Quoted 6 lines · Jagan Teki

SPI_OPM_RX_DIO and SPI_OPM_RX_QIOF are rx IO commands/opmodes for dual and quad. Usually IO operation's are referred to flash protocol rather with spi controller protocol, these are still present in flash side for the usage of spi-nor controllers.

Quoted 6 lines
Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

author
#5 lore raw

PATCH 3/8 spi: Rename SPI_OPM_RX_* to SPI_RX_*

In reply to Jagan Teki

SPI_OPM_RX_AS - SPI_RX_SLOW
SPI_OPM_RX_AF - SPI_RX_FAST
SPI_OPM_RX_DOUT - SPI_RX_DUAL
SPI_OPM_RX_QOF - SPI_RX_QUAD

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 drivers/spi/ich.c     | 2 +-
 drivers/spi/ti_qspi.c | 2 +-
 include/spi.h         | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/spi/ich.c +1 -1
index d11132c..7f41763 100644
@@ -752,7 +752,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 	 * and byte program command for SST flash
 	 */
 	if (plat->ich_version == 7) {
-		slave->op_mode_rx = SPI_OPM_RX_AS;
+		slave->op_mode_rx = SPI_RX_SLOW;
 		slave->mode = SPI_TX_BYTE;
 	}
 
drivers/spi/ti_qspi.c +1 -1
index 5747ed1..366243c 100644
@@ -115,7 +115,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_slave *qslave)
 			QSPI_SETUP0_NUM_D_BYTES_8_BITS |
 			QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
 			QSPI_NUM_DUMMY_BITS);
-	slave->op_mode_rx = SPI_OPM_RX_QOF;
+	slave->op_mode_rx = SPI_RX_QUAD;
 #else
 	memval |= QSPI_CMD_READ | QSPI_SETUP0_NUM_A_BYTES |
 			QSPI_SETUP0_NUM_D_BYTES_NO_BITS |
include/spi.h +4 -4
index 3e3480a..fd09502 100644
@@ -35,10 +35,10 @@
 #define SPI_XFER_U_PAGE	(1 << 5)
 
 /* SPI RX operation modes */
-#define SPI_OPM_RX_AS		(1 << 0)
-#define SPI_OPM_RX_AF		(1 << 1)
-#define SPI_OPM_RX_DOUT		(1 << 2)
-#define SPI_OPM_RX_QOF		(1 << 4)
+#define SPI_RX_SLOW		(1 << 0)
+#define SPI_RX_FAST		(1 << 1)
+#define SPI_RX_DUAL		(1 << 2)
+#define SPI_RX_QUAD		(1 << 4)
 
 /* SPI bus connection options - see enum spi_dual_flash */
 #define SPI_CONN_DUAL_SHARED		(1 << 0)
Signature · 1 line
1.9.1
#6 lore raw

PATCH 3/8 spi: Rename SPI_OPM_RX_* to SPI_RX_*

Quoted 11 lines · Jagan Teki

SPI_OPM_RX_AS - SPI_RX_SLOW
SPI_OPM_RX_AF - SPI_RX_FAST
SPI_OPM_RX_DOUT - SPI_RX_DUAL
SPI_OPM_RX_QOF - SPI_RX_QUAD

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

author
#7 lore raw

PATCH 4/8 spi: Rename op_mode_rx to mode_rx

In reply to Jagan Teki

Since spi rx mode macro's are renamed to simple and meaninfull in below patch, this patch will rename the respective structure member.
"spi: Rename SPI_OPM_RX_* to SPI_RX_*" (sha1: 5e9ffbc5376616449beaaf2bc100f579f12291cf)

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 drivers/mtd/spi/spi_flash.c | 2 +-
 drivers/spi/ich.c           | 2 +-
 drivers/spi/ti_qspi.c       | 2 +-
 include/spi.h               | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/spi/spi_flash.c +1 -1
index 1ba6222..51f94a7 100644
@@ -1098,7 +1098,7 @@ int spi_flash_scan(struct spi_flash *flash)
 	flash->sector_size = flash->erase_size;
 
 	/* Look for the fastest read cmd */
-	cmd = fls(params->e_rd_cmd & spi->op_mode_rx);
+	cmd = fls(params->e_rd_cmd & spi->mode_rx);
 	if (cmd) {
 		cmd = spi_read_cmds_array[cmd - 1];
 		flash->read_cmd = cmd;
drivers/spi/ich.c +1 -1
index 7f41763..59eaaea 100644
@@ -752,7 +752,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 	 * and byte program command for SST flash
 	 */
 	if (plat->ich_version == 7) {
-		slave->op_mode_rx = SPI_RX_SLOW;
+		slave->mode_rx = SPI_RX_SLOW;
 		slave->mode = SPI_TX_BYTE;
 	}
 
drivers/spi/ti_qspi.c +1 -1
index 366243c..26616eb 100644
@@ -115,7 +115,7 @@ static void ti_spi_setup_spi_register(struct ti_qspi_slave *qslave)
 			QSPI_SETUP0_NUM_D_BYTES_8_BITS |
 			QSPI_SETUP0_READ_QUAD | QSPI_CMD_WRITE |
 			QSPI_NUM_DUMMY_BITS);
-	slave->op_mode_rx = SPI_RX_QUAD;
+	slave->mode_rx = SPI_RX_QUAD;
 #else
 	memval |= QSPI_CMD_READ | QSPI_SETUP0_NUM_A_BYTES |
 			QSPI_SETUP0_NUM_D_BYTES_NO_BITS |
include/spi.h +2 -2
index fd09502..48a78dc 100644
@@ -99,7 +99,7 @@ struct dm_spi_slave_platdata {
  *			bus (bus->seq) so does not need to be stored
  * @cs:			ID of the chip select connected to the slave.
  * @mode:		SPI mode to use for this slave (see SPI mode flags)
- * @op_mode_rx:		SPI RX operation mode.
+ * @mode_rx:		SPI RX mode to use for this slave
  * @wordlen:		Size of SPI word in number of bits
  * @max_write_size:	If non-zero, the maximum number of bytes which can
  *			be written at once, excluding command bytes.
@@ -117,7 +117,7 @@ struct spi_slave {
 	unsigned int cs;
 #endif
 	uint mode;
-	u8 op_mode_rx;
+	u8 mode_rx;
 	unsigned int wordlen;
 	unsigned int max_write_size;
 	void *memory_map;
Signature · 1 line
1.9.1
#8 lore raw

PATCH 4/8 spi: Rename op_mode_rx to mode_rx

Hi Jagan,

Quoted 5 lines · Jagan Teki

Since spi rx mode macro's are renamed to simple and meaninfull in below patch, this patch will rename the respective structure member.
"spi: Rename SPI_OPM_RX_* to SPI_RX_*" (sha1: 5e9ffbc5376616449beaaf2bc100f579f12291cf)

I don't see this commit id in the origin/master. Can you please double check?

Quoted 7 lines
Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

Other than that,

Regards,
Bin

author
#9 lore raw

PATCH 4/8 spi: Rename op_mode_rx to mode_rx

Hi Bin,

Quoted 10 lines · Bin Meng

Hi Jagan,

Quoted 5 lines · Jagan Teki

Since spi rx mode macro's are renamed to simple and meaninfull in below patch, this patch will rename the respective structure member.
"spi: Rename SPI_OPM_RX_* to SPI_RX_*" (sha1: 5e9ffbc5376616449beaaf2bc100f579f12291cf)

I don't see this commit id in the origin/master. Can you please double check?

This sha1 is from 3/4 - OK I will skip this details on commit message looks confusing.

Quoted 9 lines
Quoted 8 lines
Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

Quoted 4 lines

Other than that,

thanks!

Signature · 1 line
Jagan.
#10 lore raw

PATCH 4/8 spi: Rename op_mode_rx to mode_rx

Hi Jagan,

Quoted 12 lines · Jagan Teki

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Jagan,

Quoted 5 lines · Jagan Teki

Since spi rx mode macro's are renamed to simple and meaninfull in below patch, this patch will rename the respective structure member.
"spi: Rename SPI_OPM_RX_* to SPI_RX_*" (sha1: 5e9ffbc5376616449beaaf2bc100f579f12291cf)

Quoted 5 lines
Quoted 1 line

I don't see this commit id in the origin/master. Can you please double check?

This sha1 is from 3/4 - OK I will skip this details on commit message looks confusing.

Unless the commit id is already in u-boot/master, I doubt your local commit id will become invalid when it merges to mainstream.

Regards,
Bin

author
#11 lore raw

PATCH 4/8 spi: Rename op_mode_rx to mode_rx

Quoted 15 lines · Bin Meng

Hi Jagan,

Quoted 12 lines · Jagan Teki

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Jagan,

Quoted 5 lines · Jagan Teki

Since spi rx mode macro's are renamed to simple and meaninfull in below patch, this patch will rename the respective structure member.
"spi: Rename SPI_OPM_RX_* to SPI_RX_*" (sha1: 5e9ffbc5376616449beaaf2bc100f579f12291cf)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I don't see this commit id in the origin/master. Can you please double check?

This sha1 is from 3/4 - OK I will skip this details on commit message looks confusing.

Unless the commit id is already in u-boot/master, I doubt your local commit id will become invalid when it merges to mainstream.

OK, I will remove the commit id while applying.

thanks!

Signature · 1 line
Jagan.
author
#12 lore raw

PATCH 5/8 spi: Move mode, mode_rx, flags macro's to structure

In reply to Jagan Teki

This patch moves mode, mode_rx, flags macro's to respective member position on spi_slave{}, for better readabilty and finding the respective member macro's easily.

This patch fix's the tab space on mode macro's as well.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 56 ++++++++++++++++++++++++++------------------------------
 1 file changed, 26 insertions(+), 30 deletions(-)
include/spi.h +26 -30
index 48a78dc..9e1fe3f 100644
@@ -10,36 +10,6 @@
 #ifndef _SPI_H_
 #define _SPI_H_
 
-/* SPI mode flags */
-#define	SPI_CPHA	0x01			/* clock phase */
-#define	SPI_CPOL	0x02			/* clock polarity */
-#define	SPI_MODE_0	(0|0)			/* (original MicroWire) */
-#define	SPI_MODE_1	(0|SPI_CPHA)
-#define	SPI_MODE_2	(SPI_CPOL|0)
-#define	SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
-#define	SPI_CS_HIGH	0x04			/* CS active high */
-#define	SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */
-#define	SPI_3WIRE	0x10			/* SI/SO signals shared */
-#define	SPI_LOOP	0x20			/* loopback mode */
-#define	SPI_SLAVE	0x40			/* slave mode */
-#define	SPI_PREAMBLE	0x80			/* Skip preamble bytes */
-#define SPI_TX_BYTE	0x100			/* transmit with 1 wire byte */
-#define SPI_TX_QUAD	0x200			/* transmit with 4 wires */
-
-/* SPI transfer flags */
-#define SPI_XFER_BEGIN		0x01	/* Assert CS before transfer */
-#define SPI_XFER_END		0x02	/* Deassert CS after transfer */
-#define SPI_XFER_MMAP		0x08	/* Memory Mapped start */
-#define SPI_XFER_MMAP_END	0x10	/* Memory Mapped End */
-#define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
-#define SPI_XFER_U_PAGE	(1 << 5)
-
-/* SPI RX operation modes */
-#define SPI_RX_SLOW		(1 << 0)
-#define SPI_RX_FAST		(1 << 1)
-#define SPI_RX_DUAL		(1 << 2)
-#define SPI_RX_QUAD		(1 << 4)
-
 /* SPI bus connection options - see enum spi_dual_flash */
 #define SPI_CONN_DUAL_SHARED		(1 << 0)
 #define SPI_CONN_DUAL_SEPARATED	(1 << 1)
@@ -117,12 +87,38 @@ struct spi_slave {
 	unsigned int cs;
 #endif
 	uint mode;
+#define SPI_CPHA	0x01			/* clock phase */
+#define SPI_CPOL	0x02			/* clock polarity */
+#define SPI_MODE_0	(0|0)			/* (original MicroWire) */
+#define SPI_MODE_1	(0|SPI_CPHA)
+#define SPI_MODE_2	(SPI_CPOL|0)
+#define SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
+#define SPI_CS_HIGH	0x04			/* CS active high */
+#define SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */
+#define SPI_3WIRE	0x10			/* SI/SO signals shared */
+#define SPI_LOOP	0x20			/* loopback mode */
+#define SPI_SLAVE	0x40			/* slave mode */
+#define SPI_PREAMBLE	0x80			/* Skip preamble bytes */
+#define SPI_TX_BYTE	0x100			/* transmit with 1 wire byte */
+#define SPI_TX_QUAD	0x200			/* transmit with 4 wires */
 	u8 mode_rx;
+#define SPI_RX_SLOW		(1 << 0)
+#define SPI_RX_FAST		(1 << 1)
+#define SPI_RX_DUAL		(1 << 2)
+#define SPI_RX_QUAD		(1 << 4)
+
 	unsigned int wordlen;
 	unsigned int max_write_size;
 	void *memory_map;
 	u8 option;
+
 	u8 flags;
+#define SPI_XFER_BEGIN		0x01	/* Assert CS before transfer */
+#define SPI_XFER_END		0x02	/* Deassert CS after transfer */
+#define SPI_XFER_MMAP		0x08	/* Memory Mapped start */
+#define SPI_XFER_MMAP_END	0x10	/* Memory Mapped End */
+#define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
+#define SPI_XFER_U_PAGE		(1 << 5)
 };
 
 /**
Signature · 1 line
1.9.1
#13 lore raw

PATCH 5/8 spi: Move mode, mode_rx, flags macro's to structure

Hi Jagan,

Quoted 3 lines · Jagan Teki

This patch moves mode, mode_rx, flags macro's to respective member position on spi_slave{}, for better readabilty and finding the respective member macro's easily.

I am not in favor of mixing macros along with the structure members. This looks to me not clearer than before. Do we have some guideline anywhere?

Quoted 9 lines

This patch fix's the tab space on mode macro's as well.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

Regards,
Bin

author
#14 lore raw

PATCH 5/8 spi: Move mode, mode_rx, flags macro's to structure

Hi Bin,

Quoted 10 lines · Bin Meng

Hi Jagan,

Quoted 3 lines · Jagan Teki

This patch moves mode, mode_rx, flags macro's to respective member position on spi_slave{}, for better readabilty and finding the respective member macro's easily.

I am not in favor of mixing macros along with the structure members. This looks to me not clearer than before. Do we have some guideline anywhere?

Looks better readable and easily find the respective member macro's ie the reason I have placed and I took the idea from Linux SPI core.

Quoted 10 lines
Quoted 10 lines

This patch fix's the tab space on mode macro's as well.

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>

---

thanks!

Signature · 1 line
Jagan.
author
#15 lore raw

PATCH 6/8 spi: Fix bit assignment with flags

In reply to Jagan Teki

Fixed bit assignment with flags members on spi_slave{}

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/spi.h +3 -3
index 9e1fe3f..526e870 100644
@@ -115,10 +115,10 @@ struct spi_slave {
 	u8 flags;
 #define SPI_XFER_BEGIN		0x01	/* Assert CS before transfer */
 #define SPI_XFER_END		0x02	/* Deassert CS after transfer */
-#define SPI_XFER_MMAP		0x08	/* Memory Mapped start */
-#define SPI_XFER_MMAP_END	0x10	/* Memory Mapped End */
 #define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
-#define SPI_XFER_U_PAGE		(1 << 5)
+#define SPI_XFER_MMAP		0x04	/* Memory Mapped start */
+#define SPI_XFER_MMAP_END	0x08	/* Memory Mapped End */
+#define SPI_XFER_U_PAGE		0x10
 };
 
 /**
Signature · 1 line
1.9.1
author
#17 lore raw

PATCH 7/8 spi: Use BIT macro

In reply to Jagan Teki

Used BIT macro like 1 << nr as BIT(nr) where nr is 0...n

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
include/spi.h +19 -19
index 526e870..ca1ea3b 100644
@@ -87,25 +87,25 @@ struct spi_slave {
 	unsigned int cs;
 #endif
 	uint mode;
-#define SPI_CPHA	0x01			/* clock phase */
-#define SPI_CPOL	0x02			/* clock polarity */
+#define SPI_CPHA	BIT(0)			/* clock phase */
+#define SPI_CPOL	BIT(1)			/* clock polarity */
 #define SPI_MODE_0	(0|0)			/* (original MicroWire) */
 #define SPI_MODE_1	(0|SPI_CPHA)
 #define SPI_MODE_2	(SPI_CPOL|0)
 #define SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
-#define SPI_CS_HIGH	0x04			/* CS active high */
-#define SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */
-#define SPI_3WIRE	0x10			/* SI/SO signals shared */
-#define SPI_LOOP	0x20			/* loopback mode */
-#define SPI_SLAVE	0x40			/* slave mode */
-#define SPI_PREAMBLE	0x80			/* Skip preamble bytes */
-#define SPI_TX_BYTE	0x100			/* transmit with 1 wire byte */
-#define SPI_TX_QUAD	0x200			/* transmit with 4 wires */
+#define SPI_CS_HIGH	BIT(2)			/* CS active high */
+#define SPI_LSB_FIRST	BIT(3)			/* per-word bits-on-wire */
+#define SPI_3WIRE	BIT(4)			/* SI/SO signals shared */
+#define SPI_LOOP	BIT(5)			/* loopback mode */
+#define SPI_SLAVE	BIT(6)			/* slave mode */
+#define SPI_PREAMBLE	BIT(7)			/* Skip preamble bytes */
+#define SPI_TX_BYTE	BIT(8)			/* transmit with 1 wire byte */
+#define SPI_TX_QUAD	BIT(9)			/* transmit with 4 wires */
 	u8 mode_rx;
-#define SPI_RX_SLOW		(1 << 0)
-#define SPI_RX_FAST		(1 << 1)
-#define SPI_RX_DUAL		(1 << 2)
-#define SPI_RX_QUAD		(1 << 4)
+#define SPI_RX_SLOW		BIT(0)
+#define SPI_RX_FAST		BIT(1)
+#define SPI_RX_DUAL		BIT(2)
+#define SPI_RX_QUAD		BIT(4)
 
 	unsigned int wordlen;
 	unsigned int max_write_size;
@@ -113,12 +113,12 @@ struct spi_slave {
 	u8 option;
 
 	u8 flags;
-#define SPI_XFER_BEGIN		0x01	/* Assert CS before transfer */
-#define SPI_XFER_END		0x02	/* Deassert CS after transfer */
+#define SPI_XFER_BEGIN		BIT(0)	/* Assert CS before transfer */
+#define SPI_XFER_END		BIT(1)	/* Deassert CS after transfer */
 #define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
-#define SPI_XFER_MMAP		0x04	/* Memory Mapped start */
-#define SPI_XFER_MMAP_END	0x08	/* Memory Mapped End */
-#define SPI_XFER_U_PAGE		0x10
+#define SPI_XFER_MMAP		BIT(2)	/* Memory Mapped start */
+#define SPI_XFER_MMAP_END	BIT(3)	/* Memory Mapped End */
+#define SPI_XFER_U_PAGE		BIT(4)
 };
 
 /**
Signature · 1 line
1.9.1
author
#19 lore raw

PATCH 8/8 spi: Minor cleanup

In reply to Jagan Teki

- Add comments on mode_rx
- Tab space's

Cc Simon Glass <[email protected]>
Cc Bin Meng <[email protected]>
Cc Michal Simek <[email protected]>
Cc Siva Durga Prasad Paladugu <[email protected]>
---
 include/spi.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
include/spi.h +8 -8
index ca1ea3b..803fb40 100644
@@ -102,10 +102,10 @@ struct spi_slave {
 #define SPI_TX_BYTE	BIT(8)			/* transmit with 1 wire byte */
 #define SPI_TX_QUAD	BIT(9)			/* transmit with 4 wires */
 	u8 mode_rx;
-#define SPI_RX_SLOW		BIT(0)
-#define SPI_RX_FAST		BIT(1)
-#define SPI_RX_DUAL		BIT(2)
-#define SPI_RX_QUAD		BIT(4)
+#define SPI_RX_SLOW	BIT(0)			/* receive with 1 wire slow */
+#define SPI_RX_FAST	BIT(1)			/* receive with 1 wire fast */
+#define SPI_RX_DUAL	BIT(2)			/* receive with 2 wires */
+#define SPI_RX_QUAD	BIT(4)			/* receive with 4 wires */
 
 	unsigned int wordlen;
 	unsigned int max_write_size;
@@ -113,11 +113,11 @@ struct spi_slave {
 	u8 option;
 
 	u8 flags;
-#define SPI_XFER_BEGIN		BIT(0)	/* Assert CS before transfer */
-#define SPI_XFER_END		BIT(1)	/* Deassert CS after transfer */
+#define SPI_XFER_BEGIN		BIT(0)		/* Assert CS before transfer */
+#define SPI_XFER_END		BIT(1)		/* Deassert CS after transfer */
 #define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
-#define SPI_XFER_MMAP		BIT(2)	/* Memory Mapped start */
-#define SPI_XFER_MMAP_END	BIT(3)	/* Memory Mapped End */
+#define SPI_XFER_MMAP		BIT(2)		/* Memory Mapped start */
+#define SPI_XFER_MMAP_END	BIT(3)		/* Memory Mapped End */
 #define SPI_XFER_U_PAGE		BIT(4)
 };
 
Signature · 1 line
1.9.1
author
#21 lore raw

cover spi: Cleanup set

In reply to Jagan Teki
Quoted 12 lines · Jagan Teki

Cleanup set on spi_slave{}

Jagan Teki (8):
spi: Remove SPI_OPM_RX_EXTN
spi: Remove SPI_OPM_RX_DIO|QIOF
spi: Rename SPI_OPM_RX_* to SPI_RX_*
spi: Rename op_mode_rx to mode_rx
spi: Move mode, mode_rx, flags macro's to structure
spi: Fix bit assignment with flags
spi: Use BIT macro
spi: Minor cleanup

Quoted 5 lines
 drivers/mtd/spi/spi_flash.c |  2 +-
 drivers/spi/ich.c           |  2 +-
 drivers/spi/ti_qspi.c       |  2 +-
 include/spi.h               | 65 +++++++++++++++++++--------------------------
 4 files changed, 31 insertions(+), 40 deletions(-)

thanks!

Signature · 1 line
Jagan.
author
#22 lore raw

cover spi: Cleanup set

Hi Bin,

Quoted 13 lines · Jagan Teki
Quoted 12 lines · Jagan Teki

Cleanup set on spi_slave{}

Jagan Teki (8):
spi: Remove SPI_OPM_RX_EXTN
spi: Remove SPI_OPM_RX_DIO|QIOF
spi: Rename SPI_OPM_RX_* to SPI_RX_*
spi: Rename op_mode_rx to mode_rx
spi: Move mode, mode_rx, flags macro's to structure
spi: Fix bit assignment with flags
spi: Use BIT macro
spi: Minor cleanup

Quoted 7 lines
Quoted 5 lines
 drivers/mtd/spi/spi_flash.c |  2 +-
 drivers/spi/ich.c           |  2 +-
 drivers/spi/ti_qspi.c       |  2 +-
 include/spi.h               | 65 +++++++++++++++++++--------------------------
 4 files changed, 31 insertions(+), 40 deletions(-)

Any chance to look at these?

thanks!

Signature · 1 line
Jagan.
#23 lore raw

cover spi: Cleanup set

Hi Jagan,

Quoted 22 lines · Jagan Teki

Hi Bin,

Quoted 19 lines · Jagan Teki
Quoted 17 lines · Jagan Teki

Cleanup set on spi_slave{}

Jagan Teki (8):
spi: Remove SPI_OPM_RX_EXTN
spi: Remove SPI_OPM_RX_DIO|QIOF
spi: Rename SPI_OPM_RX_* to SPI_RX_*
spi: Rename op_mode_rx to mode_rx
spi: Move mode, mode_rx, flags macro's to structure
spi: Fix bit assignment with flags
spi: Use BIT macro
spi: Minor cleanup

 drivers/mtd/spi/spi_flash.c |  2 +-
 drivers/spi/ich.c           |  2 +-
 drivers/spi/ti_qspi.c       |  2 +-
 include/spi.h               | 65 +++++++++++++++++++--------------------------
 4 files changed, 31 insertions(+), 40 deletions(-)
Quoted 4 lines
Quoted 1 line

Any chance to look at these?

Yes, I will find some time to look at this series and give a test.

Regards,
Bin

#24 lore raw

cover spi: Cleanup set

In reply to Jagan Teki
Quoted 12 lines · Jagan Teki

Cleanup set on spi_slave{}

Jagan Teki (8):
spi: Remove SPI_OPM_RX_EXTN
spi: Remove SPI_OPM_RX_DIO|QIOF
spi: Rename SPI_OPM_RX_* to SPI_RX_*
spi: Rename op_mode_rx to mode_rx
spi: Move mode, mode_rx, flags macro's to structure
spi: Fix bit assignment with flags
spi: Use BIT macro
spi: Minor cleanup

Quoted 6 lines
 drivers/mtd/spi/spi_flash.c |  2 +-
 drivers/spi/ich.c           |  2 +-
 drivers/spi/ti_qspi.c       |  2 +-
 include/spi.h               | 65 +++++++++++++++++++--------------------------
 4 files changed, 31 insertions(+), 40 deletions(-)

Tested the series on AM437x SK and DRA74 EVM.

Regards
Mugunthan V N