From patchwork Sun Sep 25 19:52:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 674700 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 3shyWp2FB1z9s5w for ; Mon, 26 Sep 2016 05:55:50 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BF608B382F; Sun, 25 Sep 2016 21:55:23 +0200 (CEST) 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 sb_ahnyZLNot; Sun, 25 Sep 2016 21:55:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C569EB3830; Sun, 25 Sep 2016 21:55:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5E27CA76A1 for ; Sun, 25 Sep 2016 21:55:02 +0200 (CEST) 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 0K6cFnYpyd8o for ; Sun, 25 Sep 2016 21:55:02 +0200 (CEST) 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-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by theia.denx.de (Postfix) with ESMTPS id 0E98FA766B for ; Sun, 25 Sep 2016 21:54:51 +0200 (CEST) Received: by mail-pf0-f193.google.com with SMTP id 6so8047684pfl.2 for ; Sun, 25 Sep 2016 12:54:51 -0700 (PDT) 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=IHXuTGmeTwtYgmfMyhaxVLfqxbqzn+e9C2JA7tlQsX8=; b=GACDjaE6mx5YKBBf5dzUaAFSiSTlZbJF2qXECdGe33qYoSDtfh9+RKetvczd7L0PpQ h+hVZb2F21pS6T2c1MdKBJmNE7+YkO88KEGng3AqUmStwJktp6VW9B0ksScnfrQgPOyZ W7MgfdENz4IQXjMgAh7lgx8h9Kb9CPWX/DQ/vmgLZqe/raJFFg5vLGtgFUEi8a+orTTu 3I0qu5S7nXc8w03ULyqnR+UEESvcXbKidrr55hNcl277i80VH6gQCQ2Qjc/sSotROfuW bgTxiNSD0IzoqjSaVrsp43hCBfWdki79vnguvov96R0X1l/dc/4aosvIwEODMOEpklwB 8GaA== X-Gm-Message-State: AE9vXwMhplGkYYHurXxmRm2tRKnQMdxYrQ2LPqKyYEd2vmtQ4FDGf1GxetGc3wmpvO6+HQ== X-Received: by 10.98.151.17 with SMTP id n17mr32153299pfe.73.1474833288272; Sun, 25 Sep 2016 12:54:48 -0700 (PDT) Received: from Mr.J ([49.204.230.134]) by smtp.gmail.com with ESMTPSA id f16sm25347446pfd.84.2016.09.25.12.54.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Sep 2016 12:54:46 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Date: Mon, 26 Sep 2016 01:22:55 +0530 Message-Id: <1474833185-26814-8-git-send-email-jteki@openedev.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474833185-26814-1-git-send-email-jteki@openedev.com> References: <1474833185-26814-1-git-send-email-jteki@openedev.com> Cc: Michal Simek , Siva Durga Prasad Paladugu , Jagan Teki Subject: [U-Boot] [PATCH v4 07/17] sf: Add SPI_FLASH_MAX_ID_LEN 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" Add id length of 5 bytes numerical value to macro. Cc: Simon Glass Cc: Bin Meng Cc: York Sun Cc: Vignesh R Cc: Mugunthan V N Cc: Michal Simek Cc: Siva Durga Prasad Paladugu Signed-off-by: Jagan Teki --- drivers/mtd/spi/sf_internal.h | 3 ++- drivers/mtd/spi/spi_flash.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 527c252..437ac8a 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -108,6 +108,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len, #define JEDEC_MFR(info) ((info)->id[0]) #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2])) #define JEDEC_EXT(info) (((info)->id[3]) << 8 | ((info)->id[4])) +#define SPI_FLASH_MAX_ID_LEN 5 struct spi_flash_info { const char *name; @@ -117,7 +118,7 @@ struct spi_flash_info { * The first three bytes are the JEDIC ID. * JEDEC ID zero means "no ID" (mostly older chips). */ - u8 id[5]; + u8 id[SPI_FLASH_MAX_ID_LEN]; u8 id_len; /* The size listed here is what works with SPINOR_OP_SE, which isn't diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 0777bb5..ba884d7 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -928,10 +928,10 @@ static int micron_quad_enable(struct spi_flash *flash) static const struct spi_flash_info *spi_flash_read_id(struct spi_flash *flash) { int tmp; - u8 id[5]; + u8 id[SPI_FLASH_MAX_ID_LEN]; const struct spi_flash_info *info; - tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5); + tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, SPI_FLASH_MAX_ID_LEN); if (tmp < 0) { printf("SF: error %d reading JEDEC ID\n", tmp); return ERR_PTR(tmp);