From patchwork Wed Oct 21 09:54:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 55352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 8E1B32303B for ; Wed, 21 Oct 2015 09:54:26 +0000 (UTC) Received: by wicfg8 with SMTP id fg8sf5029604wic.0 for ; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=ahgH5HoBpA7dUbdnN9YBhh4/4GTWV7bqx1vZXWoekCU=; b=Ky9j2aI6GwMwO7IaR53zkIYuGqdr3D8CWFoHL++wrKKq6ucvNbw7EA/sc/3UWTRV+5 +9zZ1esL+gmFhzCHX5PL0P7//D/YRIfM8/fxTPwU+S2kB806+RGhbZQnG2/1Jlz4CUeZ fqVkDryuoHfkH/Ll6k9D6TJlGx3ThG1VyTjgTsPw0gJ36Kj3JcV8vt02gct3AhGD7/6U V1f9KP+dM8FFyMm0qlrgjTunz1+cmJk7zqlfc/FoAMDhDXiOvRCwvK0zIVIpHgxncLmW 5gaOSibIY/v6uGBo0BgCbFTq0I1M7IvxoLPMXbs+WZn0S1qolXB1D7pWxAxj7zIDm3P4 +kpg== X-Gm-Message-State: ALoCoQn5M9ZMfF4/6y2SXX0E9Mo/3zK4jSKmpqRXIdoRR/BmUW8VH9tBNHtMM3nk4tXjq9d05L91 X-Received: by 10.112.190.74 with SMTP id go10mr1937134lbc.9.1445421265885; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.18.90 with SMTP id h87ls192015lfi.9.gmail; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-Received: by 10.112.62.137 with SMTP id y9mr4539587lbr.63.1445421265744; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id q132si5719453lfe.170.2015.10.21.02.54.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 02:54:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lffz202 with SMTP id z202so18373113lff.3 for ; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-Received: by 10.25.77.17 with SMTP id a17mr15230lfb.19.1445421265616; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2585419lbq; Wed, 21 Oct 2015 02:54:25 -0700 (PDT) X-Received: by 10.180.35.163 with SMTP id i3mr9317365wij.80.1445421264972; Wed, 21 Oct 2015 02:54:24 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id er8si10414084wjc.65.2015.10.21.02.54.24; Wed, 21 Oct 2015 02:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A740F4B6B2; Wed, 21 Oct 2015 11:54: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 2Ug8RfBpRBkA; Wed, 21 Oct 2015 11:54:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34AD04B69E; Wed, 21 Oct 2015 11:54:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 844964B6A7 for ; Wed, 21 Oct 2015 11:54:20 +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 vCGMp_0joZIK for ; Wed, 21 Oct 2015 11:54:20 +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-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by theia.denx.de (Postfix) with ESMTPS id 623644B69E for ; Wed, 21 Oct 2015 11:54:17 +0200 (CEST) Received: by wicfv8 with SMTP id fv8so66686498wic.0 for ; Wed, 21 Oct 2015 02:54:17 -0700 (PDT) X-Received: by 10.180.91.103 with SMTP id cd7mr6367939wib.74.1445421257538; Wed, 21 Oct 2015 02:54:17 -0700 (PDT) Received: from localhost.localdomain (82-69-54-187.dsl.in-addr.zen.co.uk. [82.69.54.187]) by smtp.gmail.com with ESMTPSA id lr6sm5069125wic.3.2015.10.21.02.54.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Oct 2015 02:54:16 -0700 (PDT) From: Ryan Harkin To: Stefan Roese , u-boot@lists.denx.de, Albert Aribaud , Tom Rini Date: Wed, 21 Oct 2015 10:54:05 +0100 Message-Id: <1445421247-15013-2-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445421247-15013-1-git-send-email-ryan.harkin@linaro.org> References: <1445421247-15013-1-git-send-email-ryan.harkin@linaro.org> Cc: Steve Rae , Liviu Dudau Subject: [U-Boot] [PATCH 1/3] cfi_flash: use specific length types for cword X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ryan.harkin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 cword.l is an unsigned long int, but it is intended to be 32 bits long. Unfortunately, it's 64-bits long on a 64-bit system, meaning that a 64-bit system cannot use 32-bit wide CFI flash parts. Similar problems also exist with the other cword sizes. Also, this patch introduced compiler warnings: drivers/mtd/cfi_flash.c: In function 'flash_write_cmd': drivers/mtd/cfi_flash.c:348:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type '__u32' [-Wformat=] debug ("fwc addr %p cmd %x %8.8lx 32bit x %d bit\n", addr, ^ drivers/mtd/cfi_flash.c: In function 'flash_isequal': drivers/mtd/cfi_flash.c:404:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type '__u32' [-Wformat=] debug ("is= %8.8x %8.8lx\n", flash_read32(addr), cword.l); ^ I masked these warnings in this patch, however, I am quite sure this is the wrong approach. Signed-off-by: Ryan Harkin Acked-by: Stefan Roese --- drivers/mtd/cfi_flash.c | 4 ++-- include/mtd/cfi_flash.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 50983b8..cee85a9 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -345,7 +345,7 @@ void flash_write_cmd (flash_info_t * info, flash_sect_t sect, flash_write16(cword.w, addr); break; case FLASH_CFI_32BIT: - debug ("fwc addr %p cmd %x %8.8lx 32bit x %d bit\n", addr, + debug ("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, cmd, cword.l, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write32(cword.l, addr); @@ -401,7 +401,7 @@ static int flash_isequal (flash_info_t * info, flash_sect_t sect, retval = (flash_read16(addr) == cword.w); break; case FLASH_CFI_32BIT: - debug ("is= %8.8x %8.8lx\n", flash_read32(addr), cword.l); + debug ("is= %8.8x %8.8x\n", flash_read32(addr), cword.l); retval = (flash_read32(addr) == cword.l); break; case FLASH_CFI_64BIT: diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h index 048b477..cd30619 100644 --- a/include/mtd/cfi_flash.h +++ b/include/mtd/cfi_flash.h @@ -105,10 +105,10 @@ #define NUM_ERASE_REGIONS 4 /* max. number of erase regions */ typedef union { - unsigned char c; - unsigned short w; - unsigned long l; - unsigned long long ll; + __u8 c; + __u16 w; + __u32 l; + __u64 ll; } cfiword_t; /* CFI standard query structure */