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

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Wed Nov 16 06:42:59 CET 2016


Hi,

> -----Original Message-----
> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Jagan Teki
> Sent: Wednesday, November 16, 2016 9:33 AM
> To: u-boot at lists.denx.de
> Cc: Jagan Teki <jagan at openedev.com>
> Subject: [U-Boot] [PATCH v6 03/21] 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 at gmail.com>
> Signed-off-by: Jagan Teki <jagan at openedev.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Jagan Teki <jagan at openedev.com>
> Tested-by: Jagan Teki <jagan 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)) >>
As mentioned in 01/21, no magic numbers here as well. Otherwise, Reviewed-by

Regards,
Siva
>  					(8 * (IDCODE_LEN - 1 - sbsf->off));
>  			} else {
>  				id = 0;
> --
> 1.9.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list