From: Jagan Teki Date: Sun, 30 Oct 2016 17:46:12 +0000 (+0530) Subject: sf: sandbox: Use JEDEC_MFR|ID in id exctract X-Git-Tag: v2025.01-rc5-pxa1908~8115^2~20 X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-logo.png?a=commitdiff_plain;h=523b4e37e867a43f6508bd885e54dd60f876ec43;p=u-boot.git 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 Signed-off-by: Jagan Teki Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Tested-by: Jagan Teki --- diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index d68ee4a293..09ce7837ea 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;