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>
This commit is contained in:
Jagan Teki 2016-10-30 23:16:12 +05:30
parent dda06a4328
commit 523b4e37e8

View File

@ -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;