From patchwork Wed Nov 16 04:02:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 695420 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tJVy06Kgbz9syB for ; Wed, 16 Nov 2016 15:04:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D9F84B3835; Wed, 16 Nov 2016 05:04:11 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6uzDJl8tiriD; Wed, 16 Nov 2016 05:04:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D2ACDA7581; Wed, 16 Nov 2016 05:04:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0357D4BDBD for ; Wed, 16 Nov 2016 05:03:57 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id To7F9YBdDmXW for ; Wed, 16 Nov 2016 05:03:56 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by theia.denx.de (Postfix) with ESMTPS id 21D78A754C for ; Wed, 16 Nov 2016 05:03:53 +0100 (CET) Received: by mail-pf0-f195.google.com with SMTP id y68so9021312pfb.1 for ; Tue, 15 Nov 2016 20:03:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8vykY9ks+ZGnmHI35Wj6D470AqQCdFNhrfryro5gGSg=; b=Uvd6HYRY/D8QnP+MOd8Q7jFTO7Hl8hwXyV2c+PMeWVu7szcxx27TIKf0YfePVb2nY+ WBvrAtSd8mabUHsM+Xc3qJNrdjYyUOLmlFJ3wlMUgNTtoSRmJciiBmFgsLqQDbG+2+wF 6XlgIFOkIPId22qm+ImkPEaduwyj2FDw5OboorkSMiO8Ka23OuvkYSfGMbIpdfYBI7xT P9gaEn0eaon/2xkBR5rGmABI9xEwy6gwS7RX/4iKCyqE+b02yXNAEe4+BrUcVOhgm2dF R639+vL6yB0nhZsIq17/zKNWmi8w4v3cElSxH53J4CbY3IHIwTv6pHSLvBlMJGKklfov caIw== X-Gm-Message-State: ABUngvd7MpActZ6B54SV9AMsONJpkIjJ2mSh36+/Ko4MsN1i7x4uC5kt293i93owf+262g== X-Received: by 10.99.124.20 with SMTP id x20mr3671091pgc.60.1479269031626; Tue, 15 Nov 2016 20:03:51 -0800 (PST) Received: from localhost.localdomain ([115.97.183.210]) by smtp.gmail.com with ESMTPSA id q145sm25217663pfq.22.2016.11.15.20.03.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Nov 2016 20:03:50 -0800 (PST) From: Jagan Teki To: u-boot@lists.denx.de Date: Wed, 16 Nov 2016 09:32:54 +0530 Message-Id: <1479268992-26811-4-git-send-email-jagan@openedev.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479268992-26811-1-git-send-email-jagan@openedev.com> References: <1479268992-26811-1-git-send-email-jagan@openedev.com> Cc: Jagan Teki Subject: [U-Boot] [PATCH v6 03/21] sf: sandbox: Use JEDEC_MFR|ID in id exctract X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- 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;