aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorJagan Teki2016-10-30 23:16:12 +0530
committerJagan Teki2016-11-18 13:04:52 +0530
commit523b4e37e867a43f6508bd885e54dd60f876ec43 (patch)
treeb5cee696cbf0cd4540a5df17bf0b41d435e8b26c /drivers/mtd/spi
parentdda06a4328d6881b4809983e46e281c30d872c13 (diff)
sf: sandbox: Use JEDEC_MFR|ID in id exctract
Instead of extracting id's separately better to use JEDEC_MFR|ID for code simplicity. Cc: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jagan@openedev.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jagan@openedev.com> Tested-by: Jagan Teki <jagan@openedev.com>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/sandbox.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index d68ee4a293b..09ce7837ea9 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;