[U-Boot] [PATCH v4 03/17] sf: sandbox: Use JEDEC_MFR|ID in id exctract

Jagan Teki jteki at openedev.com
Sun Sep 25 21:52:51 CEST 2016


Instead of extracting id's separately better
to use JEDEC_MFR|ID for code simplicity.

Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
 drivers/mtd/spi/sandbox.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index d68ee4a..09ce783 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -359,9 +359,8 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned int bitlen,
 			debug(" id: off:%u tx:", sbsf->off);
 			if (sbsf->off < IDCODE_LEN) {
 				/* Extract correct byte from ID 0x00aabbcc */
-				id = ((((sbsf->data)->id[0]) << 16) |
-					(((sbsf->data)->id[1]) << 8 |
-					((sbsf->data)->id[2]))) >>
+				id = ((JEDEC_MFR(sbsf->data) << 16) |
+					JEDEC_ID(sbsf->data)) >>
 					(8 * (IDCODE_LEN - 1 - sbsf->off));
 			} else {
 				id = 0;
-- 
2.7.4



More information about the U-Boot mailing list