From: Jagan Teki <jteki@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/8] spi: Use BIT macro
Date: Wed, 16 Dec 2015 21:10:46 +0530 [thread overview]
Message-ID: <1450280447-3897-8-git-send-email-jteki@openedev.com> (raw)
In-Reply-To: <1450280447-3897-1-git-send-email-jteki@openedev.com>
Used BIT macro like 1 << nr as BIT(nr) where nr is 0...n
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
include/spi.h | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/spi.h b/include/spi.h
index 526e870..ca1ea3b 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -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)
};
/**
--
1.9.1
next prev parent reply other threads:[~2015-12-16 15:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 15:40 [U-Boot] [PATCH 0/8] spi: Cleanup set Jagan Teki
2015-12-16 15:40 ` [U-Boot] [PATCH 1/8] spi: Remove SPI_OPM_RX_EXTN Jagan Teki
2015-12-21 6:27 ` Bin Meng
2015-12-16 15:40 ` [U-Boot] [PATCH 2/8] spi: Remove SPI_OPM_RX_DIO|QIOF Jagan Teki
2015-12-21 6:28 ` Bin Meng
2015-12-16 15:40 ` [U-Boot] [PATCH 3/8] spi: Rename SPI_OPM_RX_* to SPI_RX_* Jagan Teki
2015-12-21 6:28 ` Bin Meng
2015-12-16 15:40 ` [U-Boot] [PATCH 4/8] spi: Rename op_mode_rx to mode_rx Jagan Teki
2015-12-21 6:28 ` Bin Meng
2015-12-23 6:36 ` Jagan Teki
2015-12-23 7:23 ` Bin Meng
2015-12-28 12:19 ` Jagan Teki
2015-12-16 15:40 ` [U-Boot] [PATCH 5/8] spi: Move mode, mode_rx, flags macro's to structure Jagan Teki
2015-12-21 5:48 ` Bin Meng
2015-12-23 6:38 ` Jagan Teki
2015-12-16 15:40 ` [U-Boot] [PATCH 6/8] spi: Fix bit assignment with flags Jagan Teki
2015-12-21 6:28 ` Bin Meng
2015-12-16 15:40 ` Jagan Teki [this message]
2015-12-21 6:28 ` [U-Boot] [PATCH 7/8] spi: Use BIT macro Bin Meng
2015-12-16 15:40 ` [U-Boot] [PATCH 8/8] spi: Minor cleanup Jagan Teki
2015-12-21 6:28 ` Bin Meng
2015-12-17 7:14 ` [U-Boot] [PATCH 0/8] spi: Cleanup set Jagan Teki
2015-12-17 7:15 ` Jagan Teki
2015-12-17 7:28 ` Bin Meng
2015-12-23 10:02 ` Mugunthan V N
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450280447-3897-8-git-send-email-jteki@openedev.com \
--to=jteki@openedev.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.